angle of rotation to reach goal
I am working on to drive Eddie toward the goal in simulated Reference platform robot 2011. My problem is how to calculate the angle of rotation that is required to face the goal. For example if the initial position of eddie is (4, 0.003, 8.3) with orientation (0,0,0) and the goal position (tv stand) is (9.582, 0.204,14.227) in simulation environment, then how much rotation is needed for desired heading to the goal?
Pls help me in solving the problem.
Pls help me in solving the problem.
Comments
What sort of number is the orientation? Does (0, 0, 0) represent a heading vector?
Thank you
To compute an angle from coordinates one uses the arctangent function. The arctangent function (theta = atan(y/x)) will return an angle between -pi/2 and pi/2. Many computer programs and programming languages have an Atan2 function which will return a result between -pi and pi (or sometime the return value will be between 0 and 2*pi).
This assumes the points are in two dimensional space. For rotations in three dimensional space the calculations quickly become very complicated. To calculate rotations in 3D space you either need to use rotation matrices or quaternions (there may be other alternatives I'm not familiar with).
The difference in the ways angles are calculated in 2D space vs 3D space is why I asked:
Whether or not you need to calculate angles in 2D space or 3D space is an important detail. I would think since the Eddie robot can't fly, 2D calculations would be sufficient.
When I punch the numbers into a calculator I get 2.06 degrees. This seems correct since the TV stand and the Eddie are very close to the y axis.
From the numbers you gave, it appears the Eddie starts out pointing almost right at the TV stand.
Is this not what you see? Can you use the snipping tool (a Windows program) and capture the screen image?
The first one is the original environment, 2nd is after the rotation (2.06 deg), next one is what I want. Here goal is tvstand which is just behind the black sofa
Thank you
Well this doesn't make sense to me. I'm inclined to think the robot's direction has been defined incorrectly. The most likely error would be the rear of the robot was defined as the front but your third picture doesn't look like the robot is pointed at 182.06 degrees so I'm not sure about that.
I think I'm running out of ideas. Maybe someone else on the forum has some experience with this software?