My off-board position control

Discussions and questions about the Crazyflie Nano Quadcopter
CrazyGuy
Beginner
Posts: 27
Joined: Fri May 02, 2014 6:03 pm

My off-board position control

Postby CrazyGuy » Wed Jul 20, 2016 10:09 pm

I create a new topic since it's off-topic in the other thread https://forum.bitcraze.io/viewtopic.php?f=12&p=10650&sid=920b59f8fed854aedc2bbe350140be1e#p10650

Here's a demonstration of the off-board position control I implemented. See the description for more informations.
The attitude control works fine. The position control could be a bit better. But nevertheless I'm happy with my results so far.

https://www.youtube.com/watch?v=TUU_0AYWWOE



arnaud
Bitcraze
Posts: 889
Joined: Tue Feb 06, 2007 12:36 pm

Re: My off-board position control

Postby arnaud » Fri Jul 22, 2016 6:31 am

That looks great! It is quite impressive that you have so good control with the radio in the middle, I know others have tried and not succeeded because of the latency induced by the radio link.

Is the PC part implemented using the python lib or have you implemented your own in another language?

The 3D positioning is also impressive, are you using only 1 camera? How are you estimating the depth? Size of the copter?

Great job and thanks for sharing!

CrazyGuy
Beginner
Posts: 27
Joined: Fri May 02, 2014 6:03 pm

Re: My off-board position control

Postby CrazyGuy » Fri Jul 22, 2016 10:56 am

Hi and thanks :)

My client is based on the c-client by Jan Winkler: https://github.com/fairlight1337/libcflie

My first tries to implement the off-board control also failed. I was using your logging system (logging system on the crazyflie-firmware unchanged). But I'm not quite sure why it didn't work. I also tried to increase the priority of the logging on the crazyflie-firmware but that wasn't successful either.

So I decided to not use your logging routine at all. All I do is:
[*] send a commander packet from the client to the crazyflie
[*] if a commander packet arrives at commander.c (commanderCrtpCB), the containing motorratios are applied and a packet containing the euler- and gyro-data are sent back to the client via crtpSendPacket. For this packet I'm using an own port (0x08).

The euler- and gyro-data are updated every 2ms in stabilizer.c (stabilizerTask). In this case (that the motorratios are calculated on the client) stabilizerTask calls also an adepted commanderWatchdog. But that's all stabilizerTask does in this case.


I'm using two cameras to determine the 3D position. The video shows only the images of the first one. Btw: The center of the red circle marks the tracked crazyflie in the image. But the radius is always constant. So it doesn't contain any information about the location or the size of the crazyflie.

arnaud
Bitcraze
Posts: 889
Joined: Tue Feb 06, 2007 12:36 pm

Re: My off-board position control

Postby arnaud » Fri Jul 22, 2016 11:29 am

Thanks for the precision, I am not surprised for the log since it was not designed to be used for such hard-realtime case. Your solution sounds good to me. it is good to know that such things are possible.

Is there a reason why you chose an off-board approach instead of coding directly un the Crazyflie?

And, by the way, are you planing to push your code on github? :-)

CrazyGuy
Beginner
Posts: 27
Joined: Fri May 02, 2014 6:03 pm

Re: My off-board position control

Postby CrazyGuy » Fri Jul 22, 2016 2:57 pm

For the linear-quadratic regulator I need to solve the algebraic riccati equation. In the solver I have to invert matrices, calculate determinants and solve linear equations (that's why I also use the Eigen library). To be honest I didn't even try to implement those things on the crazyflie.
In the future I/we want a model predictive control for the crazyflie (ideally for the 12 dimensional control system, not two nested 6 dimensional systems).

Yes, I think I will push the code on github someday. But I don't know when exactly. It's part of my master thesis whose evaluation isn't finished yet. I don't know if there will be conflicts if I make the code public before I got my grade!?


Return to “General discussions”

Who is online

Users browsing this forum: No registered users and 1 guest