Add do_set_parameter to create missions

Hi!

Im trying to add a do-set-parameter (and eventually add to the list of available commands in MP) to change parameters during mission and create missions like:

WAYPOINT 123, 456;
WAYPOINT 123, 789;
JUMP 1, 3;
DO_SET_PARAMETER SAIL_HEEL_MAX, 30;
WAYPOINT 123, 456;
WAYPOINT 123, 789;
and so on…

Any tips on how to do this?

I know that the current mission commands are implemented in AP_Mission library and they get the values for the command using the mavlink_mission_item_int_t message.

To set commands using mavlink SET_PARAMETER (23) i need a message that supports char[16] and the fields of mavlink_mission_item_int_t (first seven) are floats (param1-4, x, y, z), so all other mission commands can work with this message, except the do-set-command, thats probably why it wasnt implemented… This do-set-parameter function is old, it was removed from MP in version 1.2.73 with the comment “has never worked”

I cant use the MAV_CMD_DO_SET_PARAMETER (180) because it uses the parameter numerical id and according to this thats not possible, so im a little confused…

@davihdsantos,

So sadly we don’t allow setting parameters as part of a mission primarily for the technical reason that you’ve found which is that we don’t support mission commands with string fields (all fields must be numeric).

So the only way to potentially do this is with a companion computer or the 4.0.x versions of ardupilot support Lua scripts and we have PRs that allow setting parameters and accessing the mission library.

So I think the nearest term solution is to try and do it via a Lua script and hopefully these enhancements will be included in Rover-4.1.

Thanks @rmackay9 !

I saw this lua script approach but thought it would be more convenient to do it with a do-set-parameter commands… I even thought of sending a number and use enumerate to internally get the command id using some methods in AP_Param but this is not a good solution…

Anyways, I’ll try to solve with lua scripts!

1 Like