Jaeyoung-Lim / mavros_controllers

Aggressive trajectory tracking using mavros for PX4 enabled vehicles
BSD 3-Clause "New" or "Revised" License
409 stars 166 forks source link

Unstable behaviour when setting velocity_yaw to true #127

Closed mzahana closed 4 years ago

mzahana commented 4 years ago

Hi @Jaeyoung-Lim

I would like the drone's heading to be in the velocity direction, but I am not sure if the controller is properly implemented for that. So, I set velocity_yaw to true. However, the drone starts to oscillate and eventually crashes. Any idea what could be the issue?

Jaeyoung-Lim commented 4 years ago

@mzahana A log would be helpful. Are you running the latest master(mavros_controllers)? which firmware are you running?

Jaeyoung-Lim commented 4 years ago

Thanks for reporting, I can reproduce the issue. Added a fix in #128

Jaeyoung-Lim commented 4 years ago

@mzahana Can you test it out and verify that this has been fixed?

mzahana commented 4 years ago

@Jaeyoung-Lim So you basically removed the multiplication by -1 here ?

I tested that, and the takeoff is weird, afterwards it stabilizes. But such unstable takeoff is dangerous on real drones.

See the below video for a test.

test.zip

Jaeyoung-Lim commented 4 years ago

@mzahana I believe the unstable takeoff is not related to this issue. Could you maybe retune the position controller so that the takeoff is less aggressive?

mzahana commented 4 years ago

@Jaeyoung-Lim Which position controller are you referring to?

Jaeyoung-Lim commented 4 years ago

@mzahana The geometric_controller in this repo. I also see the aggressive takeoff and seems like the takeoff procedure has changed in the firmware side.

mzahana commented 4 years ago

@Jaeyoung-Lim I am confused, I thought attitude rates and thrust setpoints are used. Therefore, the PX4 position controller is not used. Is there a takeoff procedure in the geometric_controller that uses the PX4 position controller?

Jaeyoung-Lim commented 4 years ago

@mzahana No, you are right, it uses attitude rates and thrust setpoints.

The geometric_controller IS a position controller. I meant retuning the PID gains inside the geometric_controller which defines the reference acceleration. I believe there is a spool up logic when the vehicle is in takeoff phase that is built into px4 and there was a change in that recently.

My suspicion might not be true, but the aggressive takeoff behavior is something that was not there with older PX4 firmware versions

mzahana commented 4 years ago

I still don't understand how would PX4 differentiate a takeoff maneuver from another arbitrary maneuver when it receives attitude rates as OFFBOARD commands. I believe that it would just track them, whether they correspond to takeoff or not. What do you think?

For the geometric_controller gains, you mean those ?

Jaeyoung-Lim commented 4 years ago

@mzahana You might be right, I was just speculating. Yes, that is correct. Usually Kp_z, and Kv_z will be the relevant ones

shubham-shahh commented 2 years ago

Hi @Jaeyoung-Lim , is this fixed? because I am facing the same issue

Jaeyoung-Lim commented 2 years ago

@shubham-shahh It should be fixed.