ROS cheat sheet

Posted 2018.08.08 09:01

Basic codes


source ~/catkin_ws/devel/setup.bash

- This will call setup.sh and enables referring existing packages for ROS commands such as roscd



Create ROS package


catkin_create_pkg beginner_tutorials std_msgs rospy roscpp

catkin_create_pkg beginner_tutorials std_msgs rospy roscpp

beginner_tutorials: package name / std_msgsrospy,roscpp: package dependencies 



Move to ROS folder & check dependencies


roscd beginner_tutorials

rospack depends1 beginner_tutorials



Check ROS nodes


rosnode list

rosnode info /rosout



Run ROS package


rosrun turtlesim turtlesim_node

rosrun turtlesim turtlesim_node

turtlesim: package name / turtlesim_node: node name

rosrun rqt_graph rqt_graph



Check ROS topics


rostopic list -v

Published topics:

 * /turtle1/color_sensor [turtlesim/Color] 1 publisher

 * /turtle1/cmd_vel [geometry_msgs/Twist] 1 publisher

 * /rosout [rosgraph_msgs/Log] 3 publishers

 * /rosout_agg [rosgraph_msgs/Log] 1 publisher

 * /turtle1/pose [turtlesim/Pose] 1 publisher


Subscribed topics:

 * /turtle1/cmd_vel [geometry_msgs/Twist] 1 subscriber

 * /rosout [rosgraph_msgs/Log] 1 subscriber

 * /statistics [rosgraph_msgs/TopicStatistics] 1 subscriber


rostopic echo /turtle1/cmd_vel

rostopic echo /turtle1/cmd_vel

linear: 

  x: 2.0

  y: 0.0

  z: 0.0

angular: 

  x: 0.0

  y: 0.0

  z: 0.0

 

rostopic type /turtle1/cmd_vel | rosmsg show

rostopic type /turtle1/cmd_vel | rosmsg show

geometry_msgs/Vector3 linear

  float64 x

  float64 y

  float64 z

geometry_msgs/Vector3 angular

  float64 x

  float64 y

  float64 z


rostopic pub /turtle1/cmd_vel geometry_msgs/Twist -r 1 -- '[2.0, 0.0, 0.0]' '[0.0, 0.0, -1.8]'

rostopic pub /turtle1/cmd_vel geometry_msgs/Twist -r 1 -- '[2.0, 0.0, 0.0]' '[0.0, 0.0, -1.8]'



RQT Topic Monitor


rosrun rqt_gui rqt_gui

: Run blank rqt qui


plugin->Topics->Topic Monitor

plugin->Topics->Message Publisher


This enables a nice interface for identifying existing ROS topics and publishing messages to subscribers. 


'Enginius > Robotics' 카테고리의 다른 글

ROS cheat sheet  (0) 2018.08.08
ROS tutorial (publisher / subscriber)  (0) 2018.08.08
ROS tutorial (ROS package / node / topic / message / service / parameter/ launch)  (0) 2018.08.08
MuJoCo Walker2d  (0) 2018.07.27
Baxter in Gazebo  (0) 2018.07.27
OpenManipulator  (0) 2018.07.27
« PREV : 1 : 2 : 3 : 4 : 5 : 6 : 7 : 8 : 9 : 10 : ··· : 635 : NEXT »