General tips
- When in shell use the tab-key for command completion
- The ROS shell utilities all will list options, package names, etc with a single or double tab
- The notation below is that a line that starts with a
$
dollar sign is meant to be typed into the shell - without the dollar sign
ROS Shell utilities
roscore
: Start the ROS Core program
rostopic
: Work with topics
rostopic list
: list all ros topics that roscore knows about
rostopic echo
: print out any topics that are published
rostopic info
: ask ros what it knows about a certain topic
rqt_graph
- display topics and subscriptions in a nice graphical format
roslaunch
- tool to launch collections of ROS nodes in one command. Requires a ‘package launch file’
rosversion -d
- what ros version is installed?
Commands
$ roslaunch turtlebot3_gazebo turtlebot3_stage_4.launch
$ roslaunch turtlebot3_navigation turtlebot3_navigation.launch map_file:=stage4
$ roslaunch turtlebot3_gazebo turtlebot3_simulation.launch
$ roslaunch turtlebot3_slam turtlebot3_slam.launch slam_methods:=gmapping
$ rosbag record rosbag record -O stage4.bag /scan /tf /odom
$ rosbag info stage4.bag
$ rosparam set use_sim_time true
$ rosbag play --clock stage4.bag
$ rosrun map_server map_saver -f stage4
$ rosrun map_server map_server stage4.yaml
$ roslaunch turtlebot3_gazebo turtlebot3_simulation.launch
Shell Commands
# run teleop application. Note that there are many of these floating around
$ roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
# Send cmd_vel to robot
$ 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"
Display TF Frame Tree
$ rosrun tf view_frames
$ evince frames.pdf
FAQ
- roscore: You must have
roscore
running before you try to run any ros-related program
- Execution: In order to execute a program/script on Linux, you must
chmod +x filename.py
- shebang: Also include the ‘shebang’: #!/usr/bin/env python
apt
family of commands, see: https://itsfoss.com/apt-command-guide/