micro-ROS / micro_ros_arduino

micro-ROS library for Arduino
Apache License 2.0
435 stars 113 forks source link

No service response #956

Closed scch1092 closed 2 years ago

scch1092 commented 2 years ago

Hi, it's me again.

I tried to create a service on my teensy. I used the sample program to create my service. Unfortunately I do not get any response to my request. In the terminal the service is displayed (ros2 service list -t).

Steps to reproduce the issue

  1. Load the example for microROS server (micro-ros_addtwoints_service.ino)
  2. Flash on device (in my case teensy 4.1)
  3. Start miroROS agent
  4. send request via terminal ( ros2 service call /addtwoints example_interfaces/srv/AddTwoInts '{a: 2, b: 3}' )

Expected behavior

Get response

Actual behavior

terminal output:

waiting for service to become available... requester: making request: example_interfaces.srv.AddTwoInts_Request(a=2, b=3)

nothing happens on terminal...

pablogs9 commented 2 years ago

Are you using ROS 2 galactic? If so, have you changed the default middleware to Fast DDS? micro-ROS won't work with Cyclone DDS (the default implementation in ROS 2 Galactic).

https://docs.ros.org/en/galactic/Installation/DDS-Implementations/Working-with-eProsima-Fast-DDS.html

Also, please share the micro-ROS agent output using -v6 flag.

scch1092 commented 2 years ago

I use ROS2 galactic. I followed the instructions to install and use fastDDS, thanks for the tip! But apparently I had already installed fastDDS. Nothing changed even after switching to rmw_fastrtps.

output-v6

pablogs9 commented 2 years ago

Make sure that you use Fast DDS in the console where you are calling ros2 service call....

As you can see the micro-ROS Agent on the micro-ROS side is working properly because the service request is being received in the agent side (see ====> DDS <====) and after a while, the service response is being sent to the ROS 2 dataspace (see <<< DDS >>>)

scch1092 commented 2 years ago

oh wow, such a simple solution :smile: Thanks!

k7g03z commented 2 years ago

Hi @pablogs9 In your post on April 21, you wrote:

micro-ROS won't work with Cyclone DDS

Can you elaborate on why this is the case?

k7g03z commented 2 years ago

Hi @pablogs9 In your post on April 21, you wrote:

micro-ROS won't work with Cyclone DDS

Can you elaborate on why this is the case?

Hi @pablogs9, we have dug deep into this issue and believe this issue describes the root cause.

A fix for FastDDS is also proposed here.

cc @sumanth-nirmal @miguelcompany