Beruflich Dokumente
Kultur Dokumente
roscore
A collection of nodes and programs that are
pre-requisites of a ROS-based system. You must have a
roslaunch
roscore running in order for ROS nodes to communicate. Starts ROS nodes locally and remotely via SSH, as well as setting
· Usage: parameters on the parameter server.
$ roscore · Examples: - Execute launch file keyboard_teleop.launch from
package turtlebot_teleop:
$ roslaunch turtlebot_teleop keyboard_teleop.launch
rosrun
rosrun allows you to run an executable in an arbitrary package without having to cd (or roscd) there first.
· Usage:
$ rosrun package executable
· Examples: - Run Python file teleop_twist_keyboard.py from package teleop_twist_keyboard:
$ rosrun teleop_twist_keyboard teleop_twist_keyboard.py
rosnode
Display debugging information about ROS nodes, including publications, subscriptions and connections.
· Commands: rosnode list List active nodes.
rosnode info Print information about a node.
rosnode kill Kills a running node.
· Examples: - Get list of running nodes: rosnode list
rostopic
A tool for displaying debug information about ROS topics, including publishers, subscribers, publishing rate, and messages.
· Commands: rostopic echo Print messages to screen.
rostopic info Print information about a topics.
rostopic list Print information about active topics.
rostopic pub Publish data to topic.
· Examples:
- Get list of running topics: rostopic list
- Get info from topic /cmd_vel: rostopic info /cmd_vel
- Listen to topic /cmd_vel: rostopic echo /cmd_vel
- Publish a Twist message into topic /cmd_vel: rostopic pub /cmd_vel geometry_msgs/ Twist "linear:
x: 0.0 y: 0.0 z: 0.0 angular: x: 0.0 y: 0.0 z: 0.0"
rosparam
A tool for getting and setting ROS parameters on the parameter server using YAML-encoded files.
· Commands: rosparam set Set a parameter.
rosparam get Get a parameter.
rosparam delete Delete a parameter.
rosparam list List parameter names.
· Examples: - List parameters loaded on the ROS Param Server: rosparam list
- Get value of parameter /camera/imager_rate: rosparam get /camera/imager_rate
- Set parameter /camera/imager_rate to 3.0: rosparam set /camera/imager_rate 3.0
rosservice
COMMON A tool for listing and querying ROS services.
FILESYSTEM
COMMAND-LINE
TOOLS
3
www.robotigniteacademy.com ©2017 The Construct Sim, Inc. All Rights Reserved
IN 5 PAGES
Logging Command-line Tools
rosbag
This is a set of tools for recording from and playing back to ROS topics. It is intended to be high performance and
avoids deserialization and reserialization of the messages.
rosbag record will generate a ".bag" file (so named for historical reasons) with the contents of all topics that you
pass to it.
· Examples:
- Record all topics: $ rosbag record -a
- Record select topics: $ rosbag record topic1 topic2
rosbag play will take the contents of one or more bag file, and play them back in a time-synchronized fashion.
· Examples:
- Replay test.bag file: $ rosbag play test.bag
- Replay several bag files at once: $ rosbag info test.bag
LOGGING
COMMAND-LINE
TOOLS
4
www.robotigniteacademy.com ©2017 The Construct Sim, Inc. All Rights Reserved
IN 5 PAGES
Graphical Tools
rx_graph
Displays a graph of the ROS nodes that
are currently running, as well as the ROS
topics that connect them.
· Usage:
$ rqt_graph
view_frames
A tool for visualizing the full tree of coordinate transforms.
· Usage:
$ rosrun tf view_frames
$ evince frames.pdf
rx_plot
A tool for plotting data from one
or more ROS topic fields.
· Usage:
GRAPHICAL $ rqt_plot
TOOLS
5
www.robotigniteacademy.com ©2017 The Construct Sim, Inc. All Rights Reserved
ROS CHEAT SHEET INDIGO v2.0
WORKSPACES CMakeLists.txt RUNNING SYSTEM
Create Workspace Skeleton Run ROS using plain:
roscore
mkdir catkin_ws && cd catkin_ws cmake_minimum_required(VERSION 2.8.3)
wstool init src project(package_name)
Alternatively, roslaunch will run its own roscore automatically if it can’t find
catkin_make find_package(catkin REQUIRED)
source devel/setup.bash catkin_package() one:
roslaunch my_package package_launchfile.launch
Add Repo to Workspace Package Dependencies Suppress this behaviour with the --wait flag.
roscd; cd ../src To use headers or libraries in a package, or to use a package’s exported
wstool set repo_name \ CMake macros, express a build-time dependency: Nodes, Topics, Messages
--git http://github.com/org/repo_name.git \
find_package(catkin REQUIRED COMPONENTS roscpp) rosnode list
--version=indigo-devel
rostopic list
wstool up
Tell dependent packages what headers or libraries to pull in when your rostopic echo cmd_vel
package is declared as a catkin component: rostopic hz cmd_vel
Resolve Dependencies in Workspace rostopic info cmd_vel
catkin_package(
sudo rosdep init # only once rosmsg show geometry_msgs/Twist
INCLUDE_DIRS include
rosdep update
rosdep install --from-paths src --ignore-src \ LIBRARIES ${PROJECT_NAME} Remote Connection
--rosdistro=indigo -y CATKIN_DEPENDS roscpp)
Master’s ROS environment:
• ROS_IP or ROS_HOSTNAME set to this machine’s network address.
PACKAGES Note that any packages listed as CATKIN_DEPENDS dependencies must also
be declared as a <run_depend> in package.xml.
• ROS_MASTER_URI set to URI containing that IP or hostname.