67 lines
2.0 KiB
Markdown
67 lines
2.0 KiB
Markdown
|
|
+++
|
|
date="2023-03-14"
|
|
author="spanskiduh"
|
|
title="ROS"
|
|
description="click to read about ROS"
|
|
+++
|
|
# ROS
|
|
|
|
### Run ros on any distro
|
|
[ROS-DOCKER](https://github.com/turlucode/ros-docker-gui)
|
|
|
|
|
|
### Basic commands
|
|
|
|
- `catkin_make` builds the project.
|
|
- `roscore` Start the root node.
|
|
- `rosrun <package> <program>` execute a node.
|
|
- `rospack list` list all installed packages.
|
|
- `rostopic list` list all the current active topics
|
|
- `rostopic info <topic>` print all the information about the topic(publishers / subscribers).
|
|
- `rostopic pub <topic> <mssg-typ> <mssg>` send a message to a topic.
|
|
- `rostopic echo <topic>` subscribe to a topic.
|
|
- `rostopic hz <topic>` get frequency of messages.
|
|
- `rosnode list` list all avaliable nodes.
|
|
- `rosnode info <node>` get detailed information about the node.
|
|
- `rosparam list` list all available parameters
|
|
- `rosmsg info <message> e.g. geometry_msgs/Twist` check the message structure.
|
|
- `rosbag record <topic> --duration=<X in seconds>` record some topic
|
|
- `rosbag play <topic_file>` replay the recorded topics (very usefull for debugging)
|
|
|
|
|
|
## RQT
|
|
It is basically gui for command tools
|
|
-> `topic monitor` gui topics
|
|
|
|
### Compiled packages are not listed?
|
|
Re-source: `. ~/.bash.rc` or in docker container which uses zsh: `. ~/.zshrc`.
|
|
|
|
|
|
|
|
### Launchfile
|
|
|
|
|
|
```xml
|
|
<launch>
|
|
<node pkg="turtlesim" type="turtlesim_node" name="turtlesim_node" output="screen"/> # define node
|
|
<node pkg="exercise2" type="pubvel" name="pubvel" output="screen">
|
|
<param name="scale_linear" value="1" type="double"/> # Parameters for our nodes (basically constants)
|
|
<param name="scale_angular" value="4" type="double"/> # Use rosparam list to list them all
|
|
<remap from="cmd_vel" to="/turtle1/cmd_vel" /> # Remap topic
|
|
</node>
|
|
</launch>
|
|
```
|
|
|
|
|
|
### CmakeLists.txt
|
|
|
|
|
|
```bash
|
|
# Here you add addidional packages:
|
|
- rospy: to compile with python libraries
|
|
- roscpp: ROs c++ compiler
|
|
- geometry_msgs: Useful structs for position estimation
|
|
find_package(catkin REQUIRED COMPONENTS rospy roscpp geometry_msgs)
|
|
```
|