changing position

Firmware/software/electronics/mechanics
Post Reply
RyanMco
Expert
Posts: 156
Joined: Tue Apr 09, 2019 6:15 am

changing position

Post by RyanMco » Sun Dec 22, 2019 7:10 pm

Hi guys!
I have an issue which I guess there's solution for it but not sure, so I need your help!

sometimes when I want to let my drone take off it will not up like straight-up from ground , sometimes it round with angle 45/30+ in any side(left or right), and that's my problem, because I have camera on my drone and I just want my drone to take off on specific view , I mean by that, that I let my drone by its camera that's composed to see the specific view and then while it's hovering/taking off my drone takes data from that specific view, so lets assume my drone while want to up (taking off) from ground he moves a lil to left with angle 35+ then my camera will see different view and not my specific view, and that's because my drone while taking off (its initial moving up from ground) he swerving (perverted) to right/left with angle about 30+ degree and this lead my drone to see different view than specific view that I want, and then my drone will act different and not properly, because he sees different view than specific view that I want it to see at first taking off .. (in other words if my drone while takes off at its initial up perverts with angle 25+ then he sees different view because its camera will capture different view according to its angle perverting at initial up(taking off))
what I want to do is something like if my drone at its take off will up and in its initial up if my drone's angle perverts with angle 25+ then I want to let it to land immediately or to correct its angle to zero (as what it was before its first initial taking off), but I guess the first suggestion would be more elegant and easy to do..

How can I do that in my firmware? what parameters should I update to accomplish this goal? and if there's any more suggestion to solve my problem would be more appreciated to let me know!

my goal- to let my drone correct itself if there's a perverting in its angle while its initial taking off from ground or if not correcting .. at least to land immediately

any help please?!
thanks alot !!!



kimberly
Bitcraze
Posts: 255
Joined: Fri Jul 06, 2018 11:13 am

Re: changing position

Post by kimberly » Mon Dec 23, 2019 10:57 am

So, when the drone is on the ground, the yaw tend to drift a lot more than when it is in the air. So when it takes off, it wants to put it's heading back to what it thinks is '0', which by that time is false ofcourse.

Have you tried resetting the kalman filter just before it takes off ? (parameter: kalman.resetEstimation)
You can also input the last value of its estimated yaw into the take off command as its target yaw (so it will just stay put with its heading). What is also possible is to put the yaw setpoint to velocity_mode instead ( setpoint->mode.yaw = modeVelocity). But that depends where you are sending the take off command from.

Let us know if it works.

RyanMco
Expert
Posts: 156
Joined: Tue Apr 09, 2019 6:15 am

Re: changing position

Post by RyanMco » Mon Dec 23, 2019 11:01 am

Hi !
but how could I reset the kalman before take off? I mean this drift happen while taking off (while my drones on its initial up from ground "taking off" by command takeoff) then sometimes it drifts with angle 30+ .. it's like a sudden drift and not always, as a result I want to solve this thing as what I mentioned above .. resting the kalman would off my drone if there's a drift in my drone angle while taking off? if so, then where in my firmware should I update to reset my kalman? what should I write?


the take off command I send it from crazyflie_ros scripts from test_high_level.py

kimberly
Bitcraze
Posts: 255
Joined: Fri Jul 06, 2018 11:13 am

Re: changing position

Post by kimberly » Mon Dec 23, 2019 11:31 am

Do you know how to set parameter settings in the crazyflie by the cflib? Please read https://www.bitcraze.io/docs/crazyflie- ... ython_api/ under the heading 'parameters'. Than use that with the parameter i gave in the previous post (kalman,resetestimator).

Secondly, what you observe is not drift happening at the moment but an result of it. Look at the cfclient plotter to look at the heading estimate of the crazyflie while on the ground and while in the air to investigate and try to understand this phenomenon. The heading change is due to the controller wanting to put the heading to 0, but the estimated heading already drifted while it was on the ground. If you turn on the crazyflie and wait for a long time, the drift is more severe. So by the time that you are taken off, the drift have caused the crazyflie on the ground to think that its heading is for instance 45 degrees (and due to the nature of drift that can be any number in any sign).

So when the crazyflie takes off, the controller wants to put the heading to 0, but the crazyflie thinks its current heading is another angle and tries to compensate for that immediately. That is the behavior you are observing, and it is due to the wrongly estimated heading and the controller wanting to put heading to 0 degrees. The solutions I provided before: (1) The kalman reset helps with making the drift less severe before you take off, and (2) the yaw setpoint to velocity mode for take off will prevent the controller compensate the faulty heading estimate. You can decide which road to take on this.

RyanMco
Expert
Posts: 156
Joined: Tue Apr 09, 2019 6:15 am

Re: changing position

Post by RyanMco » Mon Dec 23, 2019 6:00 pm

Hi!
thanks for your help/assistance!
but I STILL didn't understand you well, I understand that reset kalman would fix the problem, but I didn't figure out why the problem is happen, the controller wants to put zero to where? (my drone is on ground) and estimation position isn't zero .. so what happen exactly, and what's heading variable? didn't understand well your explanation .. I ofc understand what's controller/kalman and how they work .. but didn't understand the situation how it happen?

in its initial taking off , drone controller wants to put zero to where? and lets assume that current estimation isn't zero .. so my drone would go to the current estimation and not follow up the controller order to put zero?! .. I mean if estimation isn't zero but controller wants to put it zero .. so why when controller wants to put it zero then this happen(there would be drift) .. ?! weird

kristoffer
Bitcraze
Posts: 209
Joined: Tue Jun 30, 2015 7:47 am

Re: changing position

Post by kristoffer » Wed Jan 08, 2020 8:14 am

When the Crazyflie is sitting on the ground, the estimator will assume it is facing positive X (yaw = 0).
The only exception is
1. if you are using a positioning system that provides yaw (lighthouse or mocap)
2. you set the start yaw using the kalman.initialYaw parameter

Post Reply