Unverified Commit 5c23f138 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #5884 from bluerobotics/pr-input-hold-indicator

Add input hold and rangefinder indicators for Sub vehicles
parents 6ae0542c 236dcbd8
...@@ -215,6 +215,8 @@ void ArduSubFirmwarePlugin::_handleNamedValueFloat(mavlink_message_t* message) ...@@ -215,6 +215,8 @@ void ArduSubFirmwarePlugin::_handleNamedValueFloat(mavlink_message_t* message)
_infoFactGroup.getFact("lights 2")->setRawValue(value.value * 100); _infoFactGroup.getFact("lights 2")->setRawValue(value.value * 100);
} else if (name == "PilotGain") { } else if (name == "PilotGain") {
_infoFactGroup.getFact("pilot gain")->setRawValue(value.value * 100); _infoFactGroup.getFact("pilot gain")->setRawValue(value.value * 100);
} else if (name == "InputHold") {
_infoFactGroup.getFact("input hold")->setRawValue(value.value);
} }
} }
...@@ -223,6 +225,14 @@ void ArduSubFirmwarePlugin::_handleMavlinkMessage(mavlink_message_t* message) ...@@ -223,6 +225,14 @@ void ArduSubFirmwarePlugin::_handleMavlinkMessage(mavlink_message_t* message)
switch (message->msgid) { switch (message->msgid) {
case (MAVLINK_MSG_ID_NAMED_VALUE_FLOAT): case (MAVLINK_MSG_ID_NAMED_VALUE_FLOAT):
_handleNamedValueFloat(message); _handleNamedValueFloat(message);
break;
case (MAVLINK_MSG_ID_RANGEFINDER):
{
mavlink_rangefinder_t msg;
mavlink_msg_rangefinder_decode(message, &msg);
_infoFactGroup.getFact("rangefinder distance")->setRawValue(msg.distance);
break;
}
} }
} }
...@@ -236,32 +246,41 @@ QMap<QString, FactGroup*>* ArduSubFirmwarePlugin::factGroups(void) { ...@@ -236,32 +246,41 @@ QMap<QString, FactGroup*>* ArduSubFirmwarePlugin::factGroups(void) {
return &_nameToFactGroupMap; return &_nameToFactGroupMap;
} }
const char* APMSubmarineFactGroup::_camTiltFactName = "camera tilt"; const char* APMSubmarineFactGroup::_camTiltFactName = "camera tilt";
const char* APMSubmarineFactGroup::_tetherTurnsFactName = "tether turns"; const char* APMSubmarineFactGroup::_tetherTurnsFactName = "tether turns";
const char* APMSubmarineFactGroup::_lightsLevel1FactName = "lights 1"; const char* APMSubmarineFactGroup::_lightsLevel1FactName = "lights 1";
const char* APMSubmarineFactGroup::_lightsLevel2FactName = "lights 2"; const char* APMSubmarineFactGroup::_lightsLevel2FactName = "lights 2";
const char* APMSubmarineFactGroup::_pilotGainFactName = "pilot gain"; const char* APMSubmarineFactGroup::_pilotGainFactName = "pilot gain";
const char* APMSubmarineFactGroup::_inputHoldFactName = "input hold";
const char* APMSubmarineFactGroup::_rangefinderDistanceFactName = "rangefinder distance";
APMSubmarineFactGroup::APMSubmarineFactGroup(QObject* parent) APMSubmarineFactGroup::APMSubmarineFactGroup(QObject* parent)
: FactGroup(300, ":/json/Vehicle/SubmarineFact.json", parent) : FactGroup(300, ":/json/Vehicle/SubmarineFact.json", parent)
, _camTiltFact (0, _camTiltFactName, FactMetaData::valueTypeDouble) , _camTiltFact (0, _camTiltFactName, FactMetaData::valueTypeDouble)
, _tetherTurnsFact (0, _tetherTurnsFactName, FactMetaData::valueTypeDouble) , _tetherTurnsFact (0, _tetherTurnsFactName, FactMetaData::valueTypeDouble)
, _lightsLevel1Fact (0, _lightsLevel1FactName, FactMetaData::valueTypeDouble) , _lightsLevel1Fact (0, _lightsLevel1FactName, FactMetaData::valueTypeDouble)
, _lightsLevel2Fact (0, _lightsLevel2FactName, FactMetaData::valueTypeDouble) , _lightsLevel2Fact (0, _lightsLevel2FactName, FactMetaData::valueTypeDouble)
, _pilotGainFact (0, _pilotGainFactName, FactMetaData::valueTypeDouble) , _pilotGainFact (0, _pilotGainFactName, FactMetaData::valueTypeDouble)
, _inputHoldFact (0, _inputHoldFactName, FactMetaData::valueTypeDouble)
, _rangefinderDistanceFact (0, _rangefinderDistanceFactName, FactMetaData::valueTypeDouble)
{ {
_addFact(&_camTiltFact, _camTiltFactName); _addFact(&_camTiltFact, _camTiltFactName);
_addFact(&_tetherTurnsFact, _tetherTurnsFactName); _addFact(&_tetherTurnsFact, _tetherTurnsFactName);
_addFact(&_lightsLevel1Fact, _lightsLevel1FactName); _addFact(&_lightsLevel1Fact, _lightsLevel1FactName);
_addFact(&_lightsLevel2Fact, _lightsLevel2FactName); _addFact(&_lightsLevel2Fact, _lightsLevel2FactName);
_addFact(&_pilotGainFact, _pilotGainFactName); _addFact(&_pilotGainFact, _pilotGainFactName);
_addFact(&_inputHoldFact, _inputHoldFactName);
_addFact(&_rangefinderDistanceFact, _rangefinderDistanceFactName);
// Start out as not available "--.--" // Start out as not available "--.--"
_camTiltFact.setRawValue (std::numeric_limits<float>::quiet_NaN()); _camTiltFact.setRawValue (std::numeric_limits<float>::quiet_NaN());
_tetherTurnsFact.setRawValue (std::numeric_limits<float>::quiet_NaN()); _tetherTurnsFact.setRawValue (std::numeric_limits<float>::quiet_NaN());
_lightsLevel1Fact.setRawValue (std::numeric_limits<float>::quiet_NaN()); _lightsLevel1Fact.setRawValue (std::numeric_limits<float>::quiet_NaN());
_lightsLevel2Fact.setRawValue (std::numeric_limits<float>::quiet_NaN()); _lightsLevel2Fact.setRawValue (std::numeric_limits<float>::quiet_NaN());
_pilotGainFact.setRawValue (std::numeric_limits<float>::quiet_NaN()); _pilotGainFact.setRawValue (std::numeric_limits<float>::quiet_NaN());
_inputHoldFact.setRawValue (std::numeric_limits<float>::quiet_NaN());
_rangefinderDistanceFact.setRawValue (std::numeric_limits<float>::quiet_NaN());
} }
QString ArduSubFirmwarePlugin::vehicleImageOpaque(const Vehicle* vehicle) const QString ArduSubFirmwarePlugin::vehicleImageOpaque(const Vehicle* vehicle) const
......
...@@ -35,23 +35,29 @@ class APMSubmarineFactGroup : public FactGroup ...@@ -35,23 +35,29 @@ class APMSubmarineFactGroup : public FactGroup
public: public:
APMSubmarineFactGroup(QObject* parent = NULL); APMSubmarineFactGroup(QObject* parent = NULL);
Q_PROPERTY(Fact* camTilt READ camTilt CONSTANT) Q_PROPERTY(Fact* camTilt READ camTilt CONSTANT)
Q_PROPERTY(Fact* tetherTurns READ tetherTurns CONSTANT) Q_PROPERTY(Fact* tetherTurns READ tetherTurns CONSTANT)
Q_PROPERTY(Fact* lightsLevel1 READ lightsLevel1 CONSTANT) Q_PROPERTY(Fact* lightsLevel1 READ lightsLevel1 CONSTANT)
Q_PROPERTY(Fact* lightsLevel2 READ lightsLevel2 CONSTANT) Q_PROPERTY(Fact* lightsLevel2 READ lightsLevel2 CONSTANT)
Q_PROPERTY(Fact* pilotGain READ pilotGain CONSTANT) Q_PROPERTY(Fact* pilotGain READ pilotGain CONSTANT)
Q_PROPERTY(Fact* inputHold READ inputHold CONSTANT)
Fact* camTilt (void) { return &_camTiltFact; } Q_PROPERTY(Fact* rangefinderDistance READ rangefinderDistance CONSTANT)
Fact* tetherTurns (void) { return &_tetherTurnsFact; }
Fact* lightsLevel1 (void) { return &_lightsLevel1Fact; } Fact* camTilt (void) { return &_camTiltFact; }
Fact* lightsLevel2 (void) { return &_lightsLevel2Fact; } Fact* tetherTurns (void) { return &_tetherTurnsFact; }
Fact* pilotGain (void) { return &_pilotGainFact; } Fact* lightsLevel1 (void) { return &_lightsLevel1Fact; }
Fact* lightsLevel2 (void) { return &_lightsLevel2Fact; }
Fact* pilotGain (void) { return &_pilotGainFact; }
Fact* inputHold (void) { return &_inputHoldFact; }
Fact* rangefinderDistance (void) { return &_rangefinderDistanceFact; }
static const char* _camTiltFactName; static const char* _camTiltFactName;
static const char* _tetherTurnsFactName; static const char* _tetherTurnsFactName;
static const char* _lightsLevel1FactName; static const char* _lightsLevel1FactName;
static const char* _lightsLevel2FactName; static const char* _lightsLevel2FactName;
static const char* _pilotGainFactName; static const char* _pilotGainFactName;
static const char* _inputHoldFactName;
static const char* _rangefinderDistanceFactName;
static const char* _settingsGroup; static const char* _settingsGroup;
...@@ -61,6 +67,8 @@ private: ...@@ -61,6 +67,8 @@ private:
Fact _lightsLevel1Fact; Fact _lightsLevel1Fact;
Fact _lightsLevel2Fact; Fact _lightsLevel2Fact;
Fact _pilotGainFact; Fact _pilotGainFact;
Fact _inputHoldFact;
Fact _rangefinderDistanceFact;
}; };
class APMSubMode : public APMCustomMode class APMSubMode : public APMCustomMode
......
...@@ -28,5 +28,18 @@ ...@@ -28,5 +28,18 @@
"shortDescription": "Pilot Gain", "shortDescription": "Pilot Gain",
"type": "int16", "type": "int16",
"units": "%" "units": "%"
},
{
"name": "input hold",
"shortDescription": "Input Hold",
"type": "int16",
"enumStrings": "Disabled,Enabled",
"enumValues": "0,1"
},
{ "name": "rangefinder distance",
"shortDescription": "Rangefinder",
"type": "float",
"decimalPlaces": 2,
"units": "meters"
} }
] ]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment