USB Radio
The USB Radio Dongle acts as the bridge between the Client and the Firmware. It sends control setpoints generated from the Client to the Firmware controllers, as well as receives sensor data from the Firmware to the Client for logging.
Modifying the Radio
The Radio functions can be found in the CCrazyRadio.cpp source file.
Radio Initialization
- 1. Create CrazyRadio Pointers and Crazyflie Pointers
CCrazyRadio *crRadio1 = 0; CCrazyRadio *crRadio2 = 0; CCrazyflie *cflieCopter1 = 0; CCrazyflie *cflieCopter2 = 0; CCrazyflie *cflieCopter3 = 0; CCrazyflie *cflieCopter4 = 0;
Note: You must have a pointer for EACH Radio you want to initialize.
- 2. Initialize First CrazyRadio
crRadio1 = new CCrazyRadio(0); // dongle number (starting at 0) if( crRadio1->startRadio() ) //assigns pointer to USB location { cflieCopter1 = new CCrazyflie(crRadio1, 5); //Assigns Crazyflie1 to Radio1 on Channel 5 cflieCopter2 = new CCrazyflie(crRadio1, 80); //Assigns Crazyflie2 to Radio1 on Channel 80 } else { std::cerr << "Could not connect to dongle 1. Did you plug it in?" << std::endl; exit(-1); } usleep(10000);
- 3. Initialize Second CrazyRadio (repeat as necessary...)
crRadio2 = new CCrazyRadio(1); // dongle number if( crRadio2->startRadio() ) { cflieCopter3 = new CCrazyflie(crRadio2, 25); //Assigns Crazyflie3 to Radio2 on Channel 25 cflieCopter4 = new CCrazyflie(crRadio2, 45); //Assigns Crazyflie4 to Radio2 on Channel 45 } else { std::cerr << "Could not connect to dongle 2. Did you plug it in?" << std::endl; exit(-1); } usleep(10000);