Browse Source

Updating MAVLink camera/video commands.

QGC4.4
Gus Grubba 8 years ago
parent
commit
644f6c8394
  1. 2
      libs/mavlink/include/mavlink/v2.0
  2. 54
      src/MissionManager/CameraSection.cc
  3. 34
      src/MissionManager/CameraSectionTest.cc
  4. 27
      src/MissionManager/MavCmdInfoCommon.json
  5. 6
      src/MissionManager/MissionManager.cc
  6. 4
      src/MissionManager/SurveyMissionItem.cc
  7. 8
      src/QmlControls/MavlinkQmlSingleton.h
  8. 3
      src/comm/MockLink.cc

2
libs/mavlink/include/mavlink/v2.0

@ -1 +1 @@ @@ -1 +1 @@
Subproject commit 2faa6d49834aa203e2a3eeeeed588728fb14c431
Subproject commit 6bbc8a51d8f37537732d3f5170093d49e64c6f4b

54
src/MissionManager/CameraSection.cc

@ -121,7 +121,8 @@ void CameraSection::appendSectionItems(QList<MissionItem*>& items, QObject* miss @@ -121,7 +121,8 @@ void CameraSection::appendSectionItems(QList<MissionItem*>& items, QObject* miss
MAV_FRAME_MISSION,
0, // camera id, all cameras
_cameraModeFact.rawValue().toDouble(),
NAN, NAN, NAN, NAN, NAN, // param 3-7 unused
NAN, // Audio off/on
NAN, NAN, NAN, NAN, // param 4-7 reserved
true, // autoContinue
false, // isCurrentItem
missionItemParent);
@ -154,9 +155,7 @@ void CameraSection::appendSectionItems(QList<MissionItem*>& items, QObject* miss @@ -154,9 +155,7 @@ void CameraSection::appendSectionItems(QList<MissionItem*>& items, QObject* miss
0, // Camera ID, all cameras
_cameraPhotoIntervalTimeFact.rawValue().toInt(), // Interval
0, // Unlimited photo count
-1, // Max horizontal resolution
-1, // Max vertical resolution
0, 0, // param 6-7 not used
NAN, NAN, NAN, NAN, // param 4-7 reserved
true, // autoContinue
false, // isCurrentItem
missionItemParent);
@ -178,11 +177,8 @@ void CameraSection::appendSectionItems(QList<MissionItem*>& items, QObject* miss @@ -178,11 +177,8 @@ void CameraSection::appendSectionItems(QList<MissionItem*>& items, QObject* miss
MAV_CMD_VIDEO_START_CAPTURE,
MAV_FRAME_MISSION,
0, // camera id = 0, all cameras
-1, // Max FPS
-1, // Max horizontal resolution
-1, // Max vertical resolution
0, // Np CAMERA_CAPTURE_STATUS streaming
0, 0, // param 6-7 not used
0, // No CAMERA_CAPTURE_STATUS streaming
NAN, NAN, NAN, NAN, NAN, // param 3-7 reserved
true, // autoContinue
false, // isCurrentItem
missionItemParent);
@ -192,10 +188,10 @@ void CameraSection::appendSectionItems(QList<MissionItem*>& items, QObject* miss @@ -192,10 +188,10 @@ void CameraSection::appendSectionItems(QList<MissionItem*>& items, QObject* miss
item = new MissionItem(nextSequenceNumber++,
MAV_CMD_VIDEO_STOP_CAPTURE,
MAV_FRAME_MISSION,
0, // Camera ID, all cameras
0, 0, 0, 0, 0, 0, // param 2-7 not used
true, // autoContinue
false, // isCurrentItem
0, // Camera ID, all cameras
NAN, NAN, NAN, NAN, NAN, NAN, // param 2-7 reserved
true, // autoContinue
false, // isCurrentItem
missionItemParent);
break;
@ -212,10 +208,10 @@ void CameraSection::appendSectionItems(QList<MissionItem*>& items, QObject* miss @@ -212,10 +208,10 @@ void CameraSection::appendSectionItems(QList<MissionItem*>& items, QObject* miss
item = new MissionItem(nextSequenceNumber++,
MAV_CMD_IMAGE_STOP_CAPTURE,
MAV_FRAME_MISSION,
0, // camera id, all cameras
0, 0, 0, 0, 0, 0, // param 2-7 not used
true, // autoContinue
false, // isCurrentItem
0, // camera id, all cameras
NAN, NAN, NAN, NAN, NAN, NAN, // param 2-7 reserved
true, // autoContinue
false, // isCurrentItem
missionItemParent);
break;
@ -223,14 +219,12 @@ void CameraSection::appendSectionItems(QList<MissionItem*>& items, QObject* miss @@ -223,14 +219,12 @@ void CameraSection::appendSectionItems(QList<MissionItem*>& items, QObject* miss
item = new MissionItem(nextSequenceNumber++,
MAV_CMD_IMAGE_START_CAPTURE,
MAV_FRAME_MISSION,
0, // camera id = 0, all cameras
0, // Interval (none)
1, // Take 1 photo
-1, // Max horizontal resolution
-1, // Max vertical resolution
0, 0, // param 6-7 not used
true, // autoContinue
false, // isCurrentItem
0, // camera id = 0, all cameras
0, // Interval (none)
1, // Take 1 photo
NAN, NAN, NAN, NAN, // param 4-7 reserved
true, // autoContinue
false, // isCurrentItem
missionItemParent);
break;
}
@ -265,7 +259,7 @@ bool CameraSection::_scanTakePhoto(QmlObjectListModel* visualItems, int scanInde @@ -265,7 +259,7 @@ bool CameraSection::_scanTakePhoto(QmlObjectListModel* visualItems, int scanInde
if (item) {
MissionItem& missionItem = item->missionItem();
if ((MAV_CMD)item->command() == MAV_CMD_IMAGE_START_CAPTURE) {
if (missionItem.param1() == 0 && missionItem.param2() == 0 && missionItem.param3() == 1 && missionItem.param4() == -1 && missionItem.param5() == -1 && missionItem.param6() == 0 && missionItem.param7() == 0) {
if (missionItem.param1() == 0 && missionItem.param2() == 0 && missionItem.param3() == 1) {
cameraAction()->setRawValue(TakePhoto);
visualItems->removeAt(scanIndex)->deleteLater();
return true;
@ -282,7 +276,7 @@ bool CameraSection::_scanTakePhotosIntervalTime(QmlObjectListModel* visualItems, @@ -282,7 +276,7 @@ bool CameraSection::_scanTakePhotosIntervalTime(QmlObjectListModel* visualItems,
if (item) {
MissionItem& missionItem = item->missionItem();
if ((MAV_CMD)item->command() == MAV_CMD_IMAGE_START_CAPTURE) {
if (missionItem.param1() == 0 && missionItem.param2() >= 1 && missionItem.param3() == 0 && missionItem.param4() == -1 && missionItem.param5() == -1 && missionItem.param6() == 0 && missionItem.param7() == 0) {
if (missionItem.param1() == 0 && missionItem.param2() >= 1 && missionItem.param3() == 0) {
cameraAction()->setRawValue(TakePhotosIntervalTime);
cameraPhotoIntervalTime()->setRawValue(missionItem.param2());
visualItems->removeAt(scanIndex)->deleteLater();
@ -305,7 +299,7 @@ bool CameraSection::_scanStopTakingPhotos(QmlObjectListModel* visualItems, int s @@ -305,7 +299,7 @@ bool CameraSection::_scanStopTakingPhotos(QmlObjectListModel* visualItems, int s
SimpleMissionItem* nextItem = visualItems->value<SimpleMissionItem*>(scanIndex + 1);
if (nextItem) {
MissionItem& nextMissionItem = nextItem->missionItem();
if (nextMissionItem.command() == MAV_CMD_IMAGE_STOP_CAPTURE && nextMissionItem.param1() == 0 && nextMissionItem.param2() == 0 && nextMissionItem.param3() == 0 && nextMissionItem.param4() == 0 && nextMissionItem.param5() == 0 && nextMissionItem.param6() == 0 && nextMissionItem.param7() == 0) {
if (nextMissionItem.command() == MAV_CMD_IMAGE_STOP_CAPTURE && nextMissionItem.param1() == 0) {
cameraAction()->setRawValue(StopTakingPhotos);
visualItems->removeAt(scanIndex)->deleteLater();
visualItems->removeAt(scanIndex)->deleteLater();
@ -344,7 +338,7 @@ bool CameraSection::_scanTakeVideo(QmlObjectListModel* visualItems, int scanInde @@ -344,7 +338,7 @@ bool CameraSection::_scanTakeVideo(QmlObjectListModel* visualItems, int scanInde
if (item) {
MissionItem& missionItem = item->missionItem();
if ((MAV_CMD)item->command() == MAV_CMD_VIDEO_START_CAPTURE) {
if (missionItem.param1() == 0 && missionItem.param2() == -1 && missionItem.param3() == -1 && missionItem.param4() == -1 && missionItem.param5() == 0 && missionItem.param6() == 0 && missionItem.param7() == 0) {
if (missionItem.param1() == 0 && missionItem.param2() == 0) {
cameraAction()->setRawValue(TakeVideo);
visualItems->removeAt(scanIndex)->deleteLater();
return true;
@ -361,7 +355,7 @@ bool CameraSection::_scanStopTakingVideo(QmlObjectListModel* visualItems, int sc @@ -361,7 +355,7 @@ bool CameraSection::_scanStopTakingVideo(QmlObjectListModel* visualItems, int sc
if (item) {
MissionItem& missionItem = item->missionItem();
if ((MAV_CMD)item->command() == MAV_CMD_VIDEO_STOP_CAPTURE) {
if (missionItem.param1() == 0 && missionItem.param2() == 0 && missionItem.param3() == 0 && missionItem.param4() == 0 && missionItem.param5() == 0 && missionItem.param6() == 0 && missionItem.param7() == 0) {
if (missionItem.param1() == 0) {
cameraAction()->setRawValue(StopTakingVideo);
visualItems->removeAt(scanIndex)->deleteLater();
return true;

34
src/MissionManager/CameraSectionTest.cc

@ -47,7 +47,7 @@ void CameraSectionTest::init(void) @@ -47,7 +47,7 @@ void CameraSectionTest::init(void)
MissionItem(0, MAV_CMD_DO_MOUNT_CONTROL, MAV_FRAME_MISSION, 10.1234, 0, 20.1234, 0, 0, 0, MAV_MOUNT_MODE_MAVLINK_TARGETING, true, false),
this);
_validTimeItem = new SimpleMissionItem(_offlineVehicle,
MissionItem(0, MAV_CMD_IMAGE_START_CAPTURE, MAV_FRAME_MISSION, 0, 48, 0, -1, -1, 0, 0, true, false),
MissionItem(0, MAV_CMD_IMAGE_START_CAPTURE, MAV_FRAME_MISSION, 0, 48, 0, NAN, NAN, NAN, NAN, true, false),
this);
_validDistanceItem = new SimpleMissionItem(_offlineVehicle,
MissionItem(0, MAV_CMD_DO_SET_CAM_TRIGG_DIST, MAV_FRAME_MISSION, 72, 0, 0, 0, 0, 0, 0, true, false),
@ -57,22 +57,19 @@ void CameraSectionTest::init(void) @@ -57,22 +57,19 @@ void CameraSectionTest::init(void)
MAV_CMD_VIDEO_START_CAPTURE,
MAV_FRAME_MISSION,
0, // camera id = 0, all cameras
-1, // -1 Max FPS
-1, // Max horizontal resolution
-1, // Max vertical resolution
0, // Np CAMERA_CAPTURE_STATUS streaming
0, 0, // param 6-7 not used
0, // No CAMERA_CAPTURE_STATUS streaming
NAN, NAN, NAN, NAN, NAN, // param 3-7 reserved
true, // autocontinue
false), // isCurrentItem
this);
_validStopVideoItem = new SimpleMissionItem(_offlineVehicle,
MissionItem(0, MAV_CMD_VIDEO_STOP_CAPTURE, MAV_FRAME_MISSION, 0, 0, 0, 0, 0, 0, 0, true, false),
MissionItem(0, MAV_CMD_VIDEO_STOP_CAPTURE, MAV_FRAME_MISSION, 0, NAN, NAN, NAN, NAN, NAN, NAN, true, false),
this);
_validStopDistanceItem = new SimpleMissionItem(_offlineVehicle,
MissionItem(0, MAV_CMD_DO_SET_CAM_TRIGG_DIST, MAV_FRAME_MISSION, 0, 0, 0, 0, 0, 0, 0, true, false),
this);
_validStopTimeItem = new SimpleMissionItem(_offlineVehicle,
MissionItem(1, MAV_CMD_IMAGE_STOP_CAPTURE, MAV_FRAME_MISSION, 0, 0, 0, 0, 0, 0, 0, true, false),
MissionItem(1, MAV_CMD_IMAGE_STOP_CAPTURE, MAV_FRAME_MISSION, 0, NAN, NAN, NAN, NAN, NAN, NAN, true, false),
this);
_validCameraPhotoModeItem = new SimpleMissionItem(_offlineVehicle,
MissionItem(0, // sequence number
@ -80,7 +77,8 @@ void CameraSectionTest::init(void) @@ -80,7 +77,8 @@ void CameraSectionTest::init(void)
MAV_FRAME_MISSION,
0, // camera id = 0, all cameras
CameraSection::CameraModePhoto,
NAN, NAN, NAN, NAN, NAN, // param 3-7 unused
NAN, // Audio off/on
NAN, NAN, NAN, NAN, // param 4-7 reserved
true, // autocontinue
false), // isCurrentItem
this);
@ -90,7 +88,8 @@ void CameraSectionTest::init(void) @@ -90,7 +88,8 @@ void CameraSectionTest::init(void)
MAV_FRAME_MISSION,
0, // camera id = 0, all cameras
CameraSection::CameraModeVideo,
NAN, NAN, NAN, NAN, NAN, // param 3-7 unused
NAN, // Audio off/on
NAN, NAN, NAN, NAN, // param 4-7 reserved
true, // autocontinue
false), // isCurrentItem
this);
@ -98,12 +97,10 @@ void CameraSectionTest::init(void) @@ -98,12 +97,10 @@ void CameraSectionTest::init(void)
MissionItem(0,
MAV_CMD_IMAGE_START_CAPTURE,
MAV_FRAME_MISSION,
0, // camera id = 0, all cameras
0, // camera id = 0, all cameras
0, // Interval (none)
1, // Take 1 photo
-1, // Max horizontal resolution
-1, // Max vertical resolution
0, 0, // param 6-7 not used
NAN, NAN, NAN, NAN, // param 4-7 not reserved
true, // autoContinue
false), // isCurrentItem
this);
@ -703,8 +700,6 @@ void CameraSectionTest::_testScanForPhotoIntervalTimeSection(void) @@ -703,8 +700,6 @@ void CameraSectionTest::_testScanForPhotoIntervalTimeSection(void)
Mission Param #1 Camera ID (0 for all cameras, 1 for first, 2 for second, etc.)
Mission Param #2 Duration between two consecutive pictures (in seconds)
Mission Param #3 Number of images to capture total - 0 for unlimited capture
Mission Param #4 Resolution horizontal in pixels (set to -1 for highest resolution possible)
Mission Param #5 Resolution vertical in pixels (set to -1 for highest resolution possible)
*/
SimpleMissionItem* newValidTimeItem = new SimpleMissionItem(_offlineVehicle, this);
@ -862,10 +857,7 @@ void CameraSectionTest::_testScanForStartVideoSection(void) @@ -862,10 +857,7 @@ void CameraSectionTest::_testScanForStartVideoSection(void)
/*
MAV_CMD_VIDEO_START_CAPTURE WIP: Starts video capture (recording)
Mission Param #1 Camera ID (0 for all cameras, 1 for first, 2 for second, etc.)
Mission Param #2 Frames per second, set to -1 for highest framerate possible.
Mission Param #3 Resolution horizontal in pixels (set to -1 for highest resolution possible)
Mission Param #4 Resolution vertical in pixels (set to -1 for highest resolution possible)
Mission Param #5 Frequency CAMERA_CAPTURE_STATUS messages should be sent while recording (0 for no messages, otherwise time in Hz)
Mission Param #2 Frequency CAMERA_CAPTURE_STATUS messages should be sent while recording (0 for no messages, otherwise time in Hz)
*/
SimpleMissionItem* newValidStartVideoItem = new SimpleMissionItem(_offlineVehicle, this);
@ -1069,8 +1061,6 @@ void CameraSectionTest::_testScanForTakePhotoSection(void) @@ -1069,8 +1061,6 @@ void CameraSectionTest::_testScanForTakePhotoSection(void)
Mission Param #1 Camera ID (0 for all cameras, 1 for first, 2 for second, etc.)
Mission Param #2 Duration between two consecutive pictures (in seconds)
Mission Param #3 Number of images to capture total - 0 for unlimited capture
Mission Param #4 Resolution horizontal in pixels (set to -1 for highest resolution possible)
Mission Param #5 Resolution vertical in pixels (set to -1 for highest resolution possible)
*/
SimpleMissionItem* newValidTakePhotoItem = new SimpleMissionItem(_offlineVehicle, this);

27
src/MissionManager/MavCmdInfoCommon.json

@ -998,24 +998,19 @@ @@ -998,24 +998,19 @@
"description": "Start taking one or more photos.",
"category": "Camera",
"param1": {
"label": "Interval",
"label": "Camera id",
"default": 0,
"units": "secs",
"decimalPlaces": 0
},
"param2": {
"label": "Photo count",
"default": 1,
"label": "Interval",
"default": 0,
"units": "secs",
"decimalPlaces": 0
},
"param3": {
"label": "Resolution",
"default": -1,
"decimalPlaces": 0
},
"param6": {
"label": "Camera id",
"default": 0,
"label": "Photo count",
"default": 1,
"decimalPlaces": 0
}
},
@ -1042,16 +1037,6 @@ @@ -1042,16 +1037,6 @@
"label": "Camera id",
"default": 0,
"decimalPlaces": 0
},
"param2": {
"label": "FPS",
"default": -1,
"decimalPlaces": 0
},
"param3": {
"label": "Resolution",
"default": -1,
"decimalPlaces": 0
}
},
{

6
src/MissionManager/MissionManager.cc

@ -1053,9 +1053,9 @@ void MissionManager::generateResumeMission(int resumeIndex) @@ -1053,9 +1053,9 @@ void MissionManager::generateResumeMission(int resumeIndex)
case MAV_CMD_IMAGE_START_CAPTURE:
{
// FIXME: Handle single image capture
int cameraId = resumeItem->param6();
int cameraId = resumeItem->param1();
if (resumeItem->param1() == 0) {
if (resumeItem->param3() == 1) {
// This is an individual image capture command, remove it
resumeMission.removeAt(resumeIndex);
break;
@ -1084,7 +1084,7 @@ void MissionManager::generateResumeMission(int resumeIndex) @@ -1084,7 +1084,7 @@ void MissionManager::generateResumeMission(int resumeIndex)
case MAV_CMD_VIDEO_START_CAPTURE:
{
int cameraId = resumeItem->param1();
// If we already found an video stop, then all video start/stop commands are useless
// If we've already found a video stop, then all video start/stop commands are useless
// De-dup repeated video start commands
// Otherwise keep only the last video start
if (videoStopCameraIds.contains(cameraId) || videoStopCameraIds.contains(cameraId)) {

4
src/MissionManager/SurveyMissionItem.cc

@ -1146,9 +1146,7 @@ int SurveyMissionItem::_appendWaypointToMission(QList<MissionItem*>& items, int @@ -1146,9 +1146,7 @@ int SurveyMissionItem::_appendWaypointToMission(QList<MissionItem*>& items, int
0, // Camera ID, all cameras
0, // Interval (none)
1, // Take 1 photo
-1, // Max horizontal resolution
-1, // Max vertical resolution
0, 0, // param 6-7 not used
NAN, NAN, NAN, NAN, // param 4-7 reserved
true, // autoContinue
false, // isCurrentItem
missionItemParent);

8
src/QmlControls/MavlinkQmlSingleton.h

@ -90,11 +90,11 @@ public: @@ -90,11 +90,11 @@ public:
MAV_CMD_GET_MESSAGE_INTERVAL=510, /* Request the interval between messages for a particular MAVLink message ID |The MAVLink message ID| */
MAV_CMD_SET_MESSAGE_INTERVAL=511, /* Request the interval between messages for a particular MAVLink message ID. This interface replaces REQUEST_DATA_STREAM |The MAVLink message ID| The interval between two messages, in microseconds. Set to -1 to disable and 0 to request default rate.| */
MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES=520, /* Request autopilot capabilities |1: Request autopilot version| Reserved (all remaining params)| */
MAV_CMD_IMAGE_START_CAPTURE=2000, /* Start image capture sequence |Duration between two consecutive pictures (in seconds)| Number of images to capture total - 0 for unlimited capture| Resolution in megapixels (0.3 for 640x480, 1.3 for 1280x720, etc)| */
MAV_CMD_IMAGE_STOP_CAPTURE=2001, /* Stop image capture sequence |Reserved| Reserved| */
MAV_CMD_IMAGE_START_CAPTURE=2000, /* Start image capture sequence */
MAV_CMD_IMAGE_STOP_CAPTURE=2001, /* Stop image capture sequence */
MAV_CMD_DO_TRIGGER_CONTROL=2003, /* Enable or disable on-board camera triggering system. |Trigger enable/disable (0 for disable, 1 for start)| Shutter integration time (in ms)| Reserved| */
MAV_CMD_VIDEO_START_CAPTURE=2500, /* Starts video capture |Camera ID (0 for all cameras), 1 for first, 2 for second, etc.| Frames per second| Resolution in megapixels (0.3 for 640x480, 1.3 for 1280x720, etc)| */
MAV_CMD_VIDEO_STOP_CAPTURE=2501, /* Stop the current video capture |Reserved| Reserved| */
MAV_CMD_VIDEO_START_CAPTURE=2500, /* Starts video capture */
MAV_CMD_VIDEO_STOP_CAPTURE=2501, /* Stop the current video capture */
MAV_CMD_PANORAMA_CREATE=2800, /* Create a panorama at the current position |Viewing angle horizontal of the panorama (in degrees, +- 0.5 the total angle)| Viewing angle vertical of panorama (in degrees)| Speed of the horizontal rotation (in degrees per second)| Speed of the vertical rotation (in degrees per second)| */
MAV_CMD_DO_VTOL_TRANSITION=3000, /* Request VTOL transition |The target VTOL state, as defined by ENUM MAV_VTOL_STATE. Only MAV_VTOL_STATE_MC and MAV_VTOL_STATE_FW can be used.| */
MAV_CMD_PAYLOAD_PREPARE_DEPLOY=30001, /* Deploy payload on a Lat / Lon / Alt position. This includes the navigation to reach the required release position and velocity. |Operation mode. 0: prepare single payload deploy (overwriting previous requests), but do not execute it. 1: execute payload deploy immediately (rejecting further deploy commands during execution, but allowing abort). 2: add payload deploy to existing deployment list.| Desired approach vector in degrees compass heading (0..360). A negative value indicates the system can define the approach vector at will.| Desired ground speed at release time. This can be overridden by the airframe in case it needs to meet minimum airspeed. A negative value indicates the system can define the ground speed at will.| Minimum altitude clearance to the release position in meters. A negative value indicates the system can define the clearance at will.| Latitude unscaled for MISSION_ITEM or in 1e7 degrees for MISSION_ITEM_INT| Longitude unscaled for MISSION_ITEM or in 1e7 degrees for MISSION_ITEM_INT| Altitude, in meters AMSL| */

3
src/comm/MockLink.cc

@ -924,7 +924,8 @@ void MockLink::_sendHomePosition(void) @@ -924,7 +924,8 @@ void MockLink::_sendHomePosition(void)
(int32_t)(_vehicleAltitude * 1000),
0.0f, 0.0f, 0.0f,
&bogus[0],
0.0f, 0.0f, 0.0f);
0.0f, 0.0f, 0.0f,
0);
respondWithMavlinkMessage(msg);
}

Loading…
Cancel
Save