ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

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

asked 2016-04-01 13:36:51 -0600

salsalam gravatar image

I am able to send JSON to rosbridge_server (tcp) to publish custom messages to ROS and I can see the messages with rostopic echo <custom_msg>. 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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-04-04 01:09:52 -0600

mgruhler gravatar image

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.

edit flag offensive delete link more

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.

salsalam gravatar image salsalam  ( 2016-04-05 11:42:11 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-04-01 13:36:51 -0600

Seen: 278 times

Last updated: Apr 04 '16