> For the complete documentation index, see [llms.txt](https://wiki.ariitk.in/wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.ariitk.in/wiki/tutorials/how-to-write-a-ros-package/transformations.md).

# Transformations

Frame hopping.

Use [minkindr](https://github.com/ethz-asl/minkindr) to represent transformations.

{% embed url="<https://github.com/ethz-asl/minkindr>" %}

Further details on the transformation notation, frame names and conventions can be found on the [wiki page](https://github.com/ethz-asl/mav_tools_public/wiki).

{% embed url="<https://github.com/ethz-asl/mav_tools_public>" %}

## TF2

### tf-remapping

Here,

* old: contains the name of tf that needs to be remapped
* new: new name of tf

```markup
<launch>
 
 <!--tf remmapper node-->
  <node pkg="tf" type="tf_remap" name="tf_remapper" output="screen">
    <rosparam param="mappings">
      [{old: /imu, new: /base_link}]
    </rosparam>
  </node>

 <!--node whose tf needs to be remapped-->
  <node pkg="rosbag" type="play" name="player" args="/home/drive/test.bag">
    <remap from="tf" to="tf_old" />
  </node>

</launch>
```

The topic subscribed to is:

**/tf\_old** (tf/tfMessage) -- Old transform tree. This is usually published by remapping playback of a bag file. You may need to set use\_sim\_time as true for the bag file transforms to be accepted.

The topic published is:

**/tf** (tf/tfMessage) -- Current transform tree. This is the normal /tf topic.

### publish-static-transforms

static\_transform\_publisher x y z yaw pitch roll frame\_id child\_frame\_id period\_in\_ms

> Publish a static coordinate transform to tf using an x/y/z offset in meters and yaw/pitch/roll in radians. (yaw is rotation about Z, pitch is rotation about Y, and roll is rotation about X). The period, in milliseconds, specifies how often to send a transform. 100ms (10hz) is a good value.

static\_transform\_publisher x y z qx qy qz qw frame\_id child\_frame\_id period\_in\_ms

> Publish a static coordinate transform to tf using an x/y/z offset in meters and quaternion. The period, in milliseconds, specifies how often to send a transform. 100ms (10hz) is a good value.

static\_transform\_publisher is designed both as a command-line tool for manual use, as well as for use within roslaunch files for setting static transforms. For example:

```markup
<launch>
<node pkg="tf" type="static_transform_publisher" name="link1_broadcaster" args="1 0 0 0 0 0 1 link1_parent link1 100" />
</launch>
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://wiki.ariitk.in/wiki/tutorials/how-to-write-a-ros-package/transformations.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
