Sie sind auf Seite 1von 8

IN 5 PAGES

www.robotigniteacademy.com ©2017 The Construct Sim, Inc. All Rights Reserved


IN 5 PAGES
Common Command-line Tools

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

COMMON - Kill node /cmd_el_mux:


- Get info from node /gazebo:
rosnode kill /cmd_vel_mux
rosnode info /gazebo
COMMAND-LINE
TOOLS rosmsg/rossrv
rosmsg/rossrv displays Message/Service (msg/srv) data structure definitions.
· Commands: rosmsg show Display the fields in the msg.
rossrv show Display the fields in a service msg
· Examples: - Show structure of message Twist: $ rosmsg show geometry_msgs/Twist
1 - Show structure of service message Trigger: $ rossrv show std_srvs/Trigger
www.robotigniteacademy.com ©2017 The Construct Sim, Inc. All Rights Reserved
IN 5 PAGES
Common Command-line Tools

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.

COMMAND-LINE · Commands: rosservice


rosservice
list
type
Print information about active services.
Print the service type.
TOOLS rosservice info Get information from a service
rosservice call Call the service with the given args.
· Examples:
- Get list of running services: rosservice list
- Get service message used by the service /gazebo/delete_model: rosservice type /gazebo/delete_model
- Get information from the service /gazebo/delete_model: rosservice info /gazebo/delete_model
2 - Call service /gazebo/delete_model and provide argument model_name:
rosservice call /gazebo/delete_model "model_name:'bowl'"
www.robotigniteacademy.com ©2017 The Construct Sim, Inc. All Rights Reserved
IN 5 PAGES
Filesystem Command-line Tools

Filesystem Command-line Tools


· Commands: rospack A tool inspecting packages.
roscd Changes directories to a package or stack.
rosswtf Displays a errors and warnings about a running ROS system or launch file.
catkin_create_pkg A tool for creating a new packages.
· Usage:
$ rospack find [package]
$ roscd [package [/subdir]]
$ roswtf or roswtf [file]
$ catkin_create_pkg [name_of_pkg][dependencies]
· Examples:
- Find pack of package turtlebot_gazebo: $ rospack find turtlebot_gazebo
- Go to package turtlebot_gazebo: $ roscd turtlebot_gazebo
- Check for errors in keyboard_teleop.launch file: $ roswtf keyboard_teleop.launch

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.

Create a Package Your environment:


Messages, Services
catkin_create_pkg package_name [dependencies ...] • ROS_IP or ROS_HOSTNAME set to your machine’s network address.
These go after find_package(), but before catkin_package(). • ROS_MASTER_URI set to the URI from the master.
Package Folders Example:
find_package(catkin REQUIRED COMPONENTS message_generation To debug, check ping from each side to the other, run roswtf on each side.
include/package_name C++ header files
std_msgs)

src Source files.


add_message_files(FILES MyMessage.msg) ROS Console
add_service_files(FILES MyService.msg)
Python libraries in generate_messages(DEPENDENCIES std_msgs) Adjust using rqt_logger_level and monitor via rqt_console. To enable debug
subdirectories catkin_package(CATKIN_DEPENDS message_runtime std_msgs)ww output across sessions, edit the $HOME/.ros/config/rosconsole.config
and add a line for your package:
scripts Python nodes and scripts
log4j.logger.ros.package_name=DEBUG
Build Libraries, Executables
msg, srv, action Message, Service, and And then add the following to your session:
Action definitions Goes after the catkin_package() call.
add_library(${PROJECT_NAME} src/main) export ROSCONSOLE_CONFIG_FILE=$HOME/.ros/config/rosconsole.config
add_executable(${PROJECT_NAME}_node src/main)
Release Repo Packages Use the roslaunch --screen flag to force all node output to the screen, as if
target_link_libraries(
catkin_generate_changelog ${PROJECT_NAME}_node ${catkin_LIBRARIES}) each declared <node> had the output="screen" attribute.
# review & commit changelogs
catkin_prepare_release Installation
bloom-release --track indigo --ros-distro indigo repo_name
install(TARGETS ${PROJECT_NAME}
Reminders DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})
install(TARGETS ${PROJECT_NAME}_node
• Testable logic
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
• Publish diagnostics install(PROGRAMS scripts/myscript
• Desktop dependencies in a separate package DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
install(DIRECTORY launch www.clearpathrobotics.com/ros-cheat-sheet
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}) © 2015 Clearpath Robotics, Inc. All Rights Reserved.
ROS CHEAT SHEET HYDRO v1.01
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=hydro-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=hydro -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.

Create a Package Your environment:


Messages, Services
catkin_create_pkg package_name [dependencies ...] • ROS_IP or ROS_HOSTNAME set to your machine’s network address.
These go after find_package(), but before catkin_package(). • ROS_MASTER_URI set to the URI from the master.
Package Folders
include/package_name C++ header files
Example: To debug, check ping from each side to the other, run roswtf on each side.
find_package(catkin REQUIRED COMPONENTS message_generation

src Source files.


std_msgs) ROS Console
add_message_files(FILES MyMessage.msg)
Python libraries in Adjust using rqt_logger_level and monitor via rqt_console. To enable debug
add_service_files(FILES MyService.msg)
subdirectories output across sessions, edit the $HOME/.ros/config/rosconsole.config
generate_messages(DEPENDENCIES std_msgs)
catkin_package(CATKIN_DEPENDS message_runtime std_msgs)ww and add a line for your package:
scripts Python nodes and scripts
log4j.logger.ros.package_name=DEBUG
Build Libraries, Executables
msg, srv, action Message, Service, and And then add the following to your session:
Action definitions Goes after the catkin_package() call.
add_library(${PROJECT_NAME} src/main) export ROSCONSOLE_CONFIG_FILE=$HOME/.ros/config/rosconsole.config
add_executable(${PROJECT_NAME}_node src/main)
Release Repo Packages Use the roslaunch --screen flag to force all node output to the screen, as if
target_link_libraries(
catkin_generate_changelog ${PROJECT_NAME}_node ${catkin_LIBRARIES}) each declared <node> had the output="screen" attribute.
# review & commit changelogs
catkin_prepare_release Installation
bloom-release --track hydro --ros-distro hydro repo_name
install(TARGETS ${PROJECT_NAME}
Reminders DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})
install(TARGETS ${PROJECT_NAME}_node
• Testable logic
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
• Publish diagnostics install(PROGRAMS scripts/myscript
• Desktop dependencies in a separate package DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
install(DIRECTORY launch www.clearpathrobotics.com/ros-cheat-sheet
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}) © 2014 Clearpath Robotics, Inc. All Rights Reserved.

Das könnte Ihnen auch gefallen