-
Notifications
You must be signed in to change notification settings - Fork 50
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
Example app add_two_ints_service does not work on STM32: 1) Incorrect data received and 2) No server response #93
Comments
Service RequestLooks like there is some incorrect behavior either
Running the agent in debug mode shows that the request of the The MCU receives the UDP packet when the service is called and writes the last 32 bytes in a buffer. This can be validated by adding a breakpoint at rmw_microxrcedds/rmw_microxrcedds_c/src/rmw_request.c#L124 and validating the contents of The buffer is then sent for deserialization, but it deserialized incorrectly since it expects the data to be at the beginning of the buffer and, in this case, the data is present after a 16 bytes offset. Service ResponseI still need to dig a little deeper, but there might be a similar issue (namely inconsistent serialization/deserialization) happening on the response. I say this because running the agent in debug mode clearly shows that the agent receives a UDP packet containing |
I am pasting below a sample of the exchange reported by the agent when a service is called. Note that I have manually shifted the buffer in rmw_microxrcedds/rmw_microxrcedds_c/src/rmw_request.c#L122, i.e. changed the line to
|
I just noticed that the IP header is also included (minimum 20 bytes and maximum 60 bytes depending on the options). So, could it be that those "extra" bytes are part of the header being misinterpreted as data? |
Following up on this, the latest news is that the services work as expected if we change the middleware implementation by prefixing the commands with If we do not change to FastRTPS, then the default one in Galactic is used, namely Cyclone DDS. I am showing below the difference in the exchange, as reported by the agent. As it turns out, it looks like the actual issue here is that the DDS message is formatted differently when using Cyclone DDS and this is not accounted for / understood by the agent. My knowledge of DDS is limited, so I do not really know what the additional 16 bytes present in the DDS message from Cyclone DDS stand for. But it really looks like this is the root cause of both issues.
|
Issue template
Steps to reproduce the issue
ros2 run micro_ros_setup configure_firmware.sh add_two_ints_service --transport udp --ip <our agent ip> --port 8888
ros2 service call /addtwoints example_interfaces/srv/AddTwoInts "{a: 5, b: 10}"
Expected behavior
Should get a response (sum=15)
Actual behavior
waiting for service to become available... requester: making request: example_interfaces.srv.AddTwoInts_Request(a=5, b=10)
Additional information
We basically have the same issue as this but with FreeRTOS on our STM32 board.
We using a router from Teltonika- RUT240 (which a decent router), and the computer running the agent and making service calls is connected though Ethernet.
Quick note: I had to include
#include <rclc/executor.h>
in the example code, and change "printk"s to printf to get it to compile.Not very well-versed with uROS or DDS stuff, but we tried the following:
export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
before starting the agent, as suggested in this thread.Logs from the agent:
The text was updated successfully, but these errors were encountered: