Closed hr-ti closed 2 weeks ago
Are you initializing your micro-ROS type's memory as explained here: https://docs.vulcanexus.org/en/latest/rst/tutorials/micro/memory_management/memory_management.html#message-memory ?
That did the trick! I'm surprised I didn't find this documentation until now, thanks anyways
I'm using microROS for my STM32 board and attempting to use services. The issue I'm getting on the MCU side is that deserializing any array/sequence type in a service request results in an error where the data length exceeds the capacity of the buffer, which is defaulting to 0 (erroring here).
I've verified that UDP traffic is working correctly. So I can only suspect that the host side is incorrectly converting service requests either in the RMW or the agent, not too sure how to confirm so input here would be great.
Running my firmware through a debugger shows that it casts the appropriate service request typesupport onto the incoming ros_message once a service request is found, but capacity is always 0. Here's the generated typesupport code:
My understanding could be wrong, but
udr_deserialize_sequence_char
usesros_message->data.capacity
to copy the appropriate amount of the input buffercdr
toros_message
. Here,ros_message->data.capacity
is 0,udr_deserialize_sequence_char
fails,rv
is false and therefore causes an executor error.Viewing the
cdr
buffer, I can see that the string I pass through is correct, including its length (+ null terminator), butros_message
attributes are set to 0.I get similar results when using a bytearray, but passing an empty bytearray works since capacity == length = 0.
I'm lost on where the buffer capacity property is set, but I'm hoping this is a user error and not an error from RMW.