Activating roll/pitch PID control without setting a throttle value

Firmware/software/electronics/mechanics
Post Reply
f-rower
Beginner
Posts: 16
Joined: Wed Jun 14, 2017 10:19 am

Activating roll/pitch PID control without setting a throttle value

Post by f-rower »

Hello everyone,

I am currently working on a project trying to make the crazyflie 2.0 balance on a single point such that its weight is supported at that point, allowing it to perch: The only thing left is for the drone to be able to balance on that point. With the current code available, the PID controllers for pitch and roll only work if some value for the throttle is set, either manually or via a joystick, so I would like to be able to make the crazyflie balance automatically without me having to give any external throttle inputs. Any suggestions as to how I could make the pitch/roll PID controllers work straight away independently from the throttle value? I'm very new to development of this quadcopter and I'm feeling a bit lost in between so much code :) :)

Thanks very much in advance,

f-
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Activating roll/pitch PID control without setting a throttle value

Post by tobias »

Interesting problem and I will be guessing a bit about how to solve it. Since the CF2 motors can't work in "reverse" (generate a pushing force) you will have to rely on gravity and thus you will need a base thrust to make the controller work. Like you say you can send this over the air with the cfclient or with the API. If you wan't there to always be a base-level thrust you could add that to the power distribution code.
f-rower
Beginner
Posts: 16
Joined: Wed Jun 14, 2017 10:19 am

Re: Activating roll/pitch PID control without setting a throttle value

Post by f-rower »

Hi Tobias, thanks for the quick response!

I think I may not have expressed myself very well, so here is a picture representing what I mean just so that we are on the same page:
representation.png
representation.png (10.48 KiB) Viewed 3295 times
The crazyflie is resting on the support, so the only thing I would need is just the pitch/roll PID controllers to work to keep it flat. As I said before, with the current implementation of the code there needs to be some base thrust for the PID controllers to work, and, well, there is no need for a base thrust when the cf is supported in this way. Therefore, I want to be able to make the roll/pitch PID controllers work without any base thrust.

Is this the scenario that you were giving your answer for?

Thanks very much,

f-
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Activating roll/pitch PID control without setting a throttle value

Post by arnaud »

Hi, I was discussing it with Tobias so I can jump-in on that.

Yes this is the scenario for which Tobias answered.

To control the attitude, the propeller are going to have to produce force on the Crazyflie side. Being cabled to run only in one direction with a fixed propeller pitch we can only produce thrust in the up direction.

This means that the mean thrust to the platform will always be positive in the up direction: there is no way to control the Crazyflie attitude without applying at least a little bit of thrust. The mean thrust will also help controlling the yaw since this is also controlled by the propeller speed.

That said, if the mean thrust is way lower than required to lift the platform, the Crazyflie will not takeoff and you can then obtain what you seek.

There is a minimum thrust level that you might want to disable in the firmware in order to test: https://github.com/bitcraze/crazyflie-f ... rpyt.c#L37. You can try to apply as low thrust as possible (starting with 1 :-) and see how the existing pid reacts.
f-rower
Beginner
Posts: 16
Joined: Wed Jun 14, 2017 10:19 am

Re: Activating roll/pitch PID control without setting a throttle value

Post by f-rower »

Thanks very much guys, that is very helpful!

However, I am trying to figure out where/how (file and variable) the thrust value is set before being sent to the crazyflie. I've been looking through the Python scripts, but I can't find out which file it is. Any help on this?
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Activating roll/pitch PID control without setting a throttle value

Post by tobias »

The cfclient input layer is a bit messy and has grown a bit to much, something we intend to rewrite. This is were the actual thrust value is sent from the cfclient when not using any assisted mode.
Post Reply