Comments (13)
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 capacity
contains the actually allocated size of data
. Size
contains the number of valid entries in the array.
In the case where all your elements contain valid data both numbers are equal. But in the case of a dynamically filled array capacity
might be bigger then size
.
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
from rcl.
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#.
I got a subscription in a c++ client running that simply prints out all values of the message. All the primitive members and the strings are working fine, but the array is making troubles.
The c++ client dies with the above mentioned exception:
terminate called after throwing an instance of 'eprosima::fastcdr::exception::NotEnoughMemoryException'
what(): Not enough memory in the buffer stream
I ensured that the rosidl_generator_c__int8__Array
is correctly passed into the native code, by adding some debug code to the rcl_publish
function.
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.
For example: I got an int8 array with one element: In this case size and capacity should both be one?
I' sure that I'm passing the correct data to the rcl_publish
function.
from rcl.
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.
from rcl.
Sorry for the late answer. I had some trouble with the email notifications.
I tested my wrapper with an int8_t
array with 1,2 and 3 elements. This should'nt be to large. Publishing the same message from C++ over FastRTPS works.
from rcl.
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.
from rcl.
I think I found the problem. I think it's located in the message deserialisation:
I put a debug output to: https://github.com/eProsima/ROS-RMW-Fast-RTPS-cpp/blob/e336a8b0f93c8179cc2b4a62d02272403ed356bb/rmw_fastrtps_cpp/include/rmw_fastrtps_cpp/TypeSupport_impl.h#L497
which prints out printf("Size: %u \n", member->array_size_);
.In my case this array_size is 0. This shouldn't be a problem because I'm using a dynamic allocated array.
But apparently there's no case which handles arrays with a dynamic size like in deserialization function for c++.
from rcl.
@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.
from rcl.
This should already be addressed in #45
On Aug 31, 2016 18:15, "Dirk Thomas" [email protected] wrote:
@richiprosima https://github.com/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.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#77 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AACDVFKZUu8l6INMoVEnGDwzaWwsuzfdks5qlba8gaJpZM4JtKkN
.
from rcl.
Sorry, I meant ros2/rmw_fastrtps#45
On Aug 31, 2016 18:32, "Esteve Fernandez" [email protected] wrote:
This should already be addressed in #45
On Aug 31, 2016 18:15, "Dirk Thomas" [email protected] wrote:
@richiprosima https://github.com/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.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#77 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AACDVFKZUu8l6INMoVEnGDwzaWwsuzfdks5qlba8gaJpZM4JtKkN
.
from rcl.
@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.
from rcl.
I responded to your comment regarding printf
in
ros2/rmw_fastrtps#45 (comment)
Though I agree with you about removing the printf
calls, I also want to
be consistent with what seems to be eProsima's codestyle guidelines.
@richiprosima, are you ok with removing the printf
calls when catching an
exception? Do you have codestyle guidelines about this or the printf
calls are just a personal preference?
On Aug 31, 2016 18:48, "Dirk Thomas" [email protected] wrote:
@esteve https://github.com/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.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#77 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AACDVHG4GiSEnP9xqonPlyyW0EA-UYN7ks5qlb1MgaJpZM4JtKkN
.
from rcl.
Go on removing printf
. It is not about codestyle. Surely I forgot to remove it.
from rcl.
I think this can be closed because it was addressed in: ros2/rmw_fastrtps#45
from rcl.
Related Issues (20)
- uninformative crash and error message for invalid parameter override HOT 2
- Question about intended behavior of attempts in verifySubsystemCount
- valgrind: Mismatched free / delete and other leaks HOT 7
- :farmer: Flaky test `test_graph__rmw_fastrtps_cpp` on ros2 buildfarm HOT 1
- transition events don't populate transition id, label, or timestamp
- yaml tag full support in rcl_yaml_param_parser HOT 3
- Anonymous Nodes HOT 6
- Custom logging allocator not passed to rcutils_logging_initialize_with_allocator HOT 4
- Log call from rcl_init (i.e. before logging is initialized) HOT 17
- Rosout publisher always gets standard allocator HOT 4
- Contradicting code docs for rcl_publish and rmw_publish HOT 2
- rcl_node_init uses wrong return code HOT 4
- Flaky test on Windows on the buildfarm: test_logging_rosout__rmw_connextdds
- master branch is behind rolling branch HOT 2
- Test `test_graph__rmw_connextdds` failing on nightly_win_rep
- Fix durability of service introspection topics HOT 9
- Remove `localhost_only` option for turtule-J
- Dynamically remap topic names HOT 8
- Feature request: Sending an Action goal can be complexed, require difficult steps HOT 2
- Public API for remap_rule_t / node_option_t::arguments::remap_rules?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rcl.