|
|
|
@ -158,42 +158,42 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
@@ -158,42 +158,42 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
|
|
|
|
|
if (state.status != this->status) |
|
|
|
|
{ |
|
|
|
|
statechanged = true; |
|
|
|
|
this->status = state.status; |
|
|
|
|
this->status = (int)state.status; |
|
|
|
|
getStatusForCode((int)state.status, uasState, stateDescription); |
|
|
|
|
emit statusChanged(this, uasState, stateDescription); |
|
|
|
|
stateAudio = " changed status to " + uasState; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (static_cast<unsigned int>(this->mode) != static_cast<unsigned int>(state.mode)) |
|
|
|
|
if (this->mode != static_cast<unsigned int>(state.mode)) |
|
|
|
|
{ |
|
|
|
|
modechanged = true; |
|
|
|
|
this->mode = state.mode; |
|
|
|
|
this->mode = static_cast<unsigned int>(state.mode); |
|
|
|
|
QString mode; |
|
|
|
|
|
|
|
|
|
switch ((unsigned int)(state.mode)) |
|
|
|
|
switch (state.mode) |
|
|
|
|
{ |
|
|
|
|
case MAV_MODE_LOCKED: |
|
|
|
|
case (uint8_t)MAV_MODE_LOCKED: |
|
|
|
|
mode = "LOCKED MODE"; |
|
|
|
|
break; |
|
|
|
|
case MAV_MODE_MANUAL: |
|
|
|
|
case (uint8_t)MAV_MODE_MANUAL: |
|
|
|
|
mode = "MANUAL MODE"; |
|
|
|
|
break; |
|
|
|
|
case MAV_MODE_AUTO: |
|
|
|
|
case (uint8_t)MAV_MODE_AUTO: |
|
|
|
|
mode = "AUTO MODE"; |
|
|
|
|
break; |
|
|
|
|
case MAV_MODE_GUIDED: |
|
|
|
|
case (uint8_t)MAV_MODE_GUIDED: |
|
|
|
|
mode = "GUIDED MODE"; |
|
|
|
|
break; |
|
|
|
|
case MAV_MODE_READY: |
|
|
|
|
case (uint8_t)MAV_MODE_READY: |
|
|
|
|
mode = "READY"; |
|
|
|
|
break; |
|
|
|
|
case MAV_MODE_TEST1: |
|
|
|
|
case (uint8_t)MAV_MODE_TEST1: |
|
|
|
|
mode = "TEST1 MODE"; |
|
|
|
|
break; |
|
|
|
|
case MAV_MODE_TEST2: |
|
|
|
|
case (uint8_t)MAV_MODE_TEST2: |
|
|
|
|
mode = "TEST2 MODE"; |
|
|
|
|
break; |
|
|
|
|
case MAV_MODE_TEST3: |
|
|
|
|
case (uint8_t)MAV_MODE_TEST3: |
|
|
|
|
mode = "TEST3 MODE"; |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
@ -454,13 +454,12 @@ quint64 UAS::getUnixTime(quint64 time)
@@ -454,13 +454,12 @@ quint64 UAS::getUnixTime(quint64 time)
|
|
|
|
|
|
|
|
|
|
void UAS::setMode(int mode) |
|
|
|
|
{ |
|
|
|
|
if (mode >= MAV_MODE_LOCKED && mode <= MAV_MODE_TEST3) |
|
|
|
|
if ((uint8_t)mode >= MAV_MODE_LOCKED && (uint8_t)mode <= MAV_MODE_TEST3) |
|
|
|
|
{ |
|
|
|
|
this->mode = mode; |
|
|
|
|
mavlink_message_t msg; |
|
|
|
|
mavlink_msg_set_mode_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, uasId, (unsigned char)mode); |
|
|
|
|
mavlink_msg_set_mode_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, (uint8_t)uasId, (uint8_t)mode); |
|
|
|
|
sendMessage(msg); |
|
|
|
|
qDebug() << "SENDING REQUEST TO SET MODE TO SYSTEM" << uasId << ", REQUEST TO SET MODE " << mode; |
|
|
|
|
qDebug() << "SENDING REQUEST TO SET MODE TO SYSTEM" << uasId << ", REQUEST TO SET MODE " << (uint8_t)mode; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -838,7 +837,7 @@ void UAS::launch()
@@ -838,7 +837,7 @@ void UAS::launch()
|
|
|
|
|
{ |
|
|
|
|
mavlink_message_t msg; |
|
|
|
|
// TODO Replace MG System ID with static function call and allow to change ID in GUI
|
|
|
|
|
mavlink_msg_action_pack(MG::SYSTEM::ID, MG::SYSTEM::COMPID, &msg, this->getUASID(),(int)MAV_ACTION_LAUNCH); |
|
|
|
|
mavlink_msg_action_pack(MG::SYSTEM::ID, MG::SYSTEM::COMPID, &msg, this->getUASID(),(uint8_t)MAV_ACTION_LAUNCH); |
|
|
|
|
// Send message twice to increase chance of reception
|
|
|
|
|
sendMessage(msg); |
|
|
|
|
sendMessage(msg); |
|
|
|
@ -852,7 +851,7 @@ void UAS::enable_motors()
@@ -852,7 +851,7 @@ void UAS::enable_motors()
|
|
|
|
|
{ |
|
|
|
|
mavlink_message_t msg; |
|
|
|
|
// TODO Replace MG System ID with static function call and allow to change ID in GUI
|
|
|
|
|
mavlink_msg_action_pack(MG::SYSTEM::ID, MG::SYSTEM::COMPID, &msg, this->getUASID(),(int)MAV_ACTION_MOTORS_START); |
|
|
|
|
mavlink_msg_action_pack(MG::SYSTEM::ID, MG::SYSTEM::COMPID, &msg, this->getUASID(),(uint8_t)MAV_ACTION_MOTORS_START); |
|
|
|
|
// Send message twice to increase chance of reception
|
|
|
|
|
sendMessage(msg); |
|
|
|
|
sendMessage(msg); |
|
|
|
@ -866,7 +865,7 @@ void UAS::disable_motors()
@@ -866,7 +865,7 @@ void UAS::disable_motors()
|
|
|
|
|
{ |
|
|
|
|
mavlink_message_t msg; |
|
|
|
|
// TODO Replace MG System ID with static function call and allow to change ID in GUI
|
|
|
|
|
mavlink_msg_action_pack(MG::SYSTEM::ID, MG::SYSTEM::COMPID, &msg, this->getUASID(),(int)MAV_ACTION_MOTORS_STOP); |
|
|
|
|
mavlink_msg_action_pack(MG::SYSTEM::ID, MG::SYSTEM::COMPID, &msg, this->getUASID(),(uint8_t)MAV_ACTION_MOTORS_STOP); |
|
|
|
|
// Send message twice to increase chance of reception
|
|
|
|
|
sendMessage(msg); |
|
|
|
|
sendMessage(msg); |
|
|
|
@ -884,7 +883,7 @@ void UAS::setManualControlCommands(double roll, double pitch, double yaw, double
@@ -884,7 +883,7 @@ void UAS::setManualControlCommands(double roll, double pitch, double yaw, double
|
|
|
|
|
manualYawAngle = yaw * yawScaling; |
|
|
|
|
manualThrust = thrust * thrustScaling; |
|
|
|
|
|
|
|
|
|
if(mode == MAV_MODE_MANUAL) |
|
|
|
|
if(mode == (int)MAV_MODE_MANUAL) |
|
|
|
|
{ |
|
|
|
|
mavlink_message_t message; |
|
|
|
|
mavlink_msg_manual_control_pack(MG::SYSTEM::ID, MG::SYSTEM::COMPID, &message, this->uasId, (float)manualRollAngle, (float)manualPitchAngle, (float)manualYawAngle, (float)manualThrust, controlRollManual, controlPitchManual, controlYawManual, controlThrustManual); |
|
|
|
|