rosserial overview: NodeHandles and Initialization | Messages | Publishers and Subscribers | Time | Logging | Limitations | Protocol | Parameters


  1. Logging

New in 0.2.0


Like any ROS node, you can log messages at the appropriate verbosity level. ROSserial forwards the string to the standard ROS network and outputs to rosout and to its log file.

If you try to log information before the device has connected to ROS, the logged information will be lost.

Keep in mind that for low memory systems, this kind of logging is very expensive. You need to store the string in memory before you send it. For more memory thrifty logging, try defining a custom message type with exactly the information you need sent over. You can then view your program's status by observing it using rostopic echo.

   1 //create your node
   2 ros::NodeHandle nh;
   4 //wait until you are actually connected
   5 while (!nh.connected() ){
   6     nh.spinOnce();
   7 }
   9 //Now you can send all of the statements you want
  10 //to be logged at the appropriate verbosity level
  11   nh.logdebug("Debug Statement");
  12   nh.loginfo("Program info");
  13   nh.logwarn("Warnings.");
  14   nh.logerror("Errors..");
  15   nh.logfatal("Fatalities!");

Wiki: rosserial/Overview/Logging (last edited 2017-02-17 13:44:31 by Daniel Snider)