Page 1 of 1

Controller

Posted: Sat Sep 26, 2020 11:00 pm
by Calvin Chua
Hi,
Is there any methods that can alter the pre defined controller code using Python or is it possible to output the moment and force calculated on PC to the crazyflie and control it? I use sendsetpoint function but the the function outputs the yaw pitch roll angle instead of moment force. Even though I output 0 for both, it is still unstable as it move left and right easily.

Re: Controller

Posted: Mon Sep 28, 2020 1:32 am
by Calvin Chua
Besides, is the thrust parameters from stabilizer directly taken from the motor input or calculated by the acceleration of the quadcopter? I output a thrust of 65535 using send_setpoint, but when I logged the data at the same time, it only returns me thrust of 40k++

Re: Controller

Posted: Tue Sep 29, 2020 1:33 am
by Calvin Chua
Is there any methods to control the quadcopter other than send_setpoint function. The quadcopter becomes unstable after adding a cage on it

Re: Controller

Posted: Tue Sep 29, 2020 7:26 am
by arnaud
Hi,

To your first question, it is possible to control the Crazyflie at lower level, for example you can control the attitude angular rate and you can log the attitude, this would allow to implement an attitude control loop in python. Though, this is only interesting if your interest is to implement control loop in python, if your interest is to get the Crazyflie to fly better you should instead tune the onboard control loop.

The thrust is calculated by the control loops, there is a compensation for battery voltage this is likely why you see a discrepancy between the thrust setpoint and the actual control.

If your copter becomes unstable after modifying its mass, you likely need to tune the control loop. If you want to send attitude setpoint to the Crazyflie, you should still do it with the send_setpoint function, but the PID controller needs to be tuned.

You can modify the PID gain for the attitude and the attitude angular rate as parameters. The easiest is to open the parameters tab of the client and modify them there.
Screenshot from 2020-09-29 09-22-11.png
You will need to play around with the value, once you find values that make your Crazyflie stable, they can be saved into the firmware source code or set at startup in your scripts.

Re: Controller

Posted: Tue Sep 29, 2020 7:52 am
by Calvin Chua
Hi, thanks for the reply.
How would the controller can be tuned to fix the change of the model considering if the model is changed, considering the moment equation for the quadcopter is M = I*wdot for linearised system. changing the model means it will change the I, how would changing the PID gain will help solving this issue?

Re: Controller

Posted: Thu Oct 01, 2020 6:48 am
by kimberly
Please check out the controller documentation