Commit 3ed158a6 authored by Gus Grubba's avatar Gus Grubba Committed by GitHub

Merge pull request #5345 from dogmaphobic/updateMavlink

Updating MAVLink camera/video commands.
parents 78115454 f0e09f82
Subproject commit 2faa6d49834aa203e2a3eeeeed588728fb14c431 Subproject commit 6bbc8a51d8f37537732d3f5170093d49e64c6f4b
...@@ -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, MAV_FRAME_MISSION,
0, // camera id, all cameras 0, // camera id, all cameras
_cameraModeFact.rawValue().toDouble(), _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 true, // autoContinue
false, // isCurrentItem false, // isCurrentItem
missionItemParent); 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 0, // Camera ID, all cameras
_cameraPhotoIntervalTimeFact.rawValue().toInt(), // Interval _cameraPhotoIntervalTimeFact.rawValue().toInt(), // Interval
0, // Unlimited photo count 0, // Unlimited photo count
-1, // Max horizontal resolution NAN, NAN, NAN, NAN, // param 4-7 reserved
-1, // Max vertical resolution
0, 0, // param 6-7 not used
true, // autoContinue true, // autoContinue
false, // isCurrentItem false, // isCurrentItem
missionItemParent); 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_CMD_VIDEO_START_CAPTURE,
MAV_FRAME_MISSION, MAV_FRAME_MISSION,
0, // camera id = 0, all cameras 0, // camera id = 0, all cameras
-1, // Max FPS 0, // No CAMERA_CAPTURE_STATUS streaming
-1, // Max horizontal resolution NAN, NAN, NAN, NAN, NAN, // param 3-7 reserved
-1, // Max vertical resolution
0, // Np CAMERA_CAPTURE_STATUS streaming
0, 0, // param 6-7 not used
true, // autoContinue true, // autoContinue
false, // isCurrentItem false, // isCurrentItem
missionItemParent); 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++, item = new MissionItem(nextSequenceNumber++,
MAV_CMD_VIDEO_STOP_CAPTURE, MAV_CMD_VIDEO_STOP_CAPTURE,
MAV_FRAME_MISSION, MAV_FRAME_MISSION,
0, // Camera ID, all cameras 0, // Camera ID, all cameras
0, 0, 0, 0, 0, 0, // param 2-7 not used NAN, NAN, NAN, NAN, NAN, NAN, // param 2-7 reserved
true, // autoContinue true, // autoContinue
false, // isCurrentItem false, // isCurrentItem
missionItemParent); missionItemParent);
break; 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++, item = new MissionItem(nextSequenceNumber++,
MAV_CMD_IMAGE_STOP_CAPTURE, MAV_CMD_IMAGE_STOP_CAPTURE,
MAV_FRAME_MISSION, MAV_FRAME_MISSION,
0, // camera id, all cameras 0, // camera id, all cameras
0, 0, 0, 0, 0, 0, // param 2-7 not used NAN, NAN, NAN, NAN, NAN, NAN, // param 2-7 reserved
true, // autoContinue true, // autoContinue
false, // isCurrentItem false, // isCurrentItem
missionItemParent); missionItemParent);
break; 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++, item = new MissionItem(nextSequenceNumber++,
MAV_CMD_IMAGE_START_CAPTURE, MAV_CMD_IMAGE_START_CAPTURE,
MAV_FRAME_MISSION, MAV_FRAME_MISSION,
0, // camera id = 0, all cameras 0, // camera id = 0, all cameras
0, // Interval (none) 0, // Interval (none)
1, // Take 1 photo 1, // Take 1 photo
-1, // Max horizontal resolution NAN, NAN, NAN, NAN, // param 4-7 reserved
-1, // Max vertical resolution true, // autoContinue
0, 0, // param 6-7 not used false, // isCurrentItem
true, // autoContinue
false, // isCurrentItem
missionItemParent); missionItemParent);
break; 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) { if (item) {
MissionItem& missionItem = item->missionItem(); MissionItem& missionItem = item->missionItem();
if ((MAV_CMD)item->command() == MAV_CMD_IMAGE_START_CAPTURE) { 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); cameraAction()->setRawValue(TakePhoto);
visualItems->removeAt(scanIndex)->deleteLater(); visualItems->removeAt(scanIndex)->deleteLater();
return true; return true;
...@@ -282,7 +276,7 @@ bool CameraSection::_scanTakePhotosIntervalTime(QmlObjectListModel* visualItems, ...@@ -282,7 +276,7 @@ bool CameraSection::_scanTakePhotosIntervalTime(QmlObjectListModel* visualItems,
if (item) { if (item) {
MissionItem& missionItem = item->missionItem(); MissionItem& missionItem = item->missionItem();
if ((MAV_CMD)item->command() == MAV_CMD_IMAGE_START_CAPTURE) { 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); cameraAction()->setRawValue(TakePhotosIntervalTime);
cameraPhotoIntervalTime()->setRawValue(missionItem.param2()); cameraPhotoIntervalTime()->setRawValue(missionItem.param2());
visualItems->removeAt(scanIndex)->deleteLater(); 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); SimpleMissionItem* nextItem = visualItems->value<SimpleMissionItem*>(scanIndex + 1);
if (nextItem) { if (nextItem) {
MissionItem& nextMissionItem = nextItem->missionItem(); 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); cameraAction()->setRawValue(StopTakingPhotos);
visualItems->removeAt(scanIndex)->deleteLater(); visualItems->removeAt(scanIndex)->deleteLater();
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) { if (item) {
MissionItem& missionItem = item->missionItem(); MissionItem& missionItem = item->missionItem();
if ((MAV_CMD)item->command() == MAV_CMD_VIDEO_START_CAPTURE) { 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); cameraAction()->setRawValue(TakeVideo);
visualItems->removeAt(scanIndex)->deleteLater(); visualItems->removeAt(scanIndex)->deleteLater();
return true; 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) { if (item) {
MissionItem& missionItem = item->missionItem(); MissionItem& missionItem = item->missionItem();
if ((MAV_CMD)item->command() == MAV_CMD_VIDEO_STOP_CAPTURE) { 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); cameraAction()->setRawValue(StopTakingVideo);
visualItems->removeAt(scanIndex)->deleteLater(); visualItems->removeAt(scanIndex)->deleteLater();
return true; return true;
......
...@@ -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), 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); this);
_validTimeItem = new SimpleMissionItem(_offlineVehicle, _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); this);
_validDistanceItem = new SimpleMissionItem(_offlineVehicle, _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), 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_CMD_VIDEO_START_CAPTURE,
MAV_FRAME_MISSION, MAV_FRAME_MISSION,
0, // camera id = 0, all cameras 0, // camera id = 0, all cameras
-1, // -1 Max FPS 0, // No CAMERA_CAPTURE_STATUS streaming
-1, // Max horizontal resolution NAN, NAN, NAN, NAN, NAN, // param 3-7 reserved
-1, // Max vertical resolution
0, // Np CAMERA_CAPTURE_STATUS streaming
0, 0, // param 6-7 not used
true, // autocontinue true, // autocontinue
false), // isCurrentItem false), // isCurrentItem
this); this);
_validStopVideoItem = new SimpleMissionItem(_offlineVehicle, _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); this);
_validStopDistanceItem = new SimpleMissionItem(_offlineVehicle, _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), MissionItem(0, MAV_CMD_DO_SET_CAM_TRIGG_DIST, MAV_FRAME_MISSION, 0, 0, 0, 0, 0, 0, 0, true, false),
this); this);
_validStopTimeItem = new SimpleMissionItem(_offlineVehicle, _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); this);
_validCameraPhotoModeItem = new SimpleMissionItem(_offlineVehicle, _validCameraPhotoModeItem = new SimpleMissionItem(_offlineVehicle,
MissionItem(0, // sequence number MissionItem(0, // sequence number
...@@ -80,7 +77,8 @@ void CameraSectionTest::init(void) ...@@ -80,7 +77,8 @@ void CameraSectionTest::init(void)
MAV_FRAME_MISSION, MAV_FRAME_MISSION,
0, // camera id = 0, all cameras 0, // camera id = 0, all cameras
CameraSection::CameraModePhoto, 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 true, // autocontinue
false), // isCurrentItem false), // isCurrentItem
this); this);
...@@ -90,7 +88,8 @@ void CameraSectionTest::init(void) ...@@ -90,7 +88,8 @@ void CameraSectionTest::init(void)
MAV_FRAME_MISSION, MAV_FRAME_MISSION,
0, // camera id = 0, all cameras 0, // camera id = 0, all cameras
CameraSection::CameraModeVideo, 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 true, // autocontinue
false), // isCurrentItem false), // isCurrentItem
this); this);
...@@ -98,12 +97,10 @@ void CameraSectionTest::init(void) ...@@ -98,12 +97,10 @@ void CameraSectionTest::init(void)
MissionItem(0, MissionItem(0,
MAV_CMD_IMAGE_START_CAPTURE, MAV_CMD_IMAGE_START_CAPTURE,
MAV_FRAME_MISSION, MAV_FRAME_MISSION,
0, // camera id = 0, all cameras 0, // camera id = 0, all cameras
0, // Interval (none) 0, // Interval (none)
1, // Take 1 photo 1, // Take 1 photo
-1, // Max horizontal resolution NAN, NAN, NAN, NAN, // param 4-7 reserved
-1, // Max vertical resolution
0, 0, // param 6-7 not used
true, // autoContinue true, // autoContinue
false), // isCurrentItem false), // isCurrentItem
this); this);
...@@ -675,10 +672,10 @@ void CameraSectionTest::_testScanForCameraModeSection(void) ...@@ -675,10 +672,10 @@ void CameraSectionTest::_testScanForCameraModeSection(void)
Mission Param #2 Camera mode (0: photo mode, 1: video mode) Mission Param #2 Camera mode (0: photo mode, 1: video mode)
Mission Param #3 Audio recording enabled (0: off 1: on) Mission Param #3 Audio recording enabled (0: off 1: on)
Mission Param #4 Reserved (all remaining params) Mission Param #4 Reserved (all remaining params)
*/ */
// Mode command but incorrect settings // Mode command but incorrect settings
/*
SimpleMissionItem invalidSimpleItem(_offlineVehicle, _validCameraPhotoModeItem->missionItem()); SimpleMissionItem invalidSimpleItem(_offlineVehicle, _validCameraPhotoModeItem->missionItem());
invalidSimpleItem.missionItem().setParam3(0); // Audio is not supported invalidSimpleItem.missionItem().setParam3(0); // Audio is not supported
visualItems.append(&invalidSimpleItem); visualItems.append(&invalidSimpleItem);
...@@ -687,6 +684,7 @@ void CameraSectionTest::_testScanForCameraModeSection(void) ...@@ -687,6 +684,7 @@ void CameraSectionTest::_testScanForCameraModeSection(void)
QCOMPARE(_cameraSection->specifyCameraMode(), false); QCOMPARE(_cameraSection->specifyCameraMode(), false);
QCOMPARE(_cameraSection->settingsSpecified(), false); QCOMPARE(_cameraSection->settingsSpecified(), false);
visualItems.clear(); visualItems.clear();
*/
} }
void CameraSectionTest::_testScanForPhotoIntervalTimeSection(void) void CameraSectionTest::_testScanForPhotoIntervalTimeSection(void)
...@@ -703,8 +701,6 @@ void CameraSectionTest::_testScanForPhotoIntervalTimeSection(void) ...@@ -703,8 +701,6 @@ void CameraSectionTest::_testScanForPhotoIntervalTimeSection(void)
Mission Param #1 Camera ID (0 for all cameras, 1 for first, 2 for second, etc.) 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 #2 Duration between two consecutive pictures (in seconds)
Mission Param #3 Number of images to capture total - 0 for unlimited capture 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); SimpleMissionItem* newValidTimeItem = new SimpleMissionItem(_offlineVehicle, this);
...@@ -727,6 +723,7 @@ void CameraSectionTest::_testScanForPhotoIntervalTimeSection(void) ...@@ -727,6 +723,7 @@ void CameraSectionTest::_testScanForPhotoIntervalTimeSection(void)
QCOMPARE(visualItems.count(), 1); QCOMPARE(visualItems.count(), 1);
visualItems.clear(); visualItems.clear();
/*
invalidSimpleItem.missionItem() = _validTimeItem->missionItem(); invalidSimpleItem.missionItem() = _validTimeItem->missionItem();
invalidSimpleItem.missionItem().setParam4(10); // must be -1 for highest res invalidSimpleItem.missionItem().setParam4(10); // must be -1 for highest res
visualItems.append(&invalidSimpleItem); visualItems.append(&invalidSimpleItem);
...@@ -758,6 +755,7 @@ void CameraSectionTest::_testScanForPhotoIntervalTimeSection(void) ...@@ -758,6 +755,7 @@ void CameraSectionTest::_testScanForPhotoIntervalTimeSection(void)
QCOMPARE(visualItems.count(), 1); QCOMPARE(visualItems.count(), 1);
QCOMPARE(_cameraSection->settingsSpecified(), false); QCOMPARE(_cameraSection->settingsSpecified(), false);
visualItems.clear(); visualItems.clear();
*/
} }
void CameraSectionTest::_testScanForPhotoIntervalDistanceSection(void) void CameraSectionTest::_testScanForPhotoIntervalDistanceSection(void)
...@@ -862,10 +860,7 @@ void CameraSectionTest::_testScanForStartVideoSection(void) ...@@ -862,10 +860,7 @@ void CameraSectionTest::_testScanForStartVideoSection(void)
/* /*
MAV_CMD_VIDEO_START_CAPTURE WIP: Starts video capture (recording) 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 #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 #2 Frequency CAMERA_CAPTURE_STATUS messages should be sent while recording (0 for no messages, otherwise time in Hz)
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)
*/ */
SimpleMissionItem* newValidStartVideoItem = new SimpleMissionItem(_offlineVehicle, this); SimpleMissionItem* newValidStartVideoItem = new SimpleMissionItem(_offlineVehicle, this);
...@@ -889,13 +884,14 @@ void CameraSectionTest::_testScanForStartVideoSection(void) ...@@ -889,13 +884,14 @@ void CameraSectionTest::_testScanForStartVideoSection(void)
visualItems.clear(); visualItems.clear();
invalidSimpleItem.missionItem() = _validStartVideoItem->missionItem(); invalidSimpleItem.missionItem() = _validStartVideoItem->missionItem();
invalidSimpleItem.missionItem().setParam2(10); // must be -1 invalidSimpleItem.missionItem().setParam2(10); // must be 0
visualItems.append(&invalidSimpleItem); visualItems.append(&invalidSimpleItem);
QCOMPARE(_cameraSection->scanForSection(&visualItems, scanIndex), false); QCOMPARE(_cameraSection->scanForSection(&visualItems, scanIndex), false);
QCOMPARE(visualItems.count(), 1); QCOMPARE(visualItems.count(), 1);
QCOMPARE(_cameraSection->settingsSpecified(), false); QCOMPARE(_cameraSection->settingsSpecified(), false);
visualItems.clear(); visualItems.clear();
/*
invalidSimpleItem.missionItem() = _validStartVideoItem->missionItem(); invalidSimpleItem.missionItem() = _validStartVideoItem->missionItem();
invalidSimpleItem.missionItem().setParam3(1); // must be -1 invalidSimpleItem.missionItem().setParam3(1); // must be -1
visualItems.append(&invalidSimpleItem); visualItems.append(&invalidSimpleItem);
...@@ -935,6 +931,7 @@ void CameraSectionTest::_testScanForStartVideoSection(void) ...@@ -935,6 +931,7 @@ void CameraSectionTest::_testScanForStartVideoSection(void)
QCOMPARE(visualItems.count(), 1); QCOMPARE(visualItems.count(), 1);
QCOMPARE(_cameraSection->settingsSpecified(), false); QCOMPARE(_cameraSection->settingsSpecified(), false);
visualItems.clear(); visualItems.clear();
*/
} }
void CameraSectionTest::_testScanForStopVideoSection(void) void CameraSectionTest::_testScanForStopVideoSection(void)
...@@ -971,6 +968,7 @@ void CameraSectionTest::_testScanForStopVideoSection(void) ...@@ -971,6 +968,7 @@ void CameraSectionTest::_testScanForStopVideoSection(void)
QCOMPARE(_cameraSection->settingsSpecified(), false); QCOMPARE(_cameraSection->settingsSpecified(), false);
visualItems.clear(); visualItems.clear();
/*
invalidSimpleItem.missionItem() = _validStopVideoItem->missionItem(); invalidSimpleItem.missionItem() = _validStopVideoItem->missionItem();
invalidSimpleItem.missionItem().setParam2(10); // must be 0 invalidSimpleItem.missionItem().setParam2(10); // must be 0
visualItems.append(&invalidSimpleItem); visualItems.append(&invalidSimpleItem);
...@@ -1018,6 +1016,7 @@ void CameraSectionTest::_testScanForStopVideoSection(void) ...@@ -1018,6 +1016,7 @@ void CameraSectionTest::_testScanForStopVideoSection(void)
QCOMPARE(visualItems.count(), 1); QCOMPARE(visualItems.count(), 1);
QCOMPARE(_cameraSection->settingsSpecified(), false); QCOMPARE(_cameraSection->settingsSpecified(), false);
visualItems.clear(); visualItems.clear();
*/
} }
void CameraSectionTest::_testScanForStopImageSection(void) void CameraSectionTest::_testScanForStopImageSection(void)
...@@ -1069,8 +1068,6 @@ void CameraSectionTest::_testScanForTakePhotoSection(void) ...@@ -1069,8 +1068,6 @@ void CameraSectionTest::_testScanForTakePhotoSection(void)
Mission Param #1 Camera ID (0 for all cameras, 1 for first, 2 for second, etc.) 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 #2 Duration between two consecutive pictures (in seconds)
Mission Param #3 Number of images to capture total - 0 for unlimited capture 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); SimpleMissionItem* newValidTakePhotoItem = new SimpleMissionItem(_offlineVehicle, this);
...@@ -1092,6 +1089,7 @@ void CameraSectionTest::_testScanForTakePhotoSection(void) ...@@ -1092,6 +1089,7 @@ void CameraSectionTest::_testScanForTakePhotoSection(void)
QCOMPARE(visualItems.count(), 1); QCOMPARE(visualItems.count(), 1);
visualItems.clear(); visualItems.clear();
/*
invalidSimpleItem.missionItem() = _validTimeItem->missionItem(); invalidSimpleItem.missionItem() = _validTimeItem->missionItem();
invalidSimpleItem.missionItem().setParam4(10); // must be -1 for highest res invalidSimpleItem.missionItem().setParam4(10); // must be -1 for highest res
visualItems.append(&invalidSimpleItem); visualItems.append(&invalidSimpleItem);
...@@ -1123,6 +1121,7 @@ void CameraSectionTest::_testScanForTakePhotoSection(void) ...@@ -1123,6 +1121,7 @@ void CameraSectionTest::_testScanForTakePhotoSection(void)
QCOMPARE(visualItems.count(), 1); QCOMPARE(visualItems.count(), 1);
QCOMPARE(_cameraSection->settingsSpecified(), false); QCOMPARE(_cameraSection->settingsSpecified(), false);
visualItems.clear(); visualItems.clear();
*/
} }
void CameraSectionTest::_validateItemScan(SimpleMissionItem* validItem) void CameraSectionTest::_validateItemScan(SimpleMissionItem* validItem)
......
...@@ -998,24 +998,19 @@ ...@@ -998,24 +998,19 @@
"description": "Start taking one or more photos.", "description": "Start taking one or more photos.",
"category": "Camera", "category": "Camera",
"param1": { "param1": {
"label": "Interval", "label": "Camera id",
"default": 0, "default": 0,
"units": "secs",
"decimalPlaces": 0 "decimalPlaces": 0
}, },
"param2": { "param2": {
"label": "Photo count", "label": "Interval",
"default": 1, "default": 0,
"units": "secs",
"decimalPlaces": 0 "decimalPlaces": 0
}, },
"param3": { "param3": {
"label": "Resolution", "label": "Photo count",
"default": -1, "default": 1,
"decimalPlaces": 0
},
"param6": {
"label": "Camera id",
"default": 0,
"decimalPlaces": 0 "decimalPlaces": 0
} }
}, },
...@@ -1042,16 +1037,6 @@ ...@@ -1042,16 +1037,6 @@
"label": "Camera id", "label": "Camera id",
"default": 0, "default": 0,
"decimalPlaces": 0 "decimalPlaces": 0
},
"param2": {
"label": "FPS",
"default": -1,
"decimalPlaces": 0
},
"param3": {
"label": "Resolution",
"default": -1,
"decimalPlaces": 0
} }
}, },
{ {
......
...@@ -1053,9 +1053,9 @@ void MissionManager::generateResumeMission(int resumeIndex) ...@@ -1053,9 +1053,9 @@ void MissionManager::generateResumeMission(int resumeIndex)
case MAV_CMD_IMAGE_START_CAPTURE: case MAV_CMD_IMAGE_START_CAPTURE:
{ {
// FIXME: Handle single image 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 // This is an individual image capture command, remove it
resumeMission.removeAt(resumeIndex); resumeMission.removeAt(resumeIndex);
break; 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: case MAV_CMD_VIDEO_START_CAPTURE:
{ {
int cameraId = resumeItem->param1(); 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 // De-dup repeated video start commands
// Otherwise keep only the last video start // Otherwise keep only the last video start
if (videoStopCameraIds.contains(cameraId) || videoStopCameraIds.contains(cameraId)) { if (videoStopCameraIds.contains(cameraId) || videoStopCameraIds.contains(cameraId)) {
......
...@@ -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, // Camera ID, all cameras
0, // Interval (none) 0, // Interval (none)
1, // Take 1 photo 1, // Take 1 photo
-1, // Max horizontal resolution NAN, NAN, NAN, NAN, // param 4-7 reserved
-1, // Max vertical resolution
0, 0, // param 6-7 not used
true, // autoContinue true, // autoContinue
false, // isCurrentItem false, // isCurrentItem
missionItemParent); missionItemParent);
......
...@@ -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_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_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_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_START_CAPTURE=2000, /* Start image capture sequence */
MAV_CMD_IMAGE_STOP_CAPTURE=2001, /* Stop image capture sequence |Reserved| Reserved| */ 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_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_START_CAPTURE=2500, /* Starts video capture */
MAV_CMD_VIDEO_STOP_CAPTURE=2501, /* Stop the current video capture |Reserved| Reserved| */ 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_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_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| */ 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| */
......
...@@ -924,7 +924,8 @@ void MockLink::_sendHomePosition(void) ...@@ -924,7 +924,8 @@ void MockLink::_sendHomePosition(void)
(int32_t)(_vehicleAltitude * 1000), (int32_t)(_vehicleAltitude * 1000),
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
&bogus[0], &bogus[0],
0.0f, 0.0f, 0.0f); 0.0f, 0.0f, 0.0f,
0);
respondWithMavlinkMessage(msg); respondWithMavlinkMessage(msg);
} }
......
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