Drone rocking back and forth in loiter mode before taking-off

Good morning everyone,

We were trying today lane switching using a Lua script for moving from a GPS position/compass yaw and a GPS postion/VIO yaw lane manually. Everything worked good, though we had some issues with the compass at the beginning, but we noticed something odd when we tried to take off in loiter mode. The drone rocks back and forth:

This is consistent with the logs, the curious thing is that when we switch back to altitude hold, the drone stops doing it as it can be seen in the log:

Notice the oscillations in loiter mode. Is this related with the ground effect compensation? It seems to me that the position control is commanding some attitude set-points in roll and pitch before the take-off actually happens. We are using a cubeOrange with 4.1.0-beta4 Firmware. Please find the log below.

Hi @sbaccam,

The loiter rocking issue is because the vehicle tries to hold position while in Loiter mode but it can’t because the landing gear is touching the ground. So the rocking is just a result of the vehicle trying to hold position but being unable to move. You can see it is trying to hold position by graphing the PSC.TPX and TPY values (position controller’s target position in x and y axis)

The only mysterious thing is why it hasn’t detected the landing. My guess is that if you held the throttle low (instead of leaving it in the middle) then it would detect the landing and stop shaking.

I think it is not detecting the landing because of a slightly non-zero desired climb rate in the logs which seems strange. The THR_DZ is 100 and RC3_TRIM is 1500 so the RC input of 1501 should translate to an exactly 0m/s climb rate… but strangely it is slightly positive so this needs some investigation. It is probably correct behaviour but needs looking into so I’ve added it to the Copter-4.1 “issues to be investigated” list.

1 Like

Good afternoon @rmackay9 ,

I am not sure if this helps, but we have only seen the “rocking back and forth” in the beta4 version. In the beta3, we actually flew one drone today with that firmware, we did not notice it. Also, we flew a completely different drone with beta4 and the rocking back and forth did show up. A log from that flight with beta 3 can be found below:

This isn’t coming from the position controller. The position and velocity error has been held zero. So the only other place that this can come from the the desired velocity. In particular I believe that the loiter breaking is causing this to rock back and forth as loiter reacts to the measured velocity.

Is this a repeatable problem?

If so can you set the aircraft up so it is doing this and then set LOIT_BRK_ACCEL to 0?

Good morning, I work with @sbaccam and tested setting LOIT_BRK_ACCEL to 0 this morning and there was no noticeable difference. The drone continued to rock back and forth. To @rmackay9’s earlier point I did notice that holding the throttle low did stop the drone from rocking.

3 Likes

To complement @droningOn, this is a log in loiter mode in a different setup, this was a bigger drone and an hexacopter and the issue shows up too:

As you can see, before the take-off, there is a desired pitch:

As I mentioned before, it seems like something that only happens in beta4 since we flew today another drone with beta3 and it did not show this issue.

1 Like

If I give you a compiled version of master with some additional logging could you repeat the test?

Sure, we will be happy to help. We can perform the test tomorrow morning.

Thanks!! I will prepare something for you.

Hi @sbaccam,
Could you try this:
https://drive.google.com/file/d/1nC4-G8O_QQzAcX4vwd9OTl42m1R5sy4u/view?usp=sharing

Good morning,
I just performed a loiter flight using this firmware with optical flow for positioning and VIO for heading (can’t fly outdoors this morning due to inclement weather) and we didn’t see any rocking back and forth! I have attached the log below. I will test the other lanes with GPS and compass later today when I can fly outside

3 Likes

Fantastic!! Thanks!

I will do a PR now.