Low Level Control

Discussions about quadcopters/multi-rotors
Post Reply
Calvin Chua
Member
Posts: 33
Joined: Sun Mar 01, 2020 1:28 am

Low Level Control

Post by Calvin Chua »

Hi, is there a possibility to control the quadcopter in a low level method, eg:
1. Outputing the rotor speed
2. Outputing the force and moment required. (I found something that control by desired force and angle. But I added on a cage and the quadcopter become really unstable)https://github.com/bitcraze/crazyflie-l ... der.py#L65

Besides, is it possible to check what filter is used for state estimation (Complementary or EKF) and how to choose them. When I logged the position data from stateEstimate, it is not that accurate when a cage is added on or external force is applied on the quadcopter. Is there any other variable that can reflect these? (I know flow deck works but I need it for all x, y and z)

Looking forward to hear from you soon
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Low Level Control

Post by arnaud »

Hi,
The lowest level of control is the motors PWM (ie. voltage) which is close enough to speed control for a brushed motor. Though this is controlled by the firmware and not over the radio. While full control over the radio might be possible it is a complete different challenge by itself :-).

The used state etimator is indicated by the parameter "stabilizer.estimator". 1 means complementary and 2 means EKF. The parameter can be changed in real-time to change the estimator.

It is true that none of the estimator we have take into account external forces, though for the cage your are mostly changing the inertia moment and mass of the platform so I would not expect the estimation to be the biggest problem, the tuning of the controller might be.

For the estimator, there is a mass constant that you could modify, it might help the EKF: https://github.com/bitcraze/crazyflie-f ... ants.h#L48

Assuming you are using the PID controller, you should look at the parameters pid_rate.* and pid_attitude.* and tune them. The rate PID it likely the main one to look at, it takes angular rate setpoint and outputs motor control.
Calvin Chua
Member
Posts: 33
Joined: Sun Mar 01, 2020 1:28 am

Re: Low Level Control

Post by Calvin Chua »

Hi Arnaud,

Thank you for your reply. I have been tuning the PID attitude and havent get a giid result yet. I will look into the PID rate later.

For the state estimation, what is the accuracy for each one?
I conducted an experiment of quadcopter hovering without the cage and my goal is to check the transisent response and the response after disturbance(Pressing the quadcopter down to a different height) under different PID gain value. So I probably need the estimator to capture the effect of external force.
Calvin Chua
Member
Posts: 33
Joined: Sun Mar 01, 2020 1:28 am

Re: Low Level Control

Post by Calvin Chua »

Add on to that, is it possible to change the inertia tensor of the quadcopter like changing the mass constant you mentioned before?
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Low Level Control

Post by arnaud »

Assuming the motor have enough power to stabilize the Crazyflie with the cage, the rate PID would be the first things to tune. I suggest you fly manually and look at the motor power in the flight tab in the client, the motors should ideally never hit 100% thrust.

For the estimator the Kalman filer (EKF) will be more precise and does handle positioning systems while the complementary filter is more forgiving to measurement inconsistency but does not handle positioning. So if you plan to use any kind of autonomous flight you should use the EKF.

As for the moment of inertia I am not sure, one would need to look in the EKF source code (the meat is in kalman_core.c). But we have been flying way different platform like the recent bolt-based small quad with one-cell Li-ion without needing to change the EKF other than the weight so this would not be my first thing to change.
Calvin Chua
Member
Posts: 33
Joined: Sun Mar 01, 2020 1:28 am

Re: Low Level Control

Post by Calvin Chua »

Hi, thanks for the reply, is it possible to show me how to modify the physicalConstant.h file mentioned on board since the firmware is uploaded as a zip file. Is it just find the file in the zip and change the constant? Am I allowed to do that? Thanks
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Low Level Control

Post by arnaud »

Nope this is not possible since the .zip contains the compiled firmware, you need to recompile the firmware by yourself to change this parameter.

If you are not on Linux you can use our VM to build the Crazyflie: https://www.bitcraze.io/documentation/t ... velopment/

The VM is starting to be a bit aged so if you are on Linux or Mac you can follow the doc from the repos to build the firmware: https://www.bitcraze.io/documentation/r ... tructions/

To change the mass without changing the source code you can create the file "tools/make/config.mk" with the content:

Code: Select all

CFLAGS += -DCF_MASS=0.027f
Then "make clean", "make" and "make cload" will build and bootload your Crazyflie :).
Calvin Chua
Member
Posts: 33
Joined: Sun Mar 01, 2020 1:28 am

Re: Low Level Control

Post by Calvin Chua »

I am using the app on Windows, is it possible to do it using that?
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Low Level Control

Post by arnaud »

Since this is not a parameter (yet) you cannot just use the client, you have to recompile and flash your own firmware in the Crazyflie to change the mass. On Windows the easiest might be to use the VM since it will make you install one software only.

If you are using Ubuntu on Windows using WSL you can use that as well to compile the firmware and then you can flash it using the client (the client can flash cf2.bin).
Calvin Chua
Member
Posts: 33
Joined: Sun Mar 01, 2020 1:28 am

Re: Low Level Control

Post by Calvin Chua »

I see. Thanks. I will set that up tomorrow and test it. Thanks for help
Post Reply