Menu

Coordinate system

Teddy Weisman

Coordinate Frames in USARSim/ROS

The default coordinate system in the Unreal Engine is right-handed, with the positive z-axis pointing downwards. Although the ROS standard states that the positive z-axis should always point upwards, ROS tools will sometimes work in either choice of coordinate system. One major exception is rviz, which will render robots upside down if the Unreal coordinate system is used.

By default, USARSimROS operates entirely in the base Unreal Engine coordinate system (unit conversion is done on the simulator side so that 1 unit = 1 meter, as per the ROS standard). This behavior can be changed by introducing another coordinate frame as the fixed frame. This new global frame is a parent of the default global "odom" frame, and rotates the coordinate system by 180 degrees about the x axis (i.e. flips the signs of the y and z coordinates).

The usarsim/globalFrame parameter

Other ROS nodes that need to reference global positions to control the USARSimROS node (for example, nodes that set goal positions for IK arm navigation) can read the usarsim/globalFrame ROS parameter to keep the global coordinate system consistent across nodes. For instance, if the global frame is set to "odom," then the robotic arm IK controllers expect to recieve goal transformations in the "odom" frame (that is, the Unreal Engine frame).

The base_transform node

The node that adds the extra coordinate frame is base_transform, located in the usarsim_tools package. The base_transform node continuously publishes a 180-degree rotation about the x axis between the frame specified in the usarsim/globalFrame parameter and the "odom" frame.
To use it, first build the package with

$rosmake usarsim_tools

You can then either set the globalFrame parameter directly and run the node from the command line, or add it to a robot launch file so it always runs alongside the controllers.
To set up base_transform from the command line, run:

$rosparam set usarsim/globalFrame /world_base
$rosrun usarsim_tools base_transform

To run base_transform alongside a robot, add these lines to the robot's launch file:

<param name="usarsim/globalFrame" value="/world_base" />
<node name="base_transform" pkg="usarsim_tools" type="base_transform" />
Conditional launching

The launch files for the KR60 arm are set up to conditionally set the globalFrame parameter and run the base_transform node, depending on arguments. To run the KR60 arm with the base_transform node enabled, run:

$roslaunch usarsimKR60.launch coordinate_change:=True

Related

Wiki: Home
Wiki: Running Code