1. FileSystem in ROS
# rospack find [package_name] //找到package的路径
# roscd [locationname[/subdir]] //进入到package的目录下
$ echo $ROS_PACKAGE_PATH
# rosls [locationname[/subdir]]
2. Creat and build a package
$ catkin_create_pkg beginner_tutorials std_msgs rospy roscpp
# catkin_create_pkg <package_name> [depend1] [depend2] [depend3]
然后catkin_make即可创建package
查询依赖:
$ rospack depends1 beginner_tutorials
$ rospack depends beginner_tutorials个性化你的package: package.xml
首先是作者信息等,然后是build_depend, run_depend等
3. Understand Nodes
-
Nodes: A node is an executable file within a ROS package that uses ROS to communicate with other nodes. Nodes can publish or subscribe to a Topic. Nodes can also provide or use a Service.
-
Messages: ROS data type used when subscribing or publishing to a topic.
-
Topics: Nodes canpublish messages to a topic as well assubscribe to a topic to receive messages.
-
Master: Name service for ROS (i.e. helps nodes find each other)
-
rosout: ROS equivalent of stdout/stderr
-
roscore: Master + rosout + parameter server (parameter server will be introduced later)
$ rosrun turtlesim turtlesim_node __name:=my_turtle
$ rosnode list
$ rosnode info [topic]
$ rosnode ping turtlesim_node
4. understand Topic
rostopic echo shows the data published on a topic. rostopic echo [topic]
rostopic list returns a list of all topics currently subscribed to and published.
rostopic type returns the message type of any topic being published. rosmsg show [msg_type]
rostopic pub publishes data on to a topic currently advertised.
rostopic pub [topic] [msg_type] [args]$ rostopic pub -1 /turtle1/cmd_vel geometry_msgs/Twist -- '[2.0, 0.0, 0.0]' '[0.0, 0.0, 1.8]'
rosrun rqt_graph rqt_graph
$ rosrun rqt_plot rqt_plot