天天看点

learning note2

learning note2

1.it's a class which allow you to create an instance in charge of managing your node.

We surely can have more than one NodeHandle, and there are two  reasons for having multiple NodeHandle in a single node.

1. namespace scope: This is the most common usecase, and specifies the namespace prefix that applies to all graph resource names that hang from it. This is what @Boris refers to in his answer. For instance, the following two constructs are equivalent:

ros::NodeHandle("/foo").hasParam("bar");
ros::NodeHandle().hasParam("/foo/bar");
           

2. control callback spinning: This usecase is more advanced, or at least less common. It is possible to assign different callback queues to different 

NodeHandle

 instances, so you can for instance have a node in which some callbacks are processed at high-frequency (e.g. control commands), while others are processed at a slower rate.

3.ros::spinOnce() is a callback handler.

The difference between them is that the former will not return after calling, that is, your main program will not execute down here, and the latter can continue to execute after calling.

4. It's an object allows you to specify a frequency that you would like to loop at. It will keep track of how long it has been since the last call to Rate::sleep(), and sleep for the correct amount of time.

learning note2

1.for convenient managing and  expandability

2. Header is a class, while header is an instance. It's a special field type in ROS.

Surely I can include it in my message file. The header contains a timestamp and coordinate frame information that are commonly used in ROS.

learning note2

1. Where does the bag file get saved is according to our working directory.  We can type in arguments to choose our saved path.

2. It depends on your working directory. We can change it through adding

args="-a -O your/path/to/BagRepository"