How to read Cartesian coordinates in the simulator when programming?

Skip to first unread message

Passos 0213

Jul 23, 2020, 12:27:36 PM7/23/20
to Open Roberta
Hello people.

I created some mats for solving mazes, line-following style. Generally, in labyrinth solutions, we read the position coordinates of the robot so that it does not pass through places already visited.
So, is it possible to read the position coordinates of the robot by NEPO programming?

Follow one of my courtesy rugs.arena_labirinto_oficial_03.png

Patrick Werner

Jul 28, 2020, 4:34:47 AM7/28/20
to Open Roberta

there is no way to actually get the coordinates in the simulation (how would the real robot know what position it is in?).

For the coordinates you could try to use color gradients in the background to determine the x and y position with the color sensor.
E.g. 0 - 255 red left to right, 0 - 255 green top to bottom, then use RGB mode of the colour sensor to determine the position. That way you would have different brightnesses of blue left for markers.

For the labyrinth in particular you could keep track of the turns already made and build up knowledge of already taken turns. This could be quite complicated though.


Javier Fernández

Jul 28, 2020, 5:13:03 AM7/28/20
to Open Roberta
Maybe define a function that include the update of the position in a variable, and move the robot by calling that function.
Could be similar to what I'd do with a real robot taking the movement from time if a non precise motor, the steps of a precise motor or a compass giroscope, if available.
Good morning

Passos 0213

Jul 31, 2020, 10:54:31 AM7/31/20
to Open Roberta
Adding an accelerometer block to the simulator would be very interesting.
Reply all
Reply to author
0 new messages