I want to be able to slow down or speed up during flight using PX4. Is there any implementation for that? This gives clue but a python implantation would be helpful.
@bresch Thanks for the comment. Does your comment mean this mavlink command cannot be used in offboard mode?
As you propose, I’m currently using the MAV_CMD_DO_CHANGE_SPEED to control the airspeed of a glider. At the moment, I’m not restricting the frequency of speed change request. I was wondering if the MAV_CMD_DO was compatible with high frequency request?
When using offboard, that command is ignored because you’re in charge or sending the setpoints to the controllers; so just send the desired velocity if you want to use offboard.
To be clear:
- offboard: you design the trajectories and send the setpoints
- not offboard: the autopilot generates the setpoints based on the mission waypoints and follows the desired speed set by MAV_CMD_DO_CHANGE_SPEED or by default the cruise speed parameters
I don’t know, but it’s better not to send it too frequently to avoid overloading the link.
Thank you @bresch this is helpful:
Is there a way to control the drone’s speed when using position setpoints? Sometimes we want to fly to some lat, long, alt at a slow speed like 2 m/s.
And in my use case, we need the ability to quickly interrupt the drone’s motion. It might be flying to a “waypoint,” and some external information might arrive and the drone needs to immediately do something else (maybe it needs to stop or maybe it needs to calculate a brand new waypoint on the fly). We expect the drone to be “interrupted” often. And in case it’s generating its behavior on the fly, it will refine it’s behavior as it flies and gains information (some of this external information comes from another program or system).
Offboard mode seems like the best tool for this. With missions we’d need to build, upload, and start a new mission to invoke the novel behavior. This seems like a lot of overhead, when we’re making minor changes many times per second. With offboard mode, we can just send a new setpoint. And since the program sends setpoints many times per second, we just send our “best guess” for the waypoint. And we update what we consider our “best guess” as we go. Offboard mode seems like a good fit.
But if it’s not possible to set a speed, it seems like we will need to use velocity setpoints when far away and position setpoints when near the waypoint (so as to maximize the value we get from the flight controller). And we could do that. Though I want to make sure I’m not missing something because a parameter to control the speed would be great.
Either way, thank you for your helpful comments.
Is there a way to control the drone’s speed when using position setpoints?
Simply move the position setpoint at the desired speed towards the final goal and the drone will follow at the desired speed. Again, in offbard you have a lot of freedom and it is your task to generate the adequate trajectory; don’t send the final position to the controller (this produces a really jerky behavior), but design your own guidance algorithm to make the drone move the way you want.
That’s a great idea! Thank you. Yes, I suppose we could “animate” the position setpoint in time. That’s a powerful tool and it gives me lots of ideas for how I might draw out an exciting path for the drone to follow. It does feel like a lot of freedom now that you mention it. (Seems like the best mode on the system ).
Later this year, I might also want to do something like that with a fixed wing. Though I expect additional considerations will limit the kinds of paths we can fly. (trying to do this with a fixed wing seems like a big can of worms; but I haven’t tried anything yet).
Thanks again! This info is very valuable to me.