Sending a DO_CHANGE_SPEED in guided mode only works for copter?

1,454 views
Skip to first unread message

Thomas Lillis

unread,
Jul 17, 2015, 5:30:12 PM7/17/15
to mav...@googlegroups.com
Hi all! I am flying a fixed wing aircraft and I trying to change the speed of the aircraft while in guided mode. I am using pymavlink and I send this:

msg = mavutil.mavlink.MAVLink_command_long_message(self.mav.target_system,
            self.mav.target_component,
            mavutil.mavlink.MAV_CMD_DO_CHANGE_SPEED,
            0, 1, speed, 0, 0, 0, 0, 0)

Doing some testing in SITL I found that I get a response from the autopilot that the command is not supported for ArduPlane but works fine for ArduCopter. As seen here it looks to me that it is supported by the plane:


Not sure what I am doing wrong. Any tips?

Thanks!

Hamish Willee

unread,
Jul 20, 2015, 7:35:46 AM7/20/15
to mav...@googlegroups.com
Hi Thomas

That is the list of commands that are supported in missions. The list in guided mode on plane is much smaller - see http://dev.ardupilot.com/wiki/plane-commands-in-guided-mode/

I had a chat to Tridge about the limitations of guided mode plane some months ago and he suggested that when he writes scripts they tend to not be in guided mode, but instead be in auto mode, with a "dynamically updated mission". That will certainly work. If you really must use guided mode then I'd suggest a) raising a defect/request against this behaviour in ardupilot rep on github b) use rcchannels (highly not recommended, but I don't see other choices).

Regards
Hamish

Thomas Lillis

unread,
Jul 20, 2015, 1:09:42 PM7/20/15
to mav...@googlegroups.com
Thanks Hamish,

That's unfortunate to hear. It seems a little odd to me that the plane options would be so limited. I think I'll probably have to go with the auto mode option. 

Thanks!

Thomas Lillis

unread,
Jul 20, 2015, 2:53:32 PM7/20/15
to mav...@googlegroups.com
So I am trying things out in auto mode and I am still getting command not supported.

The message I am sending looks like this:
msg = mavutil.mavlink.MAVLink_command_long_message(self.mav.target_system,
            self.mav.target_component,
            mavutil.mavlink.MAV_CMD_DO_CHANGE_SPEED,
            0, 1, speed, 0, 0, 0, 0, 0)

Any ideas?

Thanks!


On Monday, July 20, 2015 at 5:35:46 AM UTC-6, Hamish Willee wrote:

Hamish Willee

unread,
Jul 20, 2015, 7:26:57 PM7/20/15
to mav...@googlegroups.com
Hi Thomas

Yes, you're sending this as a command_long and the handler for these messages doesn't really care what mode you're in. We recommend guided mode because this turns off the user rc input, but in fact the messages are processed in any mode.

What I was suggesting is creating a mission. When you want to go somewhere else or do something else you dynamically change the definition of that mission. In dronekit this is done using the Vehicle.commands - closest thing we have to an example is http://python.dronekit.io/examples/flight_replay.html#setting-the-new-waypoints. I do hope to work on a proper example at some point soon.

Cheers
H



--
Sie erhalten diese Nachricht, weil Sie in Google Groups ein Thema der Gruppe "MAVLink" abonniert haben.
Wenn Sie sich von diesem Thema abmelden möchten, rufen Sie https://groups.google.com/d/topic/mavlink/uemAk1VY4kE/unsubscribe auf.
Wenn Sie sich von dieser Gruppe und allen Themen dieser Gruppe abmelden möchten, senden Sie eine E-Mail an mavlink+u...@googlegroups.com.
Weitere Optionen finden Sie unter https://groups.google.com/d/optout.

Thomas Lillis

unread,
Jul 21, 2015, 4:50:04 PM7/21/15
to MAVLink
So you are saying that the command_long should be working? I still get a COMMAND_ACK with the result of 3 every time I send the above command. It would be beneficial to my system if I did't have to make it a dynamic auto plan. I have one waypoint that I am setting far away and I want to dynamically change the ground speed of the aircraft as it is on the way to that point. I guess it is feasible to make a dynamic plan but it is unnecessary overhead for such a simple thing.

I guess I don't really understand because it looks to me that MAV_CMDs can be executed at any time and the DO_CHANGE_SPEED looks supported by ArduPlane. I have tried with SITL and physical hardware so I figured I must just be sending the message wrong. Dronekit looks helpful but my system needs to run independent of MavProxy.

Thanks!

Hamish Willee

unread,
Jul 21, 2015, 7:52:31 PM7/21/15
to MAVLink
Hi Thomas

No, I am saying that this command won't work in guided mode on plane because it is not handled (ie if Plane receives this message packaged in a command_long it won't know what to do with it). It will be handled in AUTO mode where is is part of a mission). I think it should be handled - I have created this issue as a request https://github.com/diydrones/ardupilot/issues/2583 (feel free to add your support). I have also raised this request to ask that dronekit add an API method to set speed.

>I guess I don't really understand because it looks to me that MAV_CMDs can be executed at any time and the DO_CHANGE_SPEED looks supported by ArduPlane. I have tried with SITL and physical hardware so I figured I must just be sending the message wrong. 

You're not sending the messages wrong. There are separate handlers for AUTO mode and for "every other mode" (nominally "Guided"). The different lists are linked below. These explain how I determined what was supported and what was not (ie link to the handler files). 


> Dronekit looks helpful but my system needs to run independent of MavProxy.

Independent of, or just "not within"? In the near future we hope to allow DK to be run as a standalone module -https://github.com/diydrones/dronekit-python/issues/188

Your best option for now is to look at channel overrides/rc overrides. They are not recommended but this is probably the "exception that proves the rule".

Cheers
H

Thomas Lillis

unread,
Jul 22, 2015, 4:11:46 PM7/22/15
to MAVLink, hamish...@gmail.com
Ohh, ok sorry for the misunderstanding! Thanks for the information. I was confused because in mission planner in guided and auto mode under the actions tab it is possible to change the speed. I intercepted the mavlink and it turns out that when you change the speed in mission planner it is changing the parameter TRIM_ARSPD_CM. This is exactly the type of thing I was looking for except that it sets airspeed instead of ground speed. I think it will work for now but down the road I might see if I can be clever and make a dynamic wp plan. I'm not sure if it is bad practice to be setting a parameter instead of sending a command but since it is what mission planner does I thought I would try it. 

Thanks for making the feature requests. Setting the speed in guided mode for the plane would make my life super easy.

It was a while ago but we tried using DroneAPI to do a few things and it didn't have the features that we needed and running mavproxy ate up a lot of CPU on our pi which we needed for running some other things. If it is not within mavproxy we would definitely consider using it down the road especially because all the features that have been added but for now pymavlink works fine. 

Thanks for your help! It is much appreciated.
Reply all
Reply to author
Forward
0 new messages