Controller

Firmware/software/electronics/mechanics
Post Reply
Calvin Chua
Member
Posts: 33
Joined: Sun Mar 01, 2020 1:28 am

Controller

Post 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.
Calvin Chua
Member
Posts: 33
Joined: Sun Mar 01, 2020 1:28 am

Re: Controller

Post 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++
Calvin Chua
Member
Posts: 33
Joined: Sun Mar 01, 2020 1:28 am

Re: Controller

Post 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
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Controller

Post 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.
Calvin Chua
Member
Posts: 33
Joined: Sun Mar 01, 2020 1:28 am

Re: Controller

Post 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?
kimberly
Bitcraze
Posts: 1050
Joined: Fri Jul 06, 2018 11:13 am

Re: Controller

Post by kimberly »

Please check out the controller documentation
Post Reply