Commit 75635d2f authored by Valentin Platzgummer's avatar Valentin Platzgummer

123

parent 919fdcb4
......@@ -35,9 +35,10 @@ const char* WimaController::snakeMinTileAreaName = "SnakeMinTileArea";
const char* WimaController::snakeLineDistanceName = "SnakeLineDistance";
const char* WimaController::snakeMinTransectLengthName = "SnakeMinTransectLength";
WimaController::StatusMap WimaController::_nemoStatusMap{std::make_pair<int, QString>(0, "No Heartbeat"),
std::make_pair<int, QString>(1, "Connected"),
std::make_pair<int, QString>(-1, "Timeout")};
WimaController::StatusMap WimaController::_nemoStatusMap{
std::make_pair<int, QString>(0, "No Heartbeat"),
std::make_pair<int, QString>(1, "Connected"),
std::make_pair<int, QString>(-1, "Timeout")};
using namespace snake;
using namespace snake_geometry;
......@@ -56,7 +57,8 @@ WimaController::WimaController(QObject *parent)
, _rtlManager (_managerSettings, _areaInterface)
, _currentManager (&_defaultManager)
, _managerList {&_defaultManager, &_snakeManager, &_rtlManager}
, _metaDataMap (FactMetaData::createMapFromJsonFile(QStringLiteral(":/json/WimaController.SettingsGroup.json"), this))
, _metaDataMap (FactMetaData::createMapFromJsonFile(
QStringLiteral(":/json/WimaController.SettingsGroup.json"), this))
, _enableWimaController (settingsGroup, _metaDataMap[enableWimaControllerName])
, _overlapWaypoints (settingsGroup, _metaDataMap[overlapWaypointsName])
, _maxWaypointsPerPhase (settingsGroup, _metaDataMap[maxWaypointsPerPhaseName])
......@@ -333,7 +335,9 @@ void WimaController::removeVehicleTrajectoryHistory()
managerVehicle->trajectoryPoints()->clear();
}
bool WimaController::_calcShortestPath(const QGeoCoordinate &start, const QGeoCoordinate &destination, QVector<QGeoCoordinate> &path)
bool WimaController::_calcShortestPath(const QGeoCoordinate &start,
const QGeoCoordinate &destination,
QVector<QGeoCoordinate> &path)
{
using namespace GeoUtilities;
using namespace PolygonCalculus;
......@@ -352,8 +356,6 @@ bool WimaController::_calcShortestPath(const QGeoCoordinate &start, const QGeoCo
bool WimaController::setWimaPlanData(const WimaPlanData &planData)
{
// fetch only if valid, return true on success
// reset visual items
_areas.clear();
_defaultManager.clear();
......@@ -864,15 +866,24 @@ void WimaController::_initStartSnakeWorker()
}
// Initialize _snakeWorker.
_snakeWorker.setMeasurementArea(_measurementArea.coordinateList());
_snakeWorker.setServiceArea(_serviceArea.coordinateList());
_snakeWorker.setCorridor(_corridor.coordinateList());
_snakeWorker.setProgress(_nemoProgress.progress());
_snakeWorker.setLineDistance(_snakeLineDistance.rawValue().toDouble());
_snakeWorker.setMinTransectLength(_snakeMinTransectLength.rawValue().toDouble());
_snakeWorker.setTileHeight(_snakeTileHeight.rawValue().toDouble());
_snakeWorker.setTileWidth(_snakeTileWidth.rawValue().toDouble());
_snakeWorker.setMinTileArea(_snakeMinTileArea.rawValue().toDouble());
_snakeWorker.setMeasurementArea(
_measurementArea.coordinateList());
_snakeWorker.setServiceArea(
_serviceArea.coordinateList());
_snakeWorker.setCorridor(
_corridor.coordinateList());
_snakeWorker.setProgress(
_nemoProgress.progress());
_snakeWorker.setLineDistance(
_snakeLineDistance.rawValue().toDouble());
_snakeWorker.setMinTransectLength(
_snakeMinTransectLength.rawValue().toDouble());
_snakeWorker.setTileHeight(
_snakeTileHeight.rawValue().toDouble());
_snakeWorker.setTileWidth(
_snakeTileWidth.rawValue().toDouble());
_snakeWorker.setMinTileArea(
_snakeMinTileArea.rawValue().toDouble());
_setSnakeCalcInProgress(true);
// Start worker thread.
......
......@@ -36,10 +36,12 @@ WimaPlaner::WimaPlaner(QObject *parent)
_updateTimer.setInterval(300); // 300 ms means: max update time 2*300 ms
_updateTimer.start();
#ifndef NDEBUG
// for debugging and testing purpose, remove if not needed anymore
connect(&_autoLoadTimer, &QTimer::timeout, this, &WimaPlaner::autoLoadMission);
_autoLoadTimer.setSingleShot(true);
_autoLoadTimer.start(300);
#endif
_calcArrivalAndReturnPathTimer.setInterval(100);
_calcArrivalAndReturnPathTimer.setSingleShot(true);
......@@ -826,11 +828,13 @@ void WimaPlaner::setSyncronizedWithControllerFalse()
setSyncronizedWithController(false);
}
#ifndef NDEBUG
void WimaPlaner::autoLoadMission()
{
loadFromFile("/home/valentin/Desktop/drones/qgroundcontrol/Paths/KlingenbachTest.wima");
pushToWimaController();
}
#endif
void WimaPlaner::startCalcArrivalAndReturnTimer()
{
......
......@@ -136,7 +136,9 @@ private slots:
// called by _updateTimer::timeout signal, updates different mission parts, if parameters (e.g. survey or areas) have changed
void updateTimerSlot ();
void setSyncronizedWithControllerFalse (void);
#ifndef NDEBUG
void autoLoadMission (void);
#endif
void startCalcArrivalAndReturnTimer (void);
private:
signals:
......@@ -180,6 +182,8 @@ private:
bool _syncronizedWithController; // true if planData is syncronized with wimaController
bool _readyForSync; // gets set by updateMission and calcArrivalAndReturnPath
#ifndef NDEBUG
QTimer _autoLoadTimer; // timer to auto load mission after some time, prevents seg. faults
#endif
QTimer _calcArrivalAndReturnPathTimer;
};
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