Trajectory Tracking Open Source project

Firmware/software/electronics/mechanics
Post Reply
carlos.luis306
Beginner
Posts: 17
Joined: Fri Apr 29, 2016 1:53 pm

Trajectory Tracking Open Source project

Post by carlos.luis306 »

Hello Crazyflie developers!

I've been working for nearly a year with the Crazyflie 2.0 for my bachelor's thesis. My work consisted in developing a trajectory tracking control system for the Crazyflie 2.0. I started by creating the dynamical model for the quad, then a simulation phase in MATLAB and finally the implementation.

First I used a classical PID controller for tracking positions but for more demanding trajectories I developed a linear quadratic tracker (LQT) that allow the quad to follow all sorts of 3D trajectories.

For position estimations we had a VICON system on the lab BUT, a masters student developed his own ultra-wide band localization system based on the decawave DMW1000 chip and I show some interesting comparisons between the performance with the UWB and the VICON while using the LQT controller.

The software is open source if anyone is interested and can be found at https://github.com/cipherlab-poly/crazyflie-public

Thanks and I'll happily answer if you have doubts.

EDIT: forgot to add the youtube video showing the project, enjoy! https://www.youtube.com/watch?v=c-SXovCyhJQ
Last edited by carlos.luis306 on Sun Aug 14, 2016 4:56 pm, edited 1 time in total.
justinleeyang
Expert
Posts: 186
Joined: Mon Dec 28, 2015 5:07 am

Re: Trajectory Tracking Open Source project

Post by justinleeyang »

hi.carlos:

Your experiment so cool! very good, so UWB trace anything no problem!
I want to know what range method TOF or TDOA?
carlos.luis306
Beginner
Posts: 17
Joined: Fri Apr 29, 2016 1:53 pm

Re: Trajectory Tracking Open Source project

Post by carlos.luis306 »

Well I'd say the UWB technology needs still some improvement, more on the side of bias compensation.

As of now I've only used the UWB measurement to estimate the quad position in the X-Y plane while the altitude came from the VICON. I've been playing lately with the geometry of the base estimations to see if I can get reliable estimations for the altitude in order to use it in the state feedback.

As for the method, although I'm not that familiar with the UWB technology, I can say we're using a two-way ranging method and we exchange various messages to calculate and compensate different delays in the communication process between the tag and the anchor. So I'd be inclined to say we use TDOA, but don't take me for granted here as I'm not that familiar with the UWB nomenclature. Hope that answers your question!
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Trajectory Tracking Open Source project

Post by arnaud »

Hi Carlos,

Great work! the result looks very nice. If you are doing two way ranging it is most likely TOA (Time of arrival) measurement. Basically it looks at when the packet arrived to calculate time of flight of the radio signal versus TDOA that would look at the different time of arrival between two signals (TDOA usually do not require pinging the anchor which is beneficial since the copter only listen and then it is possible to run as much copter as we want).

We are currently working on the position estimate with UWB with a Kalman filter (https://wiki.bitcraze.io/doc:lps:index# ... man_filter). The Z estimate is still challenging but when that is done the position controller could really get some more love. It is currently a simple PID controller that relies on overshoot of the attitude controller (ie. we have better settings of the PID control that we cannot use yet because it breaks the position controller ...).

Are you running the LQT controller onboard and do you have an idea of how much processing power it requires?
carlos.luis306
Beginner
Posts: 17
Joined: Fri Apr 29, 2016 1:53 pm

Re: Trajectory Tracking Open Source project

Post by carlos.luis306 »

Hey Arnaud,

The LQT controller is run offboard through MATLAB, but in general it shouldn't need more processing power than your classical PID. The thing about the LQT algorithm is that it computes time-varying feedforward and feedback gains based on the trajectory you want to follow, hence optimizing your gains depending on the trajectory you want to follow. All those gains can be computed before executing the trajectory and from what I've read in similar methods (such as model predictive control) the way to implement this on-board would most probably be to use a lookup table for the gains.

I would say maybe the calculus may be sort of heavy to be completely computed on-board, and the disadvantage of this method is that you need to specify the trajectory beforehand, that means a time evolution of your position estates at the very least (actually I also specify a velocity profile, but for starters you could say the velocity profile is zero and see how that might work). So let's say you want to change a setpoint "on-the-fly" while the quad is in hover for example, this would require to create the position profile for this mouvement, for example moving from 0 to 1 meter in the X position in 3 seconds, send this profile to the quad which will compute the gains and then execute the trajectory. You see what I mean here? I'm not entirely confident this might work in practice.

An online implementation of the LQT algorithm is something I've been analysis for awhile but haven't come up with a solution just yet. But in summary, to answer your question I'll say the LQT controller would not take much processing power IF you do the algorithm off-board and maybe have a sort of initialization phase where you fill a lookup table for the gains.

Hope that answers your question. Regarding your PID controllers I've followed the work you've been doing to improve the PID in teleoperated flight, but I get it when you say that breaks the position controller as I've seen that happening both in simulation and in real life. Specially in cascaded architectures there's a limit at how much you can push the internal loops without making outer loops unstable. So even though you have better gains for teleop'd flight it might be hard to tune the outer position loop. For instance, during my project I kept the initial attitude-rate gains and then I developed my own external loop for the position.

Glad you liked the work and if you have more doubts I'll answer as soon as I can, keep up the good work!
szx0112
Beginner
Posts: 15
Joined: Thu Feb 23, 2017 6:59 pm

Re: Trajectory Tracking Open Source project

Post by szx0112 »

Nice work. I am currently reading your report and hope we can do some extension based on what you have done. Thanks for sharing.

Just have a question. In your report, for the comparison between VICON and UWB part, it seems that the z positions are both provided by VICON, and UWB only works for the x-y plane control. Because we only have the UWB so probably hope to make it work without VICON.

So my question turns to be: Have you ever tested the result only with the UWB? If yes, how is the performance?

Thanks.
Post Reply