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

ROS msg format specification

asked 2014-06-05 20:45:13 -0600

bjem85 gravatar image

Hi All,

I have created a custom CAN bus message but I would like to change the way that the information is printed out.

My .msg file is:

# Custom message for sending the IMU data to the hydraulic test system
# BJEM 19th May 2014.

Header header
uint32 time_ms
uint16 time_us
uint32 id         # 11/29 bit code
uint8 msgtype     # bits of MSGTYPE_*
uint8 len         # count of data bytes (0..8)
uint8[] data      # data bytes, up to 8

##### END OF FILE #####

I would like the fields id, and data to be printed out as hexadecimal numbers. There doesn't seem to be an obvious way to do that. Here's an example header sequence obtained using rostopic echo:

header: 
  seq: 48533
  stamp: 
    secs: 1402018614
    nsecs: 775459838
  frame_id: ''
time_ms: 132547
time_us: 476
id: 2565877120
msgtype: 0
len: 7
data: [237, 124, 82, 122, 107, 122, 0]
---

Hexadecimal for the id and data makes it much easier to comprehend.

Thanks in Advance

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
2

answered 2014-06-06 01:53:29 -0600

ahendrix gravatar image

rostopic doesn't support custom message formatting.

If you need to print messages to the console in custom format, you should write a custom node.

edit flag offensive delete link more

Comments

I ended up doing this, as I am already writing a ROS node that uses the data for further calculations.

bjem85 gravatar image bjem85  ( 2014-06-08 21:32:07 -0600 )edit
1

answered 2014-06-06 10:06:12 -0600

Jérôme gravatar image

The easyiest way, I think, is to write a python script with a callback for your particular message and made your transform by yourself !

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-06-05 20:45:13 -0600

Seen: 739 times

Last updated: Jun 06 '14