Need help in working of PosVel type_mask in guided mode

Anyone can please help me in understanding how Position + Velocity type_mask supposed to work in guided mode as mentioned here, when I tested this in SITL then quadcopter started moving with WPNAV_SPEED and Vx,Vy,Vz added together, is it supposed to worked like that ? If yes, then isn’t it difficult to control the quadcopter movements with accuracy ?

Hi Notorious7,

position+velocity allows you to track a differentiable trajectory with lower tracking error compared to the using only position reference. Position and velocity command must be kinematically consistent. If you use only position type mask, you will be using arducopter current guidance library(AC_WPNAV). However, position+velocity type mask allows you to run your own guidance library.

You can check pending PR that adds scripting support for pos+vel reference. There is also a small example that track circle trajectory.

As far as I know, pos+vel reference does not use WPNAV_SPEED param, since AC_WPNAV library is not used.

i am using this pymavlink command directly on SITL


when i am setting (x,y,z) to (0,100,-10) and (vx,vy,vz) to (0,0,0) and continuously sending this position and velocity data with above mavlink command for every 1 second interval, then quadcopter is moving towards east at 10 meters height with default speed of WPNAV_SPEED, when i am giving some value for (vx,vy,vz) then quadcopter adding these velocity vectors with WPNAV_SPEED, but WPNAV_SPEED getting used in both cases.

And its the same case with this pymavlink command as well


I am using ArduCopter v4.0.4, am i making some mistake here ?

WPNAV_SPEED and WPNAV_ACCEL parameters are used for the leash length calculation. The leash length calculation is used for limiting the position controller error, thus indirectly limits your target speed. In your first example, the vehicle would moved to (0,100,-10) and stop there. But if you gave single value to (vx, vy, vz), the vehicle would stop at (vx, vy, vz)/ PSC_POSXY_P away from the (px,py,pz) location.

vx, vy, and vz fields are added to position controller output. They are not limited like the position command, so it is normal to get speed higher than WPNAV_SPEED parameter.

My pr just got merged. You can see the effect of adding velocity feedforward in trajectory tracking by comparing the current circle example with the new one where velocity terms are set to zero in the lines 48 and 49.

tbh i am avoiding to use velocity in 3 axes (vx,vy,vz), for that i need to do more conversions, i am looking to run multiple drones in a preprogrammed manner, and right now i am using only position type_mask, but issue with this is i cannot change velocity smoothly and i cannot send this command too fast, i just checked that there is difference between using position and position+velocity even when i am keeping velocities (vx,vy,vz) to (0,0,0) and i can send position+velocity frequently too unlike in case with only position type_mask, i just want to change velocity smoothly and keep giving position commands frequently but without using velocity vector of position+velocity type_mask to avoid complexities with the the velocity vector conversions cause i need to manage conversions keeping in mind both WPNAV_SPEED and Velocity vector plus along with some other WPNAV_ params