Browse Source

New virtual for APM style mission support

QGC4.4
Don Gagne 9 years ago
parent
commit
9866b60391
  1. 6
      src/FirmwarePlugin/APM/APMFirmwarePlugin.cc
  2. 3
      src/FirmwarePlugin/APM/APMFirmwarePlugin.h
  3. 8
      src/FirmwarePlugin/FirmwarePlugin.h
  4. 8
      src/FirmwarePlugin/Generic/GenericFirmwarePlugin.cc
  5. 1
      src/FirmwarePlugin/Generic/GenericFirmwarePlugin.h
  6. 7
      src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc
  7. 1
      src/FirmwarePlugin/PX4/PX4FirmwarePlugin.h

6
src/FirmwarePlugin/APM/APMFirmwarePlugin.cc

@ -378,3 +378,9 @@ void APMFirmwarePlugin::setSupportedModes(QList<APMCustomMode> supportedModes) @@ -378,3 +378,9 @@ void APMFirmwarePlugin::setSupportedModes(QList<APMCustomMode> supportedModes)
{
_supportedModes = supportedModes;
}
bool APMFirmwarePlugin::sendHomePositionToVehicle(void)
{
// APM stack wants the home position sent in the first position
return true;
}

3
src/FirmwarePlugin/APM/APMFirmwarePlugin.h

@ -87,7 +87,8 @@ public: @@ -87,7 +87,8 @@ public:
virtual int manualControlReservedButtonCount(void);
virtual void adjustMavlinkMessage(mavlink_message_t* message);
virtual void initializeVehicle(Vehicle* vehicle);
virtual bool sendHomePositionToVehicle(void);
protected:
/// All access to singleton is through stack specific implementation
APMFirmwarePlugin(QObject* parent = NULL);

8
src/FirmwarePlugin/FirmwarePlugin.h

@ -96,6 +96,14 @@ public: @@ -96,6 +96,14 @@ public:
/// Called when Vehicle is first created to send any necessary mavlink messages to the firmware.
virtual void initializeVehicle(Vehicle* vehicle) = 0;
/// Determines how to handle the first item of the mission item list. Internally to QGC the first item
/// is always the home position.
/// @return
/// true: Send first mission item as home position to vehicle. When vehicle has no mission items on
/// it, it may or may not return a home position back in position 0.
/// false: Do not send first item to vehicle, sequence numbers must be adjusted
virtual bool sendHomePositionToVehicle(void) = 0;
protected:
FirmwarePlugin(QObject* parent = NULL) : QGCSingleton(parent) { }

8
src/FirmwarePlugin/Generic/GenericFirmwarePlugin.cc

@ -110,3 +110,11 @@ void GenericFirmwarePlugin::initializeVehicle(Vehicle* vehicle) @@ -110,3 +110,11 @@ void GenericFirmwarePlugin::initializeVehicle(Vehicle* vehicle)
// Generic Flight Stack is by definition "generic", so no extra work
}
bool GenericFirmwarePlugin::sendHomePositionToVehicle(void)
{
// Generic stack does not want home position sent in the first position.
// Subsequent sequence numbers must be adjusted.
// This is the mavlink spec default.
return false;
}

1
src/FirmwarePlugin/Generic/GenericFirmwarePlugin.h

@ -46,6 +46,7 @@ public: @@ -46,6 +46,7 @@ public:
virtual int manualControlReservedButtonCount(void);
virtual void adjustMavlinkMessage(mavlink_message_t* message);
virtual void initializeVehicle(Vehicle* vehicle);
virtual bool sendHomePositionToVehicle(void);
private:
/// All access to singleton is through AutoPilotPluginManager::instance

7
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc

@ -200,3 +200,10 @@ void PX4FirmwarePlugin::initializeVehicle(Vehicle* vehicle) @@ -200,3 +200,10 @@ void PX4FirmwarePlugin::initializeVehicle(Vehicle* vehicle)
// PX4 Flight Stack doesn't need to do any extra work
}
bool PX4FirmwarePlugin::sendHomePositionToVehicle(void)
{
// PX4 stack does not want home position sent in the first position.
// Subsequent sequence numbers must be adjusted.
return false;
}

1
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.h

@ -46,6 +46,7 @@ public: @@ -46,6 +46,7 @@ public:
virtual int manualControlReservedButtonCount(void);
virtual void adjustMavlinkMessage(mavlink_message_t* message);
virtual void initializeVehicle(Vehicle* vehicle);
virtual bool sendHomePositionToVehicle(void);
private:
/// All access to singleton is through AutoPilotPluginManager::instance

Loading…
Cancel
Save