eProsima / Micro-XRCE-DDS

An XRCE DDS implementation. Looking for commercial support? Contact info@eprosima.com
Apache License 2.0
158 stars 15 forks source link

64bits(double, int64) data type error #5

Closed OpusK closed 6 years ago

OpusK commented 6 years ago

Hi,

I am doing a topic test with microRTPS and ROS2. Most topics are communicating without problems. (using ros2 topic echo) However, there is a problem with double and int64 types. That is, the problem occurs only in 8 bytes.

For example, if I send a value of 1234567891011121314 as an int64 type, ros2 ehco a value of -5561329117506306048. Even the last 4 digits sometimes change!

Here are some examples using for test.

I am currently using microRTPS in the 32bit ARM core. Do you have any idea about these issues?

lemunozm commented 6 years ago

Hi @OpusK, thank you for your report.

There is a problem with the padding when a type of 8 bytes is serialized. We will fix it in the future release. The problem is because of different serialization alignment between the CDR version used by ROS2 (FastRTPS) and MicroRTPS.

Sorry by the inconvenience. For now, the "solution" may be to serialize the 8-byte type as an array of 8 bytes. If all machines that will use the topic have the same endianness, it works (tipically, little endianness).

OpusK commented 6 years ago

Thanks for your answer and solution.

I look forward to your release. Thank you.

OpusK commented 6 years ago

Can you tell me where to modify CDR from microRTPS, rmw, or agent? While I wait for the release, I want to modify it myself and test it.

lemunozm commented 6 years ago

Hi @OpusK. The change is not trivial. The solution consist in changing several parts of how the topics are serialized and deserialized respect to the rest of the XRCE message.

The new release will be available soon with these changes. We hope to upload it on Github this Friday. I will let you know when it is ready.

lemunozm commented 6 years ago

HI @OpusK. Sorry for the delay.

We have released the new version of the client API fixing this error and adding several new features. You can download it in the repo https://github.com/eProsima/micro-RTPS-client under branch release/1.0.0beta2. This client is only compatible with the agent at the same branch name.

These versions are under testing. When we finish it, we will up to master. This client version has the API that will contain the master branch.

OpusK commented 6 years ago

Oh, finally! Thank you @lemunozm . :) I will try my code with this soon and let you know.

OpusK commented 6 years ago

My answer is late! This is working very well :) Thanks.