diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index efd8b4493f17d81a21667565e04a2a56368217ff..dd1c27f0cf486c293540593a997b701ecd226def 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -282,6 +282,14 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) emit heartbeat(this); mavlink_heartbeat_t state; mavlink_msg_heartbeat_decode(&message, &state); + + // Send the base_mode and system_status values to the plotter. This uses the ground time + // so the Ground Time checkbox must be ticked for these values to display + quint64 time = getUnixTime(); + QString name = QString("M%1:HEARTBEAT.%2").arg(message.sysid); + emit valueChanged(uasId, name.arg("base_mode"), "none", state.base_mode, time); + emit valueChanged(uasId, name.arg("system_status"), "none", state.system_status, time); + // Set new type if it has changed if (this->type != state.type) { @@ -384,20 +392,9 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) GAudioOutput::instance()->stopEmergency(); GAudioOutput::instance()->say(audiostring.toLower()); } - - // if (state.system_status == MAV_STATE_POWEROFF) - // { - // emit systemRemoved(this); - // emit systemRemoved(); - // } } break; - // case MAVLINK_MSG_ID_NAMED_VALUE_FLOAT: - // case MAVLINK_MSG_ID_NAMED_VALUE_INT: - // // Receive named value message - // receiveMessageNamedValue(message); - // break; case MAVLINK_MSG_ID_SYS_STATUS: { if (multiComponentSourceDetected && wrongComponent) @@ -432,19 +429,19 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) stopLowBattAlarm(); } - // Trigger drop rate updates as needed. Here we convert the incoming - // drop_rate_comm value from 1/100 of a percent in a uint16 to a true - // percentage as a float. We also cap the incoming value at 100% as defined - // by the MAVLink specifications. - if (state.drop_rate_comm > 10000) - { - emit dropRateChanged(this->getUASID(), 100.0f); - } - else - { - emit dropRateChanged(this->getUASID(), state.drop_rate_comm/100.0f); - } - } + // Trigger drop rate updates as needed. Here we convert the incoming + // drop_rate_comm value from 1/100 of a percent in a uint16 to a true + // percentage as a float. We also cap the incoming value at 100% as defined + // by the MAVLink specifications. + if (state.drop_rate_comm > 10000) + { + emit dropRateChanged(this->getUASID(), 100.0f); + } + else + { + emit dropRateChanged(this->getUASID(), state.drop_rate_comm/100.0f); + } + } break; case MAVLINK_MSG_ID_ATTITUDE: { diff --git a/src/uas/UASInterface.h b/src/uas/UASInterface.h index 4162ba19b65bc31497888ceac84f7894d05eeab4..7197f28717238cf686f46795dbb192535ddb89d0 100644 --- a/src/uas/UASInterface.h +++ b/src/uas/UASInterface.h @@ -408,24 +408,22 @@ signals: void deactivated(); /** @brief The robot is manually controlled **/ void manualControl(); + /** @brief A value of the robot has changed. * * Typically this is used to send lowlevel information like the battery voltage to the plotting facilities of - * the groundstation + * the groundstation. The data here should be converted to human-readable values before being passed, so ideally + * SI units. * * @param uasId ID of this system * @param name name of the value, e.g. "battery voltage" + * @param unit The units this variable is in as an abbreviation. For system-dependent (such as raw ADC values) use "raw", for unitless values use "none". * @param value the value that changed * @param msec the timestamp of the message, in milliseconds */ - - //void valueChanged(const int uasId, const QString& name, const double value, const quint64 msec); void valueChanged(const int uasId, const QString& name, const QString& unit, const double value, const quint64 msec); void valueChanged(const int uasId, const QString& name, const QString& unit, const int value, const quint64 msec); -// void valueChanged(const int uasId, const QString& name, const double value, const quint64 msec); -// //void valueChanged(UASInterface* uas, QString name, double value, quint64 msec); - void voltageChanged(int uasId, double voltage); void waypointUpdated(int uasId, int id, double x, double y, double z, double yaw, bool autocontinue, bool active); void waypointSelected(int uasId, int id);