Go Down

### Topic: Position and direction calculation (Read 255 times)previous topic - next topic

#### MrKrabs

##### Mar 29, 2019, 01:55 pm
Greetings,

We are creating a robot called "Line Dancer" which rides around in an environment drawing an image    (env.PNG).

The sensors we use to calculate the X-axis and Y-axis are 2 HC-SR04 ultrasonic sensors.

For direction calculations we would like to use 9DOF Sensor Stick.

Via bluetooth (HC05 module) we send coordinates to the robot where he should draw. So we have a position of the robot itself and the X,Y where he should go. In screenshot idea.PNG it might give you a better view.

The question is how do we calculate the degree the robot should turn with the given position of the robot (2 ultrasonic sensors) and the given position of the next point.

In reality their will be alot of "points" to draw because it's an image. In screenshot basic.PNG their is an overview of the process.

Thank you for your help and please if their are any uncertainties ask them I will try to explain better.

#### MarkT

#1
##### Mar 29, 2019, 05:31 pm
Sounds like a task requiring SLAM techniques? https://en.wikipedia.org/wiki/Simultaneous_localization_and_mapping
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

#### PaulS

#2
##### Apr 01, 2019, 07:50 pm
Quote
The question is how do we calculate the degree the robot should turn with the given position of the robot (2 ultrasonic sensors) and the given position of the next point.
If you only know where the robot is (its x,y coordinates). without knowing its orientation, you can't calculate the angle to the next point, because you have no frame of reference.

Suppose, for example, that the robot can be anywhere in a 10 meter by 10 meter area. Suppose that it is at position 3, 7, and the point it needs to go to is  at 3, 10. Now one would think that all the robot needs to do is go forward 3 meters, because the vector from where it is to where it needs to be is parallel to the Y axis.

But, suppose the robot is facing in the -Y direction. Going forward 3 meters won't get you closer to the target point.

How will you know/keep track of the robot's orientation? How will you KNOW that the robot has complete a 0 radius, n degree turn, so that it can go to a specific point, tracing the desired path? How will you even execute a 0 radius turn?

If you know the location and orientation of the robot, you could think about other coordinate systems. A polar coordinate system, for instance, makes "which way do I go from here" calculations dirt simple.