Robotics StackExchange | Archived questions

Setting header.secs and header.nsecs in JSON before publishing

I am able to send JSON to rosbridgeserver (tcp) to publish custom messages to ROS and I can see the messages with rostopic echo <custommsg>. The header information is blank except header.seq, which increments correctly.

Is there a way to have header.secs and header.nsecs reflect time rosbridge_server published???

Thanks for any help you can give me.

Asked by salsalam on 2016-04-01 13:36:51 UTC

Comments

Answers

Afaik, not without patching rosbridge.

As the header nees to be set manually depending on your needs, it is probably not correct if rosbridge sets the timestamp once it it publishing the message.

(Why this is the correct way to do it, consider the following two examples.

  1. A sensor takes some measurements and sends them directly. There, the current time might be okay.
  2. You do some more preprocessing on the sensor data which takes, say, 0.5s. If you now send this data out, ideally the timestamp would be the one of the measurement and thus 0.5s in the past.

)

So I guess you need to set the timestamp manually in JSON.

Asked by mgruhler on 2016-04-04 01:09:52 UTC

Comments

Thanks for your response... Yes, I agree we should set our own timestamp, especially for time critical messages like joystick control messages that effect movement.

I tried to set the time, but rosbridge keeps saying i have sent a message with no "op". i will post a new questions with details.

Asked by salsalam on 2016-04-05 11:42:11 UTC