Movement path drawing

I hope you are reading and understanding each piece of code you find, as to its purpose and how it achieves that purpose.

It's likely that you will have to think up new code to achieve your purpose.

This is not a shopping expedition.

Dear ABG thank you for sharing your experience with me. I don't expect you two do all the project. I understand the code and tested it with the robot. And I want to develop it now. But problem is this:
For example when I press forward button, the app sends character 'F' to arduino and it does this with this block:
image

But in path drawing I don't know what should I send to arduino because the robot doesn't move in a specific direction.

It would help to learn the x,y directions of the Canvas and decide on an initial Direction for the robot.

Let's assume North (descending y, constant x) is the direction the robot is initially facing, and that it is at the center of the Canvas.

Work from there.

If the robot then turns right, it will be facing East. Movement East has increasing x, and constant y.

Do you see the pattern?

Yes I understand what you say. assume robot is in this coordinates: X=200 , Y=100. and it wants to go to these coordinates: X=100 , Y=50. And the path is a direct line. And in my code I have four directions(move forward,move backward,turn right,turn left). At first robot should turn 45 degrees to right and then move forward. How can I relate these directions that I have in my arduino code to the coordinates? witch relation is there between them? And I don't know should I send the coordinates or the directions to the arduino? If I send coordinates, How can I define the arduino witch direction should move?

You will need to know How to Work With Lists

1 Like

Thanks

I found a relation between directions and (x,y) coordinates. I made several lists and added the relations to them. and defined the repeating time of each direction with the relations. And at least when the user presses execute button, the app send 50 and (60 or 70). when It sends 50, robot will move forward. And it sends the repeating time of move forward too with start repeating block. And the it sends 60 or 70. if it send 60 robot will turn right and if it send 70 robot will turn left. And it sends the repeating time of turning too. But when I draw the path and then press execute 'run time error' displays in app and the app doesn't work. whats the problem? These are the blocks:


drawRouteForCar2.aia (8.9 KB)

This is the serial monitor:

This is app error:

I see at least two problems

You have empty sockets

You apply text operations to lists and list operations to text

I had no time to examine your logic or data structure

1 Like

Why does your Canvas have obstacles on it? Can't the robot feel collisions?

How do you know the real obstacles match the Canvas obstacles?

Why use dragging for drawing when Turtle Graphic commands match the robot capability closer? (Search this board)

I found Those blocks in app inventor and I didn't change them because they was working correctly. I just added some lists to change the x,y coordinates to my directions in the code and each direction repeataion time And some blocks to bluetooth connection and sending data to arduino.
TIMAI2 sent these blocks here. and they are working correctly:

my problem is after the above blocks where I added new blocks.


about obstacles to begin with I ignore and I want to work on it in my arduino code.

What is global forward repeating time?

It is the time that the robot will execute move forward (move at forward direction).
I edited the blocks and this error is displayed in app. why round block can't round arguments? witch block should I use?


This is the last edition:
drawRouteForCar2(1).aia (8.8 KB)

You can't round a list.

You can only round a number.

A list is not a number.

Got that?

1 Like

But I used round for numbers not lists

The error message says otherwise.

What do you think those [] marks mean?

1 Like

So how can I round the values of a list?

You can round the values before you add them to the list, one by one.

1 Like