Size and Time of a ROS message

asked 2019-07-09 04:45:14 -0600

Shanika gravatar image

updated 2019-07-09 05:10:56 -0600

Hello,

I would like to verify something. When I use know rostopic bw /topic:

  • The first line gives the average bandwidth in Bytes per second.
  • The second line gives the size of the message

Using these two data, can I determine precisely the time it takes to publish one message over the topic ?

For example, I am publishing a sensor_msgs/BatteryState from my Arduino Board and I read the values rostopic bw on my RPI.

Arduino : Battery State Publisher

void loop()
{ 
 if ( millis() >= battery_time ){
     battery_msg.voltage = get_power();
     battery_msg.header.stamp = nh.now();
     pub_battery.publish(&battery_msg);
     battery_time =  millis() + 50;
   }
 nh.spinOnce();
}

The average value is 1.17 Kb/s and the size = mean =min = max = 0.07 KB. Thus, the time for one message is approximately equal to 60 ms. Is it right ?

However, in my code, I am publishing the message every 50 ms ... I am confused.

Thanks in advance,

Shanika

edit retag flag offensive close merge delete