micro-ros / rosidl_typesupport_microxrcedds Goto Github PK
View Code? Open in Web Editor NEWType support for Micro XRCE-DDS
License: Apache License 2.0
Type support for Micro XRCE-DDS
License: Apache License 2.0
Describe the bug
This is a continuation of the debugging around this: micro-ROS/rmw_microxrcedds#247
We are seeing that FJT messages are not being deserialized correctly. It seems to occur when the message exceeds some size, though I haven't isolated what the exact 'cutoff' size is.
(I'm not sure if this issue belongs here or in MicroCDR. So, my apologies if this is the wrong repo for this.)
To Reproduce
I basically took the test procedure from here and recreated it.
This code serializes the action-goal message, then deserializes it, and then compares to two messages.
export RMW_IMPLEMENTATION=rmw_microxrcedds
source install/local_setup.bash
ros2 run rclc_examples serialization_test
Relevant code for the output:
if (!callbacks->cdr_serialize(&instanceBefore, &mb_writer))
Ros_Debug_BroadcastMsg("FAILED TO SERIALIZE");
else
Ros_Debug_BroadcastMsg("serialization OK");
if ((mb_writer.iterator - mb_writer.init) != topic_size)
Ros_Debug_BroadcastMsg("INVALID SERIALIZED SIZE: topic_size = %d, mb_writer size = %d", topic_size, mb_writer.iterator - mb_writer.init);
if (callbacks->cdr_deserialize(&mb_reader, &instanceAfter))
Ros_Debug_BroadcastMsg("FAILED TO DE-SERIALIZE");
else
Ros_Debug_BroadcastMsg("de-serialization OK");
Output:
ted@ted-Ubuntu:~/jta_size_testing$ ros2 run rclc_examples serialization_test
Testing CDR for FJT
size of instanceBefore = 373560
instanceBefore has been allocated
instanceBefore joint names have been set
instanceBefore point 1 data set
instanceBefore point 2 data set
instanceBefore point 3 data set
instanceBefore point 4 data set
instanceBefore point 5 data set
size of instanceAfter = 373560
instanceAfter has been allocated
function pointers obtained
topic_size = 768
ucdr_init_buffer complete
serialization OK
INVALID SERIALIZED SIZE: topic_size = 768, mb_writer size = 692
FAILED TO DE-SERIALIZE
****** joint name 0 is wrong:
****** joint name 1 is wrong:
****** joint name 2 is wrong:
****** joint name 3 is wrong:
****** joint name 4 is wrong:
****** joint name 5 is wrong:
****** joint name 6 is wrong:
****** joint name 7 is wrong:
****** joint name 8 is wrong:
****** joint name 9 is wrong:
****** joint name 10 is wrong:
****** joint name 11 is wrong:
CDR Testing complete
As you can see, the size of the 'writer' is not correct. Then the call to cdr_deserialize returns false.
Can you guys take a look at the FJT message to see why it won't serialize correctly?
Thank you for your support!
I found the following error after compile micro-ros-build
for host platform into a clean Dashing docker.
$ ros2 run micro_ros_demos_rcl int32_publisher
UDP mode => ip: 127.0.0.1 - port: 8888
Failed to find library 'rcl_interfaces__rosidl_typesupport_microxrcedds_c'
Failed status on line 24: 1. Aborting.
After some research, I realized that the library rcl_interface__rosidl_typesupport_microxrcedds_c
is built as an static library even through I force to rosidl_typesupport_microxrcedds
to build as shared library.
I try subscribe Joy's message or other message which include the sequence element,but all the message fail to subscribe and arise error :
error in rcl_take: Typesupport desserialize error.
I checked the joint_state__type_support_c.c file and found some parts of the file are incomplete,
here is the deserialize function, and the name field is empty:
static bool _JointState__cdr_deserialize(
ucdrBuffer * cdr,
void * untyped_ros_message)
{
(void) cdr;
bool rv = false;
if (!untyped_ros_message) {
fprintf(stderr, "ros message handle is null\n");
return false;
}
_JointState__ros_msg_type * ros_message = (_JointState__ros_msg_type *)(untyped_ros_message);
(void)ros_message;
// Field name: header
rv = ((const message_type_support_callbacks_t *)(
ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_microxrcedds_c, std_msgs, msg, Header
)()->data))->cdr_deserialize(cdr, &ros_message->header);
// Field name: name // Is it necessary?
{
}
// Field name: position
{
uint32_t size;
const size_t capacity = ros_message->position.capacity;
rv = ucdr_deserialize_sequence_double(cdr, ros_message->position.data, capacity, &size);
}
// Field name: velocity
{
uint32_t size;
const size_t capacity = ros_message->velocity.capacity;
rv = ucdr_deserialize_sequence_double(cdr, ros_message->velocity.data, capacity, &size);
}
// Field name: effort
{
uint32_t size;
const size_t capacity = ros_message->effort.capacity;
rv = ucdr_deserialize_sequence_double(cdr, ros_message->effort.data, capacity, &size);
}
return rv;
}
I add the code to “Field name: name” :
const size_t capacity = ros_message->name.capacity;
rv = ucdr_deserialize_string(cdr, ros_message->name.data, capacity);
if (rv) {
ros_message->name.size = strlen(ros_message->name.data);
}
But still not working.
What can I do now?
in rosidl_typesupport_microxrcedds/rosidl_typesupport_microxrcedds_c/resource/rosidl_typesupport_microxrcedds_c__visibility_control.h.in, the statement #if __cplusplus
is used.
This causes errors when not compiling with C++. It should read #ifdef __cplusplus
instead. The dependent statements in the same file need to be adjusted as well.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.