Skip to content
Snippets Groups Projects
Commit 98c42cf9 authored by Zach Eisele's avatar Zach Eisele
Browse files

can now specify radio channel without building

parent ae061e6b
No related branches found
No related tags found
3 merge requests!76lots of gui updates,!75Lost of gui updates,!74lots of gui updates among others
...@@ -9,7 +9,14 @@ function handler() ...@@ -9,7 +9,14 @@ function handler()
cd ./crazyflie_groundstation cd ./crazyflie_groundstation
#xterm -hold -e './crazyflieGroundStation' & #xterm -hold -e './crazyflieGroundStation' &
./crazyflieGroundStation & if [ $# -gt 0 ]
then
echo "custom radio"
./crazyflieGroundStation $1 &
else
echo "default radio"
./crazyflieGroundStation &
fi
CFPID=$! CFPID=$!
echo "Waiting for crazyflie groundstation to be created..." echo "Waiting for crazyflie groundstation to be created..."
cf_gs=crazyflie_groundstation.socket cf_gs=crazyflie_groundstation.socket
......
...@@ -92,8 +92,8 @@ pthread_t threads[3+NUM_RADIOS]; ...@@ -92,8 +92,8 @@ pthread_t threads[3+NUM_RADIOS];
#define PI 3.14159265 #define PI 3.14159265
int main(int argc, char **argv) { int main(int argc, char** argv) {
sleep(1); //***FOR TESTING PURPOSES*** (REMOVE) //sleep(1); //***FOR TESTING PURPOSES*** (REMOVE)
signal(SIGINT, &ctrlc_handler); signal(SIGINT, &ctrlc_handler);
...@@ -145,17 +145,34 @@ int main(int argc, char **argv) { ...@@ -145,17 +145,34 @@ int main(int argc, char **argv) {
cout << "Initializing Crazyflie " << i+1 << endl; cout << "Initializing Crazyflie " << i+1 << endl;
// Init the radio // Init the radio
radios[crazyflie_info[i].radioNumber].radio->setChannel( crazyflie_info[i].channelNumber ); if(argc == 2 && i == 0) {
uint8_t channelNum = (uint8_t) std::strtol(argv[1], (char**) NULL, 10);
radios[crazyflie_info[i].radioNumber].radio->setChannel( channelNum );
}
else {
radios[crazyflie_info[i].radioNumber].radio->setChannel( crazyflie_info[i].channelNumber );
}
// Clear the packets on the network destined for this quadcopter // Clear the packets on the network destined for this quadcopter
network->clearNetworkQueue(i); network->clearNetworkQueue(i);
// Create the crazyflie object // Create the crazyflie object
crazyflie_info[i].cflieCopter = new CCrazyflie(radios[crazyflie_info[i].radioNumber].radio, if(argc == 2 && i == 0) {
uint8_t channelNo = (uint8_t) std::strtol(argv[1], (char**) NULL, 10);
crazyflie_info[i].cflieCopter = new CCrazyflie(radios[crazyflie_info[i].radioNumber].radio,
channelNo,
crazyflie_info[i].dataRate,
i,
startTime);
}
else {
crazyflie_info[i].cflieCopter = new CCrazyflie(radios[crazyflie_info[i].radioNumber].radio,
crazyflie_info[i].channelNumber, crazyflie_info[i].channelNumber,
crazyflie_info[i].dataRate, crazyflie_info[i].dataRate,
i, i,
startTime); startTime);
}
crazyflie_info[i].cflieCopter->setNetworkForwarding(network); crazyflie_info[i].cflieCopter->setNetworkForwarding(network);
crazyflie_info[i].initTime = crazyflie_info[i].cflieCopter->currentTime(); crazyflie_info[i].initTime = crazyflie_info[i].cflieCopter->currentTime();
......
...@@ -231,7 +231,7 @@ QUADCOPTERS_t crazyflie_info[] = { ...@@ -231,7 +231,7 @@ QUADCOPTERS_t crazyflie_info[] = {
{"Crazyflie22", // Trackable name {"Crazyflie22", // Trackable name
NULL, // VRPN tracker object (initialized in VRPNinit) NULL, // VRPN tracker object (initialized in VRPNinit)
NULL, // CrazyFlie copter object (initialized in main) NULL, // CrazyFlie copter object (initialized in main)
65, // The channel number of the crazyflie 85, // The channel number of the crazyflie
0, // The radio to use 0, // The radio to use
XFER_2M, // The datarate of the Crazyflie XFER_2M, // The datarate of the Crazyflie
0, // The init time 0, // The init time
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment