-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rcl/rosidl arrays - need some help understanding #77
Comments
It looks like the primitive array struct lacks the necessary documentation. Please take a look at the similar struct for strings (https://github.com/ros2/rosidl/blob/8f507b9a656eea1a7ed196b34d7fa5bd1311052e/rosidl_generator_c/include/rosidl_generator_c/string.h#L23-L30). The In the case where all your elements contain valid data both numbers are equal. But in the case of a dynamically filled array I should use the provided functions to initialize / finalize any array: https://github.com/ros2/rosidl/blob/8f507b9a656eea1a7ed196b34d7fa5bd1311052e/rosidl_generator_c/include/rosidl_generator_c/primitives_array_functions.h#L30-L36 |
Perhaps I got another bug. Perhaps I'm using the function the wrong way. I got the following struct: typedef struct test_msgs__msg__Dummy
{
bool thisisabool;
int8_t thisisaint8;
uint8_t thisiauint8;
int16_t thisisaint16;
uint16_t thisisauint16;
int32_t thisisaint32;
uint32_t thisisauint32;
int64_t thisisaint64;
uint64_t thisisauint64;
float thisafloat32;
double thisisfloat64;
rosidl_generator_c__String thisisastring;
rosidl_generator_c__String thisisanotherstring;
rosidl_generator_c__int8__Array thisisaint8array;
} test_msgs__msg__Dummy; As described above I'm using .net P/Invoke on the rcl_publish function to publish this struct from C#. The c++ client dies with the above mentioned exception:
I ensured that the rcl_publish(const rcl_publisher_t * publisher, const void * ros_message)
{
test_msgs__msg__Dummy * dummyStruct = (test_msgs__msg__Dummy*)ros_message;
puts("Some native debug output:");
printf("Pointer: %u \n",dummyStruct->thisisaint8array.data);
printf("Array size: %u \n", dummyStruct->thisisaint8array.size);
printf("Array capacity: %u \n", dummyStruct->thisisaint8array.capacity); The memory address and the size/capacity values are the same as on the C# side. |
How big are you making the array? It may be that the current rmw implementation for FastRTPS doesn't support messages that are that large. We're actively working on that here: You can try to see if that is the issue by making the arrays smaller or by trying Connext or OpenSplice with your example. |
Sorry for the late answer. I had some trouble with the email notifications. I tested my wrapper with an |
Without more information it is hard to suggest anything specific. Maybe try to break in the beginning of the serialization code to check what exact data it is trying to serialize (https://github.com/eProsima/ROS-RMW-Fast-RTPS-cpp/blob/e336a8b0f93c8179cc2b4a62d02272403ed356bb/rmw_fastrtps_cpp/include/rmw_fastrtps_cpp/TypeSupport_impl.h#L309-L472). That might help in narrowing down where the problem is. |
I think I found the problem. I think it's located in the message deserialisation: |
@richiprosima It looks like the mentioned case is missing for the C type support. Can you please suggest a fix for this or create a PR. |
This should already be addressed in #45 On Aug 31, 2016 18:15, "Dirk Thomas" notifications@github.com wrote:
|
Sorry, I meant ros2/rmw_fastrtps#45 On Aug 31, 2016 18:32, "Esteve Fernandez" esteve@apache.org wrote:
|
@esteve It looks like the referenced PR needs to be rebased and has one pending comment. Once it is mergable again I can trigger new CI builds for it. |
I responded to your comment regarding Though I agree with you about removing the On Aug 31, 2016 18:48, "Dirk Thomas" notifications@github.com wrote:
|
Go on removing |
I think this can be closed because it was addressed in: ros2/rmw_fastrtps#45 |
I'm currently trying to implement arrays in my .net wrapper. At the moment I'm running into some problems. Let's take an int8 array for example:
On C side the struct for the array contains three entries:
As far as I understand the initialization code for the arrays I have to insert a pointer into the data field, and insert the amount of array elements into the size field. The capacity field is the same value as the size field. Is this correct?
@esteve Are there any other traps you could imagine when passing arrays from .net to native code that invoke this error?
At the moment I',m doing the marshalling by hand: For example for the int8 array:
The text was updated successfully, but these errors were encountered: