# Transformer Configuration

A robotic system typically has many 3D coordinate frames that change over time, such as a world frame, body frame, etc. To define the transformations between these frames rock uses the convention "Source in target".

## Source in target

All transformations are forming a transformation tree. Inside this tree a source frame is always a topological child of the target frame and stands usually for a frame used to express sensor data. Whereby, the transformation "source in target" describes the translation and rotation needed to transform samples taken in the source frame to samples expressed in target frame.

- sample_in_target = T_source_in_target * sample_in_source

This transformation is equivalent to the transformation needed to transform the target frame to the source frame:

- source_frame = target_frame*T_source_in_target

## Example

Three frames are defined. All frames have the same orientation but the body frame is 2 meter apart from the world frame and the camera frame 0.1 meter apart from the body frame. The transformer configuration would then be defined as blow:

- static_transform(Eigen::Vector3.new(2.0,0.0,0.0),Eigen::Quaternion.new,"body" => "world")
- static_transform(Eigen::Vector3.new(0.1,0.0,0.0),Eigen::Quaternion.new,"camera" => "body")

In the case the robot is moving the bodyInWorld transformations is provided by an odometry component:

- dynamic_transform "odometry.pose_samples", "body" => "world"
- static_transform(Eigen::Vector3.new(0.1,0.0,0.0),Eigen::Quaternion.new,"camera" => "body")

Full configuration of a real robot http://robotik.dfki-bremen.de/de/forschung/projekte/csurvey.html:

- dynamic_transform "uw_portal.rigid_body_state","mounting" => "world"
- static_transform(Eigen::Vector3.new(0.0,0.0,3.0),Eigen::Quaternion.from_euler(Eigen::Vector3.new(Math::PI,0,0),2,1,0),"body" => "mounting")
- static_transform( Eigen::Vector3.new(0.281,0.0,0.0),Eigen::Quaternion.from_euler(Eigen::Vector3.new(0,0,0),2,1,0),"body_joint" => "body")
- static_transform(Eigen::Vector3.new(0.0,0.0,0.0),Eigen::Quaternion.from_euler(Eigen::Vector3.new(Math::PI,0,0),2,1,0),"shoulder" => "body_joint")
- static_transform( Eigen::Vector3.new(0.22,0.0,0.0),Eigen::Quaternion.from_euler(Eigen::Vector3.new(0,0,0),2,1,0),"shoulder_joint" => "shoulder")
- static_transform(Eigen::Vector3.new(0.0,0.0,0.0),Eigen::Quaternion.from_euler(Eigen::Vector3.new(Math::PI,0.5*Math::PI,0),2,1,0),"head" => "shoulder_joint")
- static_transform( Eigen::Vector3.new(0.08,0.0,0.09),Eigen::Quaternion.from_euler(Eigen::Vector3.new(-0.5*Math::PI,0,-0.5*Math::PI),2,1,0),"camera" =>"head")