Open Vicidel opened 2 years ago
I have the same problem when trying to use service /mavros/param/get_parameters. I'm calling the service with call_async and I'm using mavros2, ros galactic and ardupilot (sitl).
While trying to create some reproducible code, I found out that running MAVROS2 alone with only one other node works fine. So the issue comes only when there are a lot of nodes doing requests to MAVROS2
I found a fix for my setup by doing a central param store on top of MAVROS2 for handling the params, like this it waits for the list from MAVROS2 and the other nodes requests from this store. It's a bit more complicated, but for my setup works fine.
@Vicidel cache likely be better than issuing tons of RPCs. Note that you can subscribe for parameter events and update cache sooner. https://github.com/mavlink/mavros/blob/904530dee98ead0799813ee2578f24bb48dc995f/mavros/src/plugins/param.cpp#L435-L438
Issue details
I have a structure with multiple ROS2 nodes talking to each others. At boot, some of these nodes need to fetch PX4 parameters through MAVROS2. For some reason some params seem to always be fetched correctly, but some (for ex. GF_ACTION) seem to have issues most of the time, but it could well be complete coincidence...
Before migrating to MAVROS2 from MAVROS1 I never had the issue, so it might be something to do with this.
Mainly I have three nodes:
/mavros/param/get_parameters
mavros_msgs::srv::ParamPull
withforce_pull = true
to MAVROS nodeThank you for any help of pointers to solve the issue.
MAVROS version and platform
Mavros: 2.1.1 ROS: Galactic (in Docker
ros:galactic-ros-base-focal
) Ubuntu: 20.04 (in Dockerros:galactic-ros-base-focal
)Autopilot type and version
[ ] ArduPilot [x] PX4
Version: v1.12.1
Node logs
I enabled debug logging for the MAVROS2 param node in order to get more information on what is going on behind the scenes. I'm attaching a small extract of my logs without the debug messages for clarity, as well as the complete mavros/command/safety nodes logs as files.
20220905_safety_param_pull.log 20220905_command_param_pull.log 20220905_mavros_param_pull.log