Commit 44644da9 authored by Valentin Platzgummer's avatar Valentin Platzgummer

altitude issue for pattern flight plans solved

parent 24bbbf6a
{
"fileType": "Plan",
"geoFence": {
"circles": [
],
"polygons": [
],
"version": 2
},
"groundStation": "QGroundControl",
"mission": {
"cruiseSpeed": 15,
"firmwareType": 3,
"hoverSpeed": 2,
"items": [
{
"autoContinue": true,
"command": 22,
"doJumpId": 1,
"frame": 3,
"params": [
15,
0,
0,
null,
0,
0,
15
],
"type": "SimpleItem"
},
{
"TransectStyleComplexItem": {
"CameraCalc": {
"AdjustedFootprintFrontal": 25,
"AdjustedFootprintSide": 25,
"CameraName": "Manual (no camera specs)",
"DistanceToSurface": 16,
"DistanceToSurfaceRelative": true,
"version": 1
},
"CameraShots": 6,
"CameraTriggerInTurnAround": true,
"FollowTerrain": false,
"HoverAndCapture": false,
"Items": [
{
"autoContinue": true,
"command": 16,
"doJumpId": 2,
"frame": 3,
"params": [
0,
0,
0,
null,
47.76823086287187,
16.53058942509675,
12
],
"type": "SimpleItem"
},
{
"autoContinue": true,
"command": 206,
"doJumpId": 3,
"frame": 2,
"params": [
25,
0,
1,
0,
0,
0,
0
],
"type": "SimpleItem"
},
{
"autoContinue": true,
"command": 206,
"doJumpId": 4,
"frame": 2,
"params": [
25,
0,
1,
0,
0,
0,
0
],
"type": "SimpleItem"
},
{
"autoContinue": true,
"command": 16,
"doJumpId": 5,
"frame": 3,
"params": [
0,
0,
0,
null,
47.767777545528425,
16.530589422507354,
12
],
"type": "SimpleItem"
},
{
"autoContinue": true,
"command": 16,
"doJumpId": 6,
"frame": 3,
"params": [
0,
0,
0,
null,
47.7678946477262,
16.53092392473375,
12
],
"type": "SimpleItem"
},
{
"autoContinue": true,
"command": 206,
"doJumpId": 7,
"frame": 2,
"params": [
25,
0,
1,
0,
0,
0,
0
],
"type": "SimpleItem"
},
{
"autoContinue": true,
"command": 16,
"doJumpId": 8,
"frame": 3,
"params": [
0,
0,
0,
null,
47.76834255995745,
16.530923930172992,
12
],
"type": "SimpleItem"
},
{
"autoContinue": true,
"command": 206,
"doJumpId": 9,
"frame": 2,
"params": [
0,
0,
0,
0,
0,
0,
0
],
"type": "SimpleItem"
}
],
"Refly90Degrees": false,
"TurnAroundDistance": 0,
"VisualTransectPoints": [
[
47.76823086287187,
16.53058942509675
],
[
47.767777545528425,
16.530589422507354
],
[
47.7678946477262,
16.53092392473375
],
[
47.76834255995745,
16.530923930172992
]
],
"version": 1
},
"angle": 0,
"complexItemType": "survey",
"entryLocation": 0,
"flyAlternateTransects": false,
"polygon": [
[
47.76813165710231,
16.530292332060014
],
[
47.76836780779515,
16.530999541789157
],
[
47.767985395495465,
16.531183148525685
],
[
47.76771877171136,
16.530421536814117
]
],
"splitConcavePolygons": false,
"type": "ComplexItem",
"version": 5
}
],
"plannedHomePosition": [
47.7677909,
16.5305408,
0.01
],
"vehicleType": 2,
"version": 2
},
"rallyPoints": {
"points": [
],
"version": 2
},
"version": 1
}
......@@ -640,6 +640,7 @@ void SurveyComplexItem::_buildAndAppendMissionItems(QList<MissionItem*>& items,
bool transectEntry = true;
for (const CoordInfo_t& transectCoordInfo: transect) {
qWarning() << transectCoordInfo.coord.altitude();
item = new MissionItem(seqNum++,
MAV_CMD_NAV_WAYPOINT,
mavFrame,
......
......@@ -108,6 +108,10 @@ TransectStyleComplexItem::TransectStyleComplexItem(Vehicle* vehicle, bool flyVie
connect(this, &TransectStyleComplexItem::followTerrainChanged, this, &TransectStyleComplexItem::_followTerrainChanged);
connect(_cameraCalc.distanceToSurface(), &Fact::rawValueChanged, this, &TransectStyleComplexItem::_updateTransectAltitude);
connect(_cameraCalc.distanceToSurface(), &Fact::rawValueChanged, this, &TransectStyleComplexItem::_clearLoadedMissionItems);
setDirty(false);
}
......@@ -228,6 +232,11 @@ bool TransectStyleComplexItem::_load(const QJsonObject& complexObject, QString&
_coordinate = _visualTransectPoints.count() ? _visualTransectPoints.first().value<QGeoCoordinate>() : QGeoCoordinate();
_exitCoordinate = _visualTransectPoints.count() ? _visualTransectPoints.last().value<QGeoCoordinate>() : QGeoCoordinate();
// Load CameraCalc data
if (!_cameraCalc.load(innerObject[_jsonCameraCalcKey].toObject(), errorString)) {
return false;
}
// Load generated mission items
_loadedMissionItemsParent = new QObject(this);
QJsonArray missionItemsJsonArray = innerObject[_jsonItemsKey].toArray();
......@@ -241,10 +250,6 @@ bool TransectStyleComplexItem::_load(const QJsonObject& complexObject, QString&
_loadedMissionItems.append(missionItem);
}
// Load CameraCalc data
if (!_cameraCalc.load(innerObject[_jsonCameraCalcKey].toObject(), errorString)) {
return false;
}
// Load TransectStyleComplexItem individual values
_turnAroundDistanceFact.setRawValue (innerObject[turnAroundDistanceName].toDouble());
......@@ -419,9 +424,22 @@ void TransectStyleComplexItem::_updateTransectAltitude()
{
double altitude = _cameraCalc.distanceToSurface()->rawValue().toDouble();
if (altitude > 0)
for (auto list : _transects)
for (auto vertex : list)
for (int h = 0; h < _transects.length(); h++){
QList<CoordInfo_t> &list = _transects[h];
for (int i = 0; i < list.length(); i++) {
CoordInfo_t &vertex = list[i];
vertex.coord.setAltitude(altitude);
}
}
}
void TransectStyleComplexItem::_clearLoadedMissionItems()
{
if (_loadedMissionItemsParent){
_loadedMissionItems.clear();
_loadedMissionItemsParent->deleteLater();
_loadedMissionItemsParent = nullptr;
}
}
void TransectStyleComplexItem::_queryTransectsPathHeightInfo(void)
......
......@@ -135,6 +135,7 @@ protected slots:
void _polyPathTerrainData (bool success, const QList<TerrainPathQuery::PathHeightInfo_t>& rgPathHeightInfo);
void _rebuildTransects (void);
void _updateTransectAltitude (void);
void _clearLoadedMissionItems (void);
protected:
virtual void _rebuildTransectsPhase1 (void) = 0; ///< Rebuilds the _transects array
......
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