> For the complete documentation index, see [llms.txt](https://campus-rover.gitbook.io/lab-notebook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://campus-rover.gitbook.io/lab-notebook/fiiva/namespacing-tfs.md).

# namespacing-tfs.md

#### Evalyn Berleant, Kelly Duan

### TF prefixes

The tf prefix is a parameter that determines the prefix that will go before the name of a tf frame from broadcasters such as gazebo and the robot state publisher, similar to namespacing with nodes that publish to topics. It is important to include

```xml
<param name="tf_prefix" value="$(arg ns)" />
```

inside the namespace spawning the robots.

However, not everything uses tf\_prefix as it is deprecated in tf2. In most cases, the tf prefix will likely remain the same as the namespace in order to be compatible with most packages that rely on topics and tf trees, such as gmapping, which disregard the use of tf prefixes and use namespace for tf frames.

### Getting the namespace

To retrieve the current namespace with rospy, use `rospy.get_namespace()`. This will return the namespace with `/` before and after the name. To remove the `/`s, use `rospy.get_namespace()[1:-1]`.

### References

* [ROS wiki official tf2 migration and decline of the tf prefix](http://wiki.ros.org/tf2/Migration)
* [spawning robots with namespaces in gazebo and rviz - read bottom answer](https://answers.gazebosim.org//question/16497/spawning-multiple-robots-each-with-a-controller-in-the-same-namespace-as-the-controller_manager/)
* [robot\_state\_publisher and tf prefixes](https://answers.ros.org/question/195846/how-to-send-tf-data-from-multiple-namespaces-to-rviz/)


---

# 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://campus-rover.gitbook.io/lab-notebook/fiiva/namespacing-tfs.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.
