0% found this document useful (0 votes)
126 views1 page

Ros Cheat Sheet: Hydro

Uploaded by

Frank Puk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
126 views1 page

Ros Cheat Sheet: Hydro

Uploaded by

Frank Puk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

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 cant 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 packages 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)
Masters ROS environment:
ROS_IP or ROS_HOSTNAME set to this machines 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 machines 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.

You might also like