> For the complete documentation index, see [llms.txt](https://wiki.hanzheteng.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.hanzheteng.com/development/ros/wstool.md).

# wstool

## wstool: ROS Workspace Tool&#x20;

```bash
# install wstool
sudo apt-get install python-wstool

# create a workspace
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws
catkin init
#catkin config --merge-devel
#echo 'source ~/catkin_ws/devel/setup.bash' >> ~/.bashrc

# approach one: in src level
cd ~/catkin_ws/src
git clone <ros_package>.git
wstool init
#wstool init . <ros_package>/ssh.rosinstall
wstool merge <ros_package>/ssh.rosinstall
wstool update

# approach two: in workspace level
cd ~/catkin_ws
wstool init src   # will create an empty .rosinstall file 
#wstool init src PATH_TO_ROSINSTALL_FILE.rosinstall  # initialize with a .rosinstall file
wstool merge -t src PATH_TO_ROSINSTALL_FILE.rosinstall
wstool update -t src   # -t specify targer folder

# example: use rosinstall_generator
cd ~/catkin_ws
wstool init src
rosinstall_generator --rosdistro kinetic mavlink | tee /tmp/mavros.rosinstall
rosinstall_generator --upstream mavros | tee -a /tmp/mavros.rosinstall # -a: append
wstool merge -t src /tmp/mavros.rosinstall
wstool update -t src -j4
rosdep install --from-paths src --ignore-src -y

# compile code and refresh workspace
catkin build
source ~/catkin_ws/devel/setup.bash
```

#### references

* [wstool ROS Wiki](http://wiki.ros.org/wstool)
* [rosinstall\_generator ROS Wiki](http://wiki.ros.org/rosinstall_generator)
* [mavros source installation](https://github.com/mavlink/mavros/tree/master/mavros#source-installation)


---

# 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.hanzheteng.com/development/ros/wstool.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.
