Core ROS Tutorials (一)

Learning English well

1. Using “be supposed to” “ought to”  rather than "should".

Example:You should read from the book list.(×)   You are supposed to finish all the books on the list by the end of this semester.(

2. You will have it if it belongs to you, whereas you don't catch for it if it doesn't appear in your life.

3. It's amazing how someone can break your heart, but you still love them with all the little pieces.

4. Green gas emissions (X)      Greenhouse gas emissions ()

5. Before I grow up,  I always can’t speak out my love for somebody,  yet the dislike in my heart is quite unbridled. 

    After I become a grown-up, I become plain-spoken when falling in love with somebody, but all the distaste has been buried in my heart.

6. Many of life’s failures are people who did not realize how close they were to success when they gave up. 

Beginner Level

1. Installing and Configuring Your ROS Environment

http://wiki.ros.org/ROS/Tutorials/InstallingandConfiguringROSEnvironment

2. Navigating the ROS Filesystem

http://wiki.ros.org/ROS/Tutorials/NavigatingTheFilesystem

3. Creating a ROS Package

http://wiki.ros.org/ROS/Tutorials/CreatingPackage

4. Building a ROS Package

http://wiki.ros.org/ROS/Tutorials/BuildingPackages

5. Understanding ROS Nodes

http://wiki.ros.org/ROS/Tutorials/UnderstandingNodes

  • Nodes: A node is an executable that uses ROS to communicate with other nodes.

  • Messages: ROS data type used when subscribing or publishing to a topic.

  • Topics: Nodes can publish messages to a topic as well as subscribe 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 

    • rospy = python client library
    • roscpp = c++ client library
  • roscore = ros+core : master (provides name service for ROS) + rosout (stdout/stderr) + parameter server (parameter server will be introduced later)
  • rosnode = ros+node : ROS tool to get information about a node.
  • rosrun = ros+run : runs a node from a given package.

6. Understanding ROS Topics

http://wiki.ros.org/ROS/Tutorials/UnderstandingTopics

7. Understanding ROS Services and Parameters

http://wiki.ros.org/ROS/Tutorials/UnderstandingServicesParams

Using rosservice

rosservice list         print information about active services
rosservice call         call the service with the provided args
rosservice type         print service type
rosservice find         find services by service type
rosservice uri          print service ROSRPC uri

Using rosparam

rosparam set            set parameter
rosparam get            get parameter
rosparam load           load parameters from file
rosparam dump           dump parameters to file
rosparam delete         delete parameter
rosparam list           list parameter names

8. Using rqt_console and roslaunch

http://wiki.ros.org/ROS/Tutorials/UsingRqtconsoleRoslaunch

very important
$ cd ~/catkin_ws $ source devel/setup.bash $ roscd beginner_tutorials

Touch turtlemimic.launch
<launch>

  <group ns="turtlesim1">
    <node pkg="turtlesim" name="sim" type="turtlesim_node"/>
  </group>

  <group ns="turtlesim2">
    <node pkg="turtlesim" name="sim" type="turtlesim_node"/>
  </group>

  <node pkg="turtlesim" name="mimic" type="mimic">
    <remap from="input" to="turtlesim1/turtle1"/>
    <remap from="output" to="turtlesim2/turtle1"/>
  </node>

</launch>
note:there have no line number

9. Using rosed to edit files in ROS

http://wiki.ros.org/ROS/Tutorials/UsingRosEd

10. Creating a ROS msg and srv

http://wiki.ros.org/ROS/Tutorials/CreatingMsgAndSrv

Introduction to msg and srv

  • msg: msg files are simple text files that describe the fields of a ROS message. They are used to generate source code for messages in different languages.

  • srv: an srv file describes a service. It is composed of two parts: a request and a response.

msg files are stored in the msg directory of a package, and srv files are stored in the srv directory.

msgs are just simple text files with a field type and field name per line. The field types you can use are:

  • int8, int16, int32, int64 (plus uint*)
  • float32, float64
  • string
  • time, duration
  • other msg files
  • variable-length array[] and fixed-length array[C]

There is also a special type in ROS: Header, the header contains a timestamp and coordinate frame information that are commonly used in ROS.

You will frequently see the first line in a msg file have Header header. Here is an example of a msg that uses a Header, a string primitive, and two other msgs :

  Header header
  string child_frame_id
  geometry_msgs/PoseWithCovariance pose
  geometry_msgs/TwistWithCovariance twist

srv files are just like msg files, except they contain two parts: a request and a response. The two parts are separated by a '---' line. Here is an example of a srv file:

int64 A
int64 B
---
int64 Sum

In the above example, A and B are the request, and Sum is the response.

Getting Help

rosmsg -h      rosmsg show -h
Commands:
  rosmsg show     Show message description
  rosmsg list     List all messages
  rosmsg md5      Display message md5sum
  rosmsg package  List messages in a package
  rosmsg packages List packages that contain messages

   Review:

  • rospack = ros+pack(age) : provides information related to ROS packages
  • roscd = ros+cd : changes directory to a ROS package or stack

  • rosls = ros+ls : lists files in a ROS package

  • roscp = ros+cp : copies files from/to a ROS package

  • rosmsg = ros+msg : provides information related to ROS message definitions
  • rossrv = ros+srv : provides information related to ROS service definitions
  • catkin_make : makes (compiles) a ROS package
  • rosmake = ros+make : makes (compiles) a ROS package (if you're not using a catkin workspace)


 

posted @ 2018-09-17 15:54  三才  阅读(421)  评论(0编辑  收藏  举报