guided mode velocity control

1,064 views
Skip to first unread message

Vásárhelyi Gábor

unread,
Jun 29, 2015, 2:55:51 AM6/29/15
to drones-...@googlegroups.com
Dear All!

We are working on a project where we need to control our copters with an onboard external computer through mavlink using some kind of guided mode and velocity control (see more atwww.hal.elte.hu/flocking on what we are doing in general). Can anyone give me a hint on what is the recommended workflow for this on PixHawk/ArduCopter and where is development at? 

In mavlink I see the message MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT (87) that seems to be designed fur such operations, then in arducopter I see MAV_CMD_NAV_VELOCITY (91?) that is also related but is not currently part of official mavlink, etc.

So what is the deal? Is there a version we can use for such thing? Is this implemented already somewhere as a stable solution? There are of course all kinds of failsafe issues involved with velocity control and I wonder what effort has been done to treat this. We are also willing to contribute to this in arducopter if there is intention to have such a solution but it is not ready yet.

Thanks in advance,
Gabor Vasarhelyi

Basly Hedi

unread,
Jul 2, 2015, 1:31:54 PM7/2/15
to drones-...@googlegroups.com
Hi,
I'am currently working on that idea, i think we have the same goal, i want to send some way points to my quadcopter to fly it with no radio controller, my idea is to build a custom ground station equiped with Mavlink protocol... i'am now doing some research on the internet on that topic, did you make some progress.
Basly Hedi

Randy Mackay

unread,
Jul 2, 2015, 10:32:16 PM7/2/15
to drones-...@googlegroups.com

 

     Hamish has recently built out the dronekit documentation to include some examples on how to control the copter.  It’s python but it shows a fair bit of detail on the messages and individual fields that need to be set.

        http://python.dronekit.io/guide/copter/guided_mode.html

 

     We also have a dronekit gitter channel:   https://gitter.im/diydrones/dronekit-python

 

-Randy

--
You received this message because you are subscribed to the Google Groups "drones-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drones-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Basly Hedi

unread,
Jul 4, 2015, 12:46:17 PM7/4/15
to drones-...@googlegroups.com
thank you for your answer, i'll keep you up with the coming results.

--
You received this message because you are subscribed to a topic in the Google Groups "drones-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/drones-discuss/lpGpfX-P_V4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to drones-discus...@googlegroups.com.

Hamish Willee

unread,
Jul 5, 2015, 9:43:39 PM7/5/15
to drones-...@googlegroups.com
Hi Basly, Gabor

As Randy points out the DroneKit docs show you what works - including POSITION_TARGET_GLOBAL_INT can be used to control velocity components directly or if you are using this to set the target position you can control speed with MAV_CMD_DO_CHANGE_SPEED. 

In general the commands you can use in missions are in MAVLink Mission Command Messages (MAV_CMD) and the commands you can use in other modes (including missions) are in Copter Commands in Guided Mode. I don't think MAV_CMD_NAV_VELOCITY is supported at all on ArduPilot at the current time - where did you see it in the code?

If you find any errors in the documents, I'd appreciate you letting me know!

Cheers
Hamish

Basly Hedi

unread,
Jul 6, 2015, 11:08:24 AM7/6/15
to drones-...@googlegroups.com
Hi, Hamish, Gabor
thank you for your help, my project is to create a ground station on an Arduino Mega board, to control the copter to fly through waypoints, i found that the Mavlink library supported on the arduino is missing, and i can't find it on the internet...
Basly Hedi.

Vásárhelyi Gábor

unread,
Nov 13, 2015, 10:33:50 AM11/13/15
to drones-discuss
Dear All!

Thanks for the answers, the new description was of great help. Slowly but devotedly we are getting there but I have further problems with AC3.3.1 guided mode velocity control:

1. if the unit is in guided mode velocity control and I am sending the target global pos int messages, the motion of the copter will be very harsh. Simplest case: vx=vy=vz=0, which should keep the copter is a still position, instead, its motor speeds are not smooth but changing constantly in a wide range, the copter seems to be kind of overreacting to this simple, constant command. What is the way of tuning the guided mode velocity control behaviour to e.g. limit acceleration, etc.? What is the preferred update rate of this command?

On the other hand, the system (IRIS+) works great, it is a lot better than previous systems I used, congratulations! Dynamic, accurate. Good job!

2. I would like to have RC failsafe on the copter in guided mode, I do not want RC signal lost to get interfered with my companion computer guided mode commands (I want to be able to handle this on my own) but as soon as I switch the RC off (as test), copter goes into CRITICAL mode and lands/returns to home. There is an option for throttle failsafe in auto mode to keep going on the mission, it would be nice to have the same in guided mode. Since we are doing swarming, individual return to home is not acceptable for us, we need to write our own flocking stuff for these kind of cases to be able to avoid each other if e.g. a common RC signal gets lost.

Thanks for any optinion!
G.

martin...@live.com

unread,
Nov 18, 2015, 2:49:01 PM11/18/15
to drones-discuss


On Friday, November 13, 2015 at 4:33:50 PM UTC+1, Vásárhelyi Gábor wrote:
1. if the unit is in guided mode velocity control and I am sending the target global pos int messages, the motion of the copter will be very harsh. Simplest case: vx=vy=vz=0, which should keep the copter is a still position, instead, its motor speeds are not smooth but changing constantly in a wide range, the copter seems to be kind of overreacting to this simple, constant command. What is the way of tuning the guided mode velocity control behaviour to e.g. limit acceleration, etc.? What is the preferred update rate of this command?


This is exactly what I have noticed as well when using guided velocity commands. In my case I only noticed it on the Z axis (up/down). Sometimes the copter even did start oscillalting. Which parameter would be the right one to dampen the twitchy altitude controller? If I understand the code right it would be PILOT_VELZ_MAX and PILOT_ACCEL_Z_DEFAULT?

Randy Mackay

unread,
Nov 18, 2015, 8:03:29 PM11/18/15
to drones-...@googlegroups.com

Martin, Vasarhelyi,

 

     I noticed this roughness as well recently while working on precision landing and the issue is that the velocity controller’s Z-axis controller is only running at 50hz.  I’ve fixed this in master and the change will also be included in the upcoming Copter-3.3.2-rc2 release candidate.

           https://github.com/diydrones/ardupilot/commit/c9340dbeb6b697851581109302ea286ad2525c83

          https://github.com/diydrones/ardupilot/commit/b2b8dcb8fffa558cf3964304537729ae03ca5584

 

-Randy

 

From: drones-...@googlegroups.com [mailto:drones-...@googlegroups.com] On Behalf Of martin...@live.com
Sent: 19-Nov-15 4:42 AM
To: drones-discuss
Subject: [drones-discuss] Re: guided mode velocity control

 


On Friday, November 13, 2015 at 4:33:50 PM UTC+1, Vásárhelyi Gábor wrote:

1. if the unit is in guided mode velocity control and I am sending the target global pos int messages, the motion of the copter will be very harsh. Simplest case: vx=vy=vz=0, which should keep the copter is a still position, instead, its motor speeds are not smooth but changing constantly in a wide range, the copter seems to be kind of overreacting to this simple, constant command. What is the way of tuning the guided mode velocity control behaviour to e.g. limit acceleration, etc.? What is the preferred update rate of this command?

 

 

This is exactly what I have noticed as well when using guided velocity commands. In my case I only noticed it on the Z axis (up/down). Sometimes the copter even did start oscillalting. Which parameter would be the right one to dampen the twitchy altitude controller? If I understand the code right it would be PILOT_VELZ_MAX and PILOT_ACCEL_Z_DEFAULT?

--

Gábor Vásárhelyi

unread,
Nov 25, 2015, 9:17:55 AM11/25/15
to drones-discuss
Dear Randy!

I tried the 3.3.2.rc2 beta version now, it is definitely smoother (although not as smooth with v=0,0,0 as in e.g. simple alt_hold or loiter) and works kind of great in the xy direction, but it seems to be buggy in the z direction. I am trying to raise the copter with 2 m/s but it hardly goes up, is twitchy and slow. Settings are default, e.g. PILOT_VELZ_MAX,250, PILOT_ACCEL_Z,250, WPNAV_SPEED_UP,250. Same code does what it needs to do with 3.3.1 (but being twitchy).
Thanks,
G.

Gábor Vásárhelyi

unread,
Nov 25, 2015, 10:13:20 AM11/25/15
to drones-discuss
I have also one more related question. I do not see the point why 

set_desired_velocity_z() and set_desired_velocity_xy() does not contain freeze_ff calls in AC_PosControl.h and 
why set_desired_velocity() - which is used in guided mode vel ctrl - contains freeze_ff_xy(), and that only.
I assume either both freeze_ff_xy and freeze_ff_z or none should be used but the best would be to check set_desired_velocity update rate and velocity difference between calls and decide accordingly.

My previous related question was, what is the recommended update rate of the set target global int call, which actually calls set_desired_velocity() and is it possible that some vel ctrl related issues are related also to this "always freeze xy but not z" method?

Thanks,
Gabor


Gábor Vásárhelyi

unread,
Dec 1, 2015, 10:43:26 AM12/1/15
to drones-discuss
Hello,

I do confirm that with exactly the same settings the fw 3.3.1 changes guided mode vz as it should be (although little twitchy), but the 3.3.2.rc2 does not. x-y horizontal guided mode velocity control is very nice but vertical one is buggy right now.

Cheers,
Gabor

Randy Mackay

unread,
Dec 1, 2015, 8:34:40 PM12/1/15
to drones-...@googlegroups.com

Gabor,

 

     Can you be more specific?  A dataflash log would be nice too.

 

-Randy

 

From: drones-...@googlegroups.com [mailto:drones-...@googlegroups.com] On Behalf Of Gábor Vásárhelyi
Sent: 2-Dec-15 12:36 AM
To: drones-discuss
Subject: [drones-discuss] Re: guided mode velocity control

 

Hello,

--

Gábor Vásárhelyi

unread,
Dec 11, 2015, 3:11:28 PM12/11/15
to drones-discuss
OK - some more details.

In the log attached, after the last takeoff (there is two) in guided mode I constantly resend the cmd global target int message with velocity vx=0,vy=0,vz=-1
and the copter is not gaining altitude with 1m/s. It goes up to 12m, but very slowly...

This is version 3.3.2. The same command works with 3.2.1, but it is twitchy. The vx and vy also work in 3.3.2, but the vz do not. At least for me.

Thanks for any help,
Gabor


2015-12-11 16-25-52.bin

Gábor Vásárhelyi

unread,
Jan 11, 2016, 10:54:02 AM1/11/16
to drones-discuss
Hello Randy!

Is there a chance that you will look into the log I uploaded a while ago? I have not have much flights since than but the z-axis guided mode velocity control remained and unsolved issue for me ( I wonder whether it is for me alone or others are trying this feature as well with/without success). Thanks, Gabor

martin...@live.com

unread,
Jan 24, 2016, 12:08:04 PM1/24/16
to drones-discuss


Am Montag, 11. Januar 2016 16:54:02 UTC+1 schrieb Gábor Vásárhelyi:
Hello Randy!

Is there a chance that you will look into the log I uploaded a while ago? I have not have much flights since than but the z-axis guided mode velocity control remained and unsolved issue for me ( I wonder whether it is for me alone or others are trying this feature as well with/without success). Thanks, Gabor

It was the same for me. I switched meanwhile to a solution, in which I translate the target speeds in the three axis into a target position let's say in 10 seconds from now. This is very simple and results in a very smooth movement...

Gábor Vásárhelyi

unread,
Feb 17, 2016, 10:58:41 PM2/17/16
to drones-discuss
Well, it would be nice to have a real solution to the problem and stick to velocity control, once it is implemented. Your solution might only work in simple cases, when the desired velocity does not change much. At least I am glad it is not only my problem, so I can rule out with higher certainty that I messed up something.

I really wonder how many people might use velocity control with pixhawk. Anyone else detecting the same problem, or NOT detecting it?

Randy Mackay

unread,
Feb 18, 2016, 12:16:26 AM2/18/16
to drones-...@googlegroups.com

 

    I’m pretty sure this is all fixed in master and in Copter-3.3.3-rc2 as of end-of-Jan.  Here’s the link the release notes item for this:

          https://github.com/diydrones/ardupilot/blob/master/ArduCopter/ReleaseNotes.txt#L5

 

-Randy

 

From: drones-...@googlegroups.com [mailto:drones-...@googlegroups.com] On Behalf Of Gábor Vásárhelyi
Sent: 18-Feb-16 6:19 AM
To: drones-discuss
Subject: [drones-discuss] Re: guided mode velocity control

 

--

Gábor Vásárhelyi

unread,
Mar 2, 2016, 10:05:54 AM3/2/16
to drones-discuss
Dear Randy!

I just had the time to test 3.3.3.rc2, but the issue still remains with the z vel control, unfortunately. In some previous posts of this thread I tried to summarize possible causes I found in the code (although not 100% sure I understood everything well), but got no response for them. Also attached some flight logs as you asked for. How else can I help to resolve this issue? Thanks Gabor

Randy Mackay

unread,
Mar 2, 2016, 7:21:47 PM3/2/16
to drones-...@googlegroups.com

Gabor,

 

     Really sorry for missing your emails.  I’ll try and repond quicker from now on.  You can also try asking in our Gitter chat.

            https://gitter.im/diydrones/ardupilot

 

     In any case, so I had a look at some logs from you from Dec 12th (using Copter-3.3.2) and I see that the climb rate is very low (see ClimbRate.png).  Also the DAlt (Desired Alt) is below the Alt (actual alt) which is quiet odd actually.  I’ve gone so far as to reproduce the issue in SITL with Copter-3.3.2 (see sitl-ac332.png) but the good news is that this is fixed in Copter-3.3.3 (see sitl-ac333.png).

 

     Copter-3.3.3 went out as the official version a few days ago so if you upgrade you should be fine.

 

     If it’s not fine, could you provide a new log?

 

     As a side note, the THR_MID parameter is a bit high.  It’s 700 but from looking at the CTUN.ThrOut message it should be about 540 (it doesn’t need to be perfect).  This wouldn’t cause the problem you’re seeing though.  This would simply lead to the vehicle climbing when you switch to a manual flight mode (like Stabilize).

 

-Randy

 

From: drones-...@googlegroups.com [mailto:drones-...@googlegroups.com] On Behalf Of Gábor Vásárhelyi
Sent: 3-Mar-16 12:00 AM
To: drones-discuss
Subject: [drones-discuss] Re: guided mode velocity control

 

Dear Randy!

--

Climb1.png
ClimbRate.png
sitl-ac332.png
sitl-ac333.png

Randy Mackay

unread,
Mar 2, 2016, 7:31:09 PM3/2/16
to drones-...@googlegroups.com

Gabor,

 

     Also re your other questions.

·         Velocity requests should be sent from the companion computer at least once every 3 seconds or it will timeout.  https://github.com/diydrones/ardupilot/blob/master/ArduCopter/control_guided.cpp#L13

·         The freeze-z and freeze-xy features in the velocity controller are just there to get rid of twitches when new velocity commands arrive.  The only way I can imagine this could cause a problem is if the velocity commands are being sent from the companion computer at a very high rate (i.e. 50hz).  Even then I’m not sure it would be a problem, we simply haven’t tested sending at such a high rate.

 

-Randy

 

From: Randy Mackay [mailto:rmac...@yahoo.com]
Sent: 3-Mar-16 9:22 AM
To: 'drones-...@googlegroups.com'
Subject: RE: [drones-discuss] Re: guided mode velocity control

 

Gabor,

 

     Really sorry for missing your emails.  I’ll try and repond quicker from now on.  You can also try asking in our Gitter chat.

            https://gitter.im/diydrones/ardupilot

 

     In any case, so I had a look at some logs from you from Dec 12th (using Copter-3.3.2) and I see that the climb rate is very low (see ClimbRate.png).  Also the DAlt (Desired Alt) is below the Alt (actual alt) which is quiet odd actually.  I’ve gone so far as to reproduce the issue in SITL with Copter-3.3.2 (see sitl-ac332.png) but the good news is that this is fixed in Copter-3.3.3 (see sitl-ac333.png).

 

     Copter-3.3.3 went out as the official version a few days ago so if you upgrade you should be fine.

 

     If it’s not fine, could you provide a new log?

 

     As a side note, the THR_MID parameter is a bit high.  It’s 700 but from looking at the CTUN.ThrOut message it should be about 540 (it doesn’t need to be perfect).  This wouldn’t cause the problem you’re seeing though.  This would simply lead to the vehicle climbing when you switch to a manual flight mode (like Stabilize).

 

-Randy

 

From: drones-...@googlegroups.com [mailto:drones-...@googlegroups.com] On Behalf Of Gábor Vásárhelyi
Sent: 3-Mar-16 12:00 AM
To: drones-discuss
Subject: [drones-discuss] Re: guided mode velocity control

 

Dear Randy!

--

Gábor Vásárhelyi

unread,
Mar 3, 2016, 8:28:08 AM3/3/16
to drones-discuss
Hello, thanks for the answers, it helps I guess! The velocity update rate can be a problem since I am sending new velocity commands now at a high rate (20-50 Hz). I will do tests with reduced rate (lets say 1Hz) and will send you new logs with the official version 3.3.3. if it is still not working.

We have a companion computer that calculates desired velocities at a high rate to have smooth movement, it is kind of redundant with the inner loops of pixhawk, I know. I will also try to eliminate the freezing stuff and test that way as well.

Thanks for the help! I will get back to you after thorough testing now.
G.

Gábor Vásárhelyi

unread,
Mar 16, 2016, 9:49:06 PM3/16/16
to drones-discuss
Dear Randy!

Finally I had time to test the last official code and it works great, smooth! Thank you for the effort of correcting this bug! Finally, we can start working with the system nicely... The update rate I use at the moment is 20Hz, and I see no problems now.

Cheers, Gabor

2015. június 29., hétfő 8:55:51 UTC+2 időpontban Gábor Vásárhelyi a következőt írta:

Randy Mackay

unread,
Mar 16, 2016, 10:35:22 PM3/16/16
to drones-...@googlegroups.com

 

     Ah, excellent news!  So happy.

 

     By the way, we’re trying to get some companion computer images created for common platforms like RPI2, TX1.  I hope in the future that that will help people get started more quickly with the kind of advanced stuff you (and others) are doing.

 

     Anyway, best of luck!

 

-Randy

 

From: drones-...@googlegroups.com [mailto:drones-...@googlegroups.com] On Behalf Of Gábor Vásárhelyi
Sent: 17-Mar-16 10:47 AM
To: drones-discuss
Subject: [drones-discuss] Re: guided mode velocity control

 

Dear Randy!

--

Lincoln Gerken

unread,
Sep 15, 2016, 10:27:35 AM9/15/16
to drones-discuss
Dear Gabor,

You are using a rate of 20Hz, some implementation was necessary in code using any of MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT or MAV_CMD_NAV VELOCITY commands?

Thank you,

Lincoln Gerken
Reply all
Reply to author
Forward
0 new messages