MAVSDK icon indicating copy to clipboard operation
MAVSDK copied to clipboard

Action->set_maximum_speed doesn't work with ArduPilot?

Open paulholmstedt opened this issue 2 years ago • 3 comments

I can't get MAVSDK Action->set_maximum_speed to work with ArduPilot. Looking at the MAVSDK code, it is using MAX_SPEED_PARAM (which is actually MPC_XY_CRUISE) to control the maximum speed. But for ArduPilot the parameter controlling the maximum speed in at least Auto (waypoint) and Guided (with MAV_CMD_DO_REPOSITION) is WPNAV_SPEED. Also unless you set RTL_SPEED, the WPNAV_SPEED parameter will be used for that as well. Also tried sending the MAV_CMD_DO_CHANGE_SPEED command with passthrough but I couldn't get ArduPilot to react to my commands in Guide mode. So right now I use MAVSDK Param->set_param_float with WPNAV_SPEED as argument every time I want to change the speed in Auto and Guided flight modes (after calling goto_location_async) I'm not an ArduPilot expert so I might not got it 100% correct :-)

paulholmstedt avatar Sep 11 '23 08:09 paulholmstedt

I think we should actually use the command, for both PX4 and ArduPilot:

https://mavlink.io/en/messages/common.html#MAV_CMD_DO_CHANGE_SPEED

Do you think that would work?

julianoes avatar Sep 12 '23 02:09 julianoes

Yes, when I have tested both PX4 and ArduPilot responds to the MAV_CMD_DO_CHANGE_SPEED.

paulholmstedt avatar Sep 12 '23 17:09 paulholmstedt

@paulholmstedt do you want to give it a shot?

It feels like it's just a simple command so you can look at how takeoff and takeoff_async do it and just change set_maximum_speed and set_maximum_speed_async to do something similar.

Let's just drop the param in PX4 and use MAV_CMD_DO_CHANGE_SPEED for both PX4 and Ardupilot (so maybe we don't even need an if (px4) there :crossed_fingers:.

Again, feel free to git format-patch and share the patch here, I can open a PR for you if that's easier :wink:.

JonasVautherin avatar Sep 12 '23 18:09 JonasVautherin