diff --git a/crazyCART.sh b/crazyCART.sh index 2c7a64b8506b8f6c8a315af7812c818b99b16ea1..c8499d6cd6f1f3ff8401daf16a83283c787dd4ba 100755 --- a/crazyCART.sh +++ b/crazyCART.sh @@ -5,10 +5,11 @@ function handler() kill -s SIGINT $CFPID kill -s SIGINT $APID kill -s SIGINT $BPID + kill -9 $GPID } cd ./crazyflie_groundstation -#xterm -hold -e './crazyflieGroundStation' & + if [ $# -gt 0 ] then echo "custom radio" @@ -18,21 +19,47 @@ else ./crazyflieGroundStation & fi CFPID=$! + echo "Waiting for crazyflie groundstation to be created..." cf_gs=crazyflie_groundstation.socket while [ ! -S "$cf_gs" ] do sleep 1 done + cd ../groundStation/adapters/crazyflie sleep 1 ./bin/cf_adapter & APID=$! + sleep 1 cd ../.. ./BackEnd & BPID=$! +# if [ ! ps -p $CFPID -gt /dev/null || ! ps -p $APID -gt /dev/null || ! ps -p $BPID -gt /dev/null ] +# then +# echo "enter if" +# if [ ps -p $CFPID -gt /dev/null ] +# then +# kill -s SIGINT $CFPID +# fi + +# if [ ps -p $APID -gt /dev/null ] +# then +# kill -s SIGINT $APID +# fi + +# if [ ps -p $BPID -gt /dev/null ] +# then +# kill -s SIGINT $CFPID +# fi +# exit +# fi + +./GroundStation & +GPID=$! + trap handler INT wait \ No newline at end of file diff --git a/crazyflie_software/crazyflie-firmware-2021.06/src/modules/src/crtp_commander_generic.c b/crazyflie_software/crazyflie-firmware-2021.06/src/modules/src/crtp_commander_generic.c index a4b1f55c47b4b46387a0a6fd2fb5348b3465c9e1..f690d24e267310340ea0524f2e2dd54d2bf647d3 100644 --- a/crazyflie_software/crazyflie-firmware-2021.06/src/modules/src/crtp_commander_generic.c +++ b/crazyflie_software/crazyflie-firmware-2021.06/src/modules/src/crtp_commander_generic.c @@ -73,6 +73,7 @@ enum packet_type { positionType = 7, attitudeRateType = 8, attitudeType = 9, + mixedAttitudeType = 10, }; /* ---===== 2 - Decoding functions =====--- */ @@ -431,6 +432,39 @@ static void attitudeDecoder(setpoint_t *setpoint, uint8_t type, const void *data setpoint->thrust = values->thrust; } + +/* + * Custom mixed Attitude decoder, bypasses the normal attitude control path, + * packet contains the roll and pitch as attitude angles and the + * yaw as an attitude rate in addition to the thrust value + */ +struct mixedAttitudePacket_s{ + float rollAngle; // deg + float pitchAngle; // deg + float yawAngleRate; // deg/s + float thrust; // thrust percentage 0 - 60,000 +} __attribute__((packed)); +static void mixedAttitudeDecoder(setpoint_t *setpoint, uint8_t type, const void *data, size_t datalen){ + + const struct mixedAttitudePacket_s *values = data; + + ASSERT(datalen == sizeof(struct mixedAttitudePacket_s)); + + setpoint->mode.x = modeDisable; + setpoint->mode.y = modeDisable; + setpoint->mode.z = modeDisable; + + setpoint->mode.roll = modeAbs; + setpoint->mode.pitch = modeAbs; + setpoint->mode.yaw = modeVelocity; + + setpoint->attitude.roll = values->rollAngle; + setpoint->attitude.pitch = values->pitchAngle; + setpoint->attitudeRate.yaw = values->yawAngleRate; + + setpoint->thrust = values->thrust; +} + /* ---===== 3 - packetDecoders array =====--- */ const static packetDecoder_t packetDecoders[] = { [stopType] = stopDecoder, @@ -443,6 +477,7 @@ const static packetDecoder_t packetDecoders[] = { [positionType] = positionDecoder, [attitudeRateType] = attitudeRateDecoder, [attitudeType] = attitudeDecoder, + [mixedAttitudeType] = mixedAttitudeDecoder, }; /* Decoder switch */ diff --git a/groundStation/gui/MicroCART/.gitignore b/groundStation/gui/MicroCART/.gitignore index d5ce34de5297da99798e7d40d2d85f383424787e..019099be5ce29387acb1e9f0b543340c71b1c9b6 100644 --- a/groundStation/gui/MicroCART/.gitignore +++ b/groundStation/gui/MicroCART/.gitignore @@ -1,3 +1,6 @@ +#MicroCART GUI executable +MicroCART + # C++ objects and libs *.slo *.lo