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

Revision history [back]

click to hide/show revision 1
initial version

This could be an xy-problem, but ignoring that for now:

  • len is of type uint32_t
  • buffer is an array of uint8_t

this will most likely lead stream.next(len) to read 4 bytes from buffer and consider them all part of len.

This makes len equal to 0x01010102 (little endian), which is 16843010 decimal.

The correct byte sequence for 2 would be 0x00000002.

Finally: please describe what you are attempting to do, as unless you're implementing your own client library (and implement TCPROS from scratch) it seems unlikely that normal use of ROS would require you to deal with anything of this.

This could be an xy-problem, but ignoring that for now:

  • len is of type uint32_t
  • buffer is an array of uint8_t

this will most likely lead stream.next(len) to read 4 bytes from buffer and consider them all part of len.

This makes len equal to 0x01010102 (little endian), which is 16843010 decimal.

The correct byte sequence for 2 would be 0x00000002.

Finally: please describe what you are attempting to do, as unless you're implementing your own client library (and implement TCPROS from scratch) it seems unlikely that normal use of ROS would require you to deal with anything any of this.

This could be an xy-problem, but ignoring that for now:

It seems the tutorial does not work with variable length array.

the code shown in the tutorial is most likely fine, the problem is likely in the buffer you present to deserialize(..):

  • len is of type uint32_t
  • buffer is an array of uint8_t

this will most likely lead stream.next(len) to read 4 bytes from buffer and consider them all part of len.

This makes len equal to 0x01010102 (little endian), which is 16843010 decimal.

The correct byte sequence for 2 would be 0x00000002.

Finally: please describe what you are attempting to do, as unless you're implementing your own client library (and implement TCPROS from scratch) it seems unlikely that normal use of ROS would require you to deal with any of this.

This could be an xy-problem, but ignoring that for now:

It seems the tutorial does not work with variable length array.

the code shown in the tutorial is most likely fine, the problem is likely in the buffer you present to deserialize(..):

  • len is of type uint32_t
  • buffer is an array of uint8_t

this will most likely lead stream.next(len) to read 4 bytes from buffer and consider them all part of len.

This makes len equal to 0x01010102 (little endian), which is 16843010 decimal.

The correct byte sequence for 2 would be 0x000000020x02 0x00 0x00 0x00.

Finally: please describe what you are attempting to do, as unless you're implementing your own client library (and implement TCPROS from scratch) it seems unlikely that normal use of ROS would require you to deal with any of this.