Controling Crazyflie from Another crazyflie

Firmware/software/electronics/mechanics
Post Reply
flyingman123
Beginner
Posts: 2
Joined: Mon Dec 30, 2013 7:05 am

Controling Crazyflie from Another crazyflie

Post by flyingman123 »

Hello Everyone! :)

I recently bought two of the crazyflies and they are awsome! I used the xbox controller to control each and had lots of fun. And now that I feel I am string attached to my PC, I am considering switching one of my crazyflie into a master unit (i.e. controller) and the other one to be the salve.

Here is my idea, the master crazyflie will connect to the nrf24l01p chip and issue commands using its own gyroscope, accel, compass, and barometer reading.
So my idea is to power up the slave first, and then power up the master. Once both are powered up, I will raise the master from the ground level and as I raise it, this will increase the thrust of the other crazyflie. Same for pitch, roll, and yaw, they will be controlled from the master. That way, my hand movements will be the controller. Pretty much like android app.

To start, I located the following line in radiolink.c file, which according to the wireless chip, need to place the device of the master into PTX mode

Code: Select all

//Power the radio, Enable the DS interruption, set the radio in PRX mode
  nrfWrite1Reg(REG_CONFIG, 0x5E);
:) The next step that jumps into mind is placing the sensor reading of the master crazyflie into the TOC table to be transmitted into the slave's thrust, pitch, yaw and roll.

The thing is I feel that I am missing big part of the picture espcially with the wireless modification. so any hints on where to go next would be appreciated. I am planning to post a video flying the two using master/slave concept once its working! :)
Thank you!
atomicdog
Expert
Posts: 105
Joined: Tue Mar 12, 2013 2:50 am
Location: San Diego

Re: Controling Crazyflie from Another crazyflie

Post by atomicdog »

Looking at the CrazyRadio src code and the wiki page for the comm protocol should be useful.
6-DOF CF | wireless xbox 360 controller
flyingman123
Beginner
Posts: 2
Joined: Mon Dec 30, 2013 7:05 am

Re: Controling Crazyflie from Another crazyflie

Post by flyingman123 »

Thank you atomicdog. This page is pretty useful and I wasn't aware its there. I am really excited about the posiblity of using hand's movement to control the crazyflie. Even better when you have two pairs of slave/master crazyflie that you can fly both at the same time. :D

The question along with the comms once I got over it, is reading and writing between the two crazyflies. At the end of the protocol page, it says that I have to use null packet (0xff) to have bi-directional comms. is I am getting this correctly?

Thank you
atomicdog
Expert
Posts: 105
Joined: Tue Mar 12, 2013 2:50 am
Location: San Diego

Re: Controling Crazyflie from Another crazyflie

Post by atomicdog »

The question along with the comms once I got over it, is reading and writing between the two crazyflies. At the end of the protocol page, it says that I have to use null packet (0xff) to have bi-directional comms. is I am getting this correctly?
As I understand it, yes. The CR only has code for PTX mode and the CF only has code for PRX mode. Probably a more robust way to communicate between CF's is to add code to switch between PTX and PRX mode.

I also want to get communication between CF's working but I haven't looked into very much yet. I plan on working on it in a few more weeks when I'll have more time.
6-DOF CF | wireless xbox 360 controller
otto
Beginner
Posts: 19
Joined: Sat Dec 28, 2013 5:03 pm

Re: Controling Crazyflie from Another crazyflie

Post by otto »

flyingman123 wrote:Once both are powered up, I will raise the master from the ground level and as I raise it, this will increase the thrust of the other crazyflie.
This sounds like a great project! Although I don't think it will be as easy as that, because if you want the slave crazyflie at the same height or linearly proportional(because its no fun climbing a ladder) to the height of the master, just increasing the thrust of the slave according to the height of the master, will make the slave go zooming up(exponentially, I believe?), because increasing propeller speed increases the vertical speed of the crazyflie and not the height. This means that you are probably going to have to use the barometer to make the slave try to match the pressure of the master.

Please correct me if I am wrong.

Good luck,

Otto
vrdate
Beginner
Posts: 5
Joined: Tue Oct 01, 2013 1:03 pm

Re: Controling Crazyflie from Another crazyflie

Post by vrdate »

It might be easier to use CeazyRadio Telemetry data from one CrazyFlie at one end to issue Control commands to the other CeazyRadio and to another Crazyflie.
This way you do not need to change the client code at all and you can reuse the CeazyRadio Server code.
You still need two CeazyRadios bridged communication so the master Telemetry data is used as a new input device like in the Leap Motion implementation.
Post Reply