Skip to content

Commit

Permalink
Vehicle, qgroundcontrol.pro/qrc: Add support for EFI, and Generator f…
Browse files Browse the repository at this point in the history
…actGroups
  • Loading branch information
Davidsastresas committed Nov 16, 2023
1 parent 2f9b78d commit 879dbd8
Show file tree
Hide file tree
Showing 10 changed files with 614 additions and 0 deletions.
4 changes: 4 additions & 0 deletions qgroundcontrol.pro
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,8 @@ HEADERS += \
src/Vehicle/VehicleVibrationFactGroup.h \
src/Vehicle/VehicleWindFactGroup.h \
src/Vehicle/VehicleHygrometerFactGroup.h \
src/Vehicle/VehicleGeneratorFactGroup.h \
src/Vehicle/VehicleEFIFactGroup.h \
src/VehicleSetup/JoystickConfigController.h \
src/comm/LinkConfiguration.h \
src/comm/LinkInterface.h \
Expand Down Expand Up @@ -1000,6 +1002,8 @@ SOURCES += \
src/Vehicle/VehicleTemperatureFactGroup.cc \
src/Vehicle/VehicleVibrationFactGroup.cc \
src/Vehicle/VehicleHygrometerFactGroup.cc \
src/Vehicle/VehicleGeneratorFactGroup.cc \
src/Vehicle/VehicleEFIFactGroup.cc \
src/Vehicle/VehicleWindFactGroup.cc \
src/VehicleSetup/JoystickConfigController.cc \
src/comm/LinkConfiguration.cc \
Expand Down
2 changes: 2 additions & 0 deletions qgroundcontrol.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,8 @@
<file alias="Vehicle/VibrationFact.json">src/Vehicle/VibrationFact.json</file>
<file alias="Vehicle/WindFact.json">src/Vehicle/WindFact.json</file>
<file alias="Vehicle/HygrometerFact.json">src/Vehicle/HygrometerFact.json</file>
<file alias="Vehicle/GeneratorFact.json">src/Vehicle/GeneratorFact.json</file>
<file alias="Vehicle/EFIFact.json">src/Vehicle/EFIFact.json</file>
<file alias="Video.SettingsGroup.json">src/Settings/Video.SettingsGroup.json</file>
<file alias="VTOLLandingPattern.FactMetaData.json">src/MissionManager/VTOLLandingPattern.FactMetaData.json</file>
</qresource>
Expand Down
122 changes: 122 additions & 0 deletions src/Vehicle/EFIFact.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"version": 1,
"fileType": "FactMetaData",
"QGC.MetaData.Facts":
[
{
"name": "health",
"shortDesc": "Health",
"type": "int8"
},
{
"name": "ecuIndex",
"shortDesc": "Ecu Index",
"type": "float",
"decimalPlaces": 1,
"units": "A"
},
{
"name": "rpm",
"shortDesc": "Rpm",
"type": "float",
"decimalPlaces": 1
},
{
"name": "fuelConsumed",
"shortDesc": "Fuel Consumed",
"type": "float",
"decimalPlaces": 1,
"units": "cm^3"
},
{
"name": "fuelFlow",
"shortDesc": "Fuel Flow",
"type": "float",
"decimalPlaces": 1,
"units": "cm^3/min"
},
{
"name": "engineLoad",
"shortDesc": "Engine Load",
"type": "float",
"decimalPlaces": 1,
"units": "%"
},
{
"name": "throttlePos",
"shortDesc": "Throttle Position",
"type": "float",
"decimalPlaces": 1,
"units": "%"
},
{
"name": "sparkTime",
"shortDesc": "Spark dwell time",
"type": "float",
"decimalPlaces": 1,
"units": "ms"
},
{
"name": "baroPress",
"shortDesc": "BarometricPressure",
"type": "float",
"decimalPlaces": 1,
"units": "kPa"
},
{
"name": "intakePress",
"shortDesc": "Intake mainfold pressure",
"type": "float",
"decimalPlaces": 1,
"units": "kPa"
},
{
"name": "intakeTemp",
"shortDesc": "Intake mainfold temperature",
"type": "float",
"decimalPlaces": 1,
"units": "°C"
},
{
"name": "cylinderTemp",
"shortDesc": "Cylinder head temperature",
"type": "float",
"decimalPlaces": 1,
"units": "°C"
},
{
"name": "ignTime",
"shortDesc": "Ignition Timing",
"type": "float",
"decimalPlaces": 1,
"units": "deg"
},
{
"name": "injTime",
"shortDesc": "Injection Time",
"type": "float",
"decimalPlaces": 1,
"units": "ms"
},
{
"name": "exGasTemp",
"shortDesc": "Exhaust gas Temperature",
"type": "float",
"decimalPlaces": 1,
"units": "°C"
},
{
"name": "throttleOut",
"shortDesc": "Throttle Out",
"type": "float",
"decimalPlaces": 1,
"units": "%"
},
{
"name": "ptComp",
"shortDesc": "Pt Compensation",
"type": "float",
"decimalPlaces": 1
}
]
}
77 changes: 77 additions & 0 deletions src/Vehicle/GeneratorFact.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"version": 1,
"fileType": "FactMetaData",
"QGC.MetaData.Facts":
[
{
"name": "status",
"shortDesc": "Status",
"type": "uint64"
},
{
"name": "genSpeed",
"shortDesc": "Generator Speed",
"type": "uint16",
"units": "rpm"
},
{
"name": "batteryCurrent",
"shortDesc": "Battery Current",
"type": "float",
"decimalPlaces": 1,
"units": "A"
},
{
"name": "loadCurrent",
"shortDesc": "Load Current",
"type": "float",
"decimalPlaces": 1,
"units": "A"
},
{
"name": "powerGenerated",
"shortDesc": "Power Generated",
"type": "float",
"decimalPlaces": 1,
"units": "W"
},
{
"name": "busVoltage",
"shortDesc": "Bus Voltage",
"type": "float",
"decimalPlaces": 1,
"units": "V"
},
{
"name": "rectifierTemp",
"shortDesc": "Rectifier Temperature",
"type": "int16",
"units": "°C"
},
{
"name": "batCurrentSetpoint",
"shortDesc": "Battery Current Setpoint",
"type": "float",
"decimalPlaces": 1,
"units": "A"
},
{
"name": "genTemp",
"shortDesc": "Generator Temperature",
"type": "int16",
"units": "°C"
},
{
"name": "runtime",
"shortDesc": "runtime",
"type": "uint32",
"units": "sec"
},
{
"name": "timeMaintenance",
"shortDesc": "Time until Maintenance",
"type": "int32",
"units": "sec"
}
]
}
6 changes: 6 additions & 0 deletions src/Vehicle/Vehicle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ const char* Vehicle::_escStatusFactGroupName = "escStatus";
const char* Vehicle::_estimatorStatusFactGroupName = "estimatorStatus";
const char* Vehicle::_terrainFactGroupName = "terrain";
const char* Vehicle::_hygrometerFactGroupName = "hygrometer";
const char* Vehicle::_generatorFactGroupName = "generator";
const char* Vehicle::_efiFactGroupName = "efi";

// Standard connected vehicle
Vehicle::Vehicle(LinkInterface* link,
Expand Down Expand Up @@ -174,6 +176,8 @@ Vehicle::Vehicle(LinkInterface* link,
, _escStatusFactGroup (this)
, _estimatorStatusFactGroup (this)
, _hygrometerFactGroup (this)
, _generatorFactGroup (this)
, _efiFactGroup (this)
, _terrainFactGroup (this)
, _terrainProtocolHandler (new TerrainProtocolHandler(this, &_terrainFactGroup, this))
{
Expand Down Expand Up @@ -455,6 +459,8 @@ void Vehicle::_commonInit()
_addFactGroup(&_escStatusFactGroup, _escStatusFactGroupName);
_addFactGroup(&_estimatorStatusFactGroup, _estimatorStatusFactGroupName);
_addFactGroup(&_hygrometerFactGroup, _hygrometerFactGroupName);
_addFactGroup(&_generatorFactGroup, _generatorFactGroupName);
_addFactGroup(&_efiFactGroup, _efiFactGroupName);
_addFactGroup(&_terrainFactGroup, _terrainFactGroupName);

// Add firmware-specific fact groups, if provided
Expand Down
10 changes: 10 additions & 0 deletions src/Vehicle/Vehicle.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
#include "HealthAndArmingCheckReport.h"
#include "TerrainQuery.h"
#include "StandardModes.h"
#include "VehicleGeneratorFactGroup.h"
#include "VehicleEFIFactGroup.h"

class Actuators;
class EventHandler;
Expand Down Expand Up @@ -322,6 +324,8 @@ class Vehicle : public FactGroup
Q_PROPERTY(FactGroup* localPosition READ localPositionFactGroup CONSTANT)
Q_PROPERTY(FactGroup* localPositionSetpoint READ localPositionSetpointFactGroup CONSTANT)
Q_PROPERTY(FactGroup* hygrometer READ hygrometerFactGroup CONSTANT)
Q_PROPERTY(FactGroup* generator READ generatorFactGroup CONSTANT)
Q_PROPERTY(FactGroup* efi READ efiFactGroup CONSTANT)
Q_PROPERTY(QmlObjectListModel* batteries READ batteries CONSTANT)
Q_PROPERTY(Actuators* actuators READ actuators CONSTANT)
Q_PROPERTY(HealthAndArmingCheckReport* healthAndArmingCheckReport READ healthAndArmingCheckReport CONSTANT)
Expand Down Expand Up @@ -713,6 +717,8 @@ class Vehicle : public FactGroup
FactGroup* estimatorStatusFactGroup () { return &_estimatorStatusFactGroup; }
FactGroup* terrainFactGroup () { return &_terrainFactGroup; }
FactGroup* hygrometerFactGroup () { return &_hygrometerFactGroup; }
FactGroup* generatorFactGroup () { return &_generatorFactGroup; }
FactGroup* efiFactGroup () { return &_efiFactGroup; }
QmlObjectListModel* batteries () { return &_batteryFactGroupListModel; }

MissionManager* missionManager () { return _missionManager; }
Expand Down Expand Up @@ -1417,6 +1423,8 @@ private slots:
VehicleEscStatusFactGroup _escStatusFactGroup;
VehicleEstimatorStatusFactGroup _estimatorStatusFactGroup;
VehicleHygrometerFactGroup _hygrometerFactGroup;
VehicleGeneratorFactGroup _generatorFactGroup;
VehicleEFIFactGroup _efiFactGroup;
TerrainFactGroup _terrainFactGroup;
QmlObjectListModel _batteryFactGroupListModel;

Expand Down Expand Up @@ -1474,6 +1482,8 @@ private slots:
static const char* _escStatusFactGroupName;
static const char* _estimatorStatusFactGroupName;
static const char* _hygrometerFactGroupName;
static const char* _generatorFactGroupName;
static const char* _efiFactGroupName;
static const char* _terrainFactGroupName;

static const int _vehicleUIUpdateRateMSecs = 100;
Expand Down
Loading

0 comments on commit 879dbd8

Please sign in to comment.