Sideway drift with virtualstick
999 7 2021-4-29
Uploading and Loding Picture ...(0/1)
o(^-^)o
Mats Bohlinsson
Second Officer
Flight distance : 1838077 ft
  • >>>
Sweden
Offline

Hi,
I'm doing a mapping mission with virtualstick.
In simulator it works fine, drone flies perfectly stright.

But when I flew it today, it doesnt fly straight. When directed straight north (0 degrees) it doesn't fly straight north. Isn't that strange?

I think it could be two reasons for this:
* Heavy crosswind
* Compass not aligned with gps course
* I've got the coordinate system wrong, but why does it work perfectly in simulator?


An example here 7:34





2021-4-29
Use props
Super pilot
lvl.4
Flight distance : 174905 ft
Russia
Offline

Because the simulator's algorithms cannot convey all the nuances of real weather conditions. I experimented with virtual sticks and realized that they are not suitable for video shooting. Although my algorithms for calculating the flight path allow the drone to fly exactly on a given trajectory, the gimbal has not been able to achieve smooth operation. So virtual sticks suck.
2021-4-29
Use props
djiuser_OR8EW5uz3gSA
lvl.4

Canada
Offline

Nice! You got the mini 2 working! I've also had varying degrees of success getting virtual stick to follow a path closely. Wind issues are usually fixed by enabling isVirtualStickAdvancedModeEnabled (but that is usually enabled by default). If the wind is pretty strong there isn't much you can do.

Are you moving by yawing to the target compass bearing, then using the body rollPitchCoordinateSystem to pass a velocity value to the roll parameter in DJIVirtualStickFlightControlData or are you using the ground system and calculating separate pitch and roll velocity vectors to move the drone? I've had a similar result that you described above when my trigonometry calculations were off slightly
2021-4-29
Use props
Mats Bohlinsson
Second Officer
Flight distance : 1838077 ft
  • >>>
Sweden
Offline

djiuser_OR8EW5uz3gSA Posted at 4-29 13:39
Nice! You got the mini 2 working! I've also had varying degrees of success getting virtual stick to follow a path closely. Wind issues are usually fixed by enabling isVirtualStickAdvancedModeEnabled (but that is usually enabled by default). If the wind is pretty strong there isn't much you can do.

Are you moving by yawing to the target compass bearing, then using the body rollPitchCoordinateSystem to pass a velocity value to the roll parameter in DJIVirtualStickFlightControlData or are you using the ground system and calculating separate pitch and roll velocity vectors to move the drone? I've had a similar result that you described above when my trigonometry calculations were off slightly

Hi!

Thanks for your answer.

I'm using the ground coordinate/speed xy.
So I calculate the speed x and y from course/speed.

I just checked th logs and it seemed like the roll maxed out to 25degrees, so it might be that.
I'll run the same mission in lighter wind and check what happens.

Yeah thats exactly what worry me, that I got something wrong in the calculations.

The 3d model that I created in open drone map looks like this:

Amazing program and its free!! Even managed to import the mesh in blender.

The 3d could be better, but anyway its the first 3d I try so I think it's cool. The mini2 need a little more work before I can relase anything.



2021-4-29
Use props
djiuser_OR8EW5uz3gSA
lvl.4

Canada
Offline

Wow that looks awesome! Seems like you are getting really close!

I've had that problem before where either the x or y vectors was too high, past max velocity (15m/s) and it caused the drone to move too far in one direction. I looked back at another issue I had before where the drone was drifting and it turned out I made the mistake of not properly converting to radians when passing values to trigonometry functions.

I've found that the method of yawing to a compass bearing and just rolling in that direction so that I can easily pass values in m/s works pretty well for mapping flights. But now I'm looking at a POI flight like an orbit so I want to be able to move laterally while the front of the drone is pointing at a target. Are you calculating the velocity vector using a formula similar to this?

Vx = s/d * (x1−x2)
Vy = s/d * (y1−y2)

where s is a constant speed and d is the euclidean distance between the coordinates as cartesian values
d = √(x−x0)^2 + (y−y0)^2




2021-5-1
Use props
Mats Bohlinsson
Second Officer
Flight distance : 1838077 ft
  • >>>
Sweden
Offline

djiuser_OR8EW5uz3gSA Posted at 5-1 10:46
Wow that looks awesome! Seems like you are getting really close!

I've had that problem before where either the x or y vectors was too high, past max velocity (15m/s) and it caused the drone to move too far in one direction. I looked back at another issue I had before where the drone was drifting and it turned out I made the mistake of not properly converting to radians when passing values to trigonometry functions.

Yep pretty much off how I do it.

Today I got it really good!
I implemented a crosstrack pid-regulator. It flyes completly straight!
Have a look here:
https://app.airdata.com/share/hdAOdz

You can clearly see where the pid regultor start swinging in at each turn. I havn't adjusted the pid-values, I got it good in the simulator, but the real drone needs other values.

I even tried in heavy sidewind, completly straight line.

Pid looks something like this:
        pid.output_limits = (-55, 55)
        pid.setpoint = 0
        pid.tunings = (6, 1.2, 0.9)

       while True:
            crosstrack_error = l.get_crosstrack_error(loc_start, loc_dest)
            course_correcton = pid(crosstrack_error)

You correct about the high speed. It seems like the drone prioritize speed compared to course stabilty in visrtualstick-mode!!

What kind of app are you doing?
2021-5-1
Use props
Mats Bohlinsson
Second Officer
Flight distance : 1838077 ft
  • >>>
Sweden
Offline

Mats Bohlinsson Posted at 5-1 10:58
Yep pretty much off how I do it.

Today I got it really good!

PID was the way to go.
And not trying to input higher speed that it can move.

Did a crosspattern mission today:
https://app.airdata.com/flight/4 ... ENERALNotifications
2021-5-2
Use props
djiuser_OR8EW5uz3gSA
lvl.4

Canada
Offline

Mats Bohlinsson Posted at 5-2 12:14
PID was the way to go.
And not trying to input higher speed that it can move.

Nice! Looks great! You managed to get that really quickly!

I never thought of looking into cross track error before, that is really interesting, thank you for the idea!

I'm still ironing out issues with mine. I still have some drift even when moving slowly but always in the same dimension. I'm using values in m/s rather than angles. I recently tried polynomial trajectory generation to create a minimum acceleration trajectory with (x,y) NED positions, velocity(m/s) and acceleration values and then applying a pid controller to correct the position, velocity passed to virtual stick. I think my main issue is tuning the PID controller properly for this method to work but it is weird that my drift is always in the y direction.

The app I'm making is to create 3D models using mapping and orbit type flight plans. It works pretty well with waypoint missions on supported drones but with the mini being so versatile in urban areas I really want to implement a virtual stick solution
2021-5-3
Use props
Advanced
You need to log in before you can reply Login | Register now

Credit Rules