From The Player Project
|Line 44:||Line 44:|
Latest revision as of 15:55, 23 August 2011
Player uses the same coordinate system like gazebo. Its a right handed coordinate system with X and Y in a plane and Z pointing upwards. If you consider your robot (and you are in the origin of your robot) X is the heading direction of your robot. Y points to the left and Z points upwards.
The following image shows the 2d version of this coordinate system with the robots orientation (yaw) values (in rad).
Player uses roll pitch and yaw to determine rotation in three dimensions. If you want to transform between coordinate systems in player (for example local laser scanner coordinate system -> local robot coordinate system) the easiest way is to create a rotation matrix for this transformation.
A rotation around the X-axis (roll) in a right handed coordinate system gives the following matrix RX. A positive roll value results in a counter clockwise rotation:
A rotation around the Y-axis (pitch) in a right handed coordinate system gives the following matrix RY. A positive pitch value results in a counter clockwise rotation:
A rotation around the Z-axis (yaw) in a right handed coordinate system gives the following matrix RZ. A positive yaw value results in a counter clockwise rotation:
Player uses roll pitch yaw order (XYZ convention)in a fixed world coordinate system. This is equivalent to euler angles (in a rotating coordinate system) in yaw pitch roll order (ZYX convention).
Multipilication of RX RY RZ results in the following rotation matrix:
Using this matrix you can convert a 3d point from one coordinate system to the other. For example you get the ranger geom message. Now you create the rotation matrix using geom.pose.proll, geom.pose.ppitch, geom.pose.pyaw. (The order is important). Now you can convert the range point from the local (right handed two dimensional) ranger coordinate system into the local robot coordinate system by multiply all ranger points with the rotation matrix.
If you also consider the translation between the two coordinate systems you can enlarge the rotation matrix to a 4x4 matrix:
Ensure, that you rotate first and translate afterwards.
Robot Reference Point:
The reference point for the local coordinate system is the center of gravity of the robot, laserscanner, ...