Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
4ef772d6
Commit
4ef772d6
authored
Oct 10, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for flight track lines
parent
54e85068
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
280 additions
and
0 deletions
+280
-0
QGCApplication.pro
QGCApplication.pro
+4
-0
FlightDisplayView.qml
src/FlightDisplay/FlightDisplayView.qml
+16
-0
QGCApplication.cc
src/QGCApplication.cc
+4
-0
CoordinateVector.cc
src/QmlControls/CoordinateVector.cc
+54
-0
CoordinateVector.h
src/QmlControls/CoordinateVector.h
+53
-0
QGCQGeoCoordinate.cc
src/QmlControls/QGCQGeoCoordinate.cc
+51
-0
QGCQGeoCoordinate.h
src/QmlControls/QGCQGeoCoordinate.h
+53
-0
Vehicle.cc
src/Vehicle/Vehicle.cc
+32
-0
Vehicle.h
src/Vehicle/Vehicle.h
+13
-0
No files found.
QGCApplication.pro
View file @
4ef772d6
...
@@ -260,9 +260,11 @@ HEADERS += \
...
@@ -260,9 +260,11 @@ HEADERS += \
src
/
QGCQuickWidget
.
h
\
src
/
QGCQuickWidget
.
h
\
src
/
QGCSingleton
.
h
\
src
/
QGCSingleton
.
h
\
src
/
QGCTemporaryFile
.
h
\
src
/
QGCTemporaryFile
.
h
\
src
/
QmlControls
/
CoordinateVector
.
h
\
src
/
QmlControls
/
MavlinkQmlSingleton
.
h
\
src
/
QmlControls
/
MavlinkQmlSingleton
.
h
\
src
/
QmlControls
/
ParameterEditorController
.
h
\
src
/
QmlControls
/
ParameterEditorController
.
h
\
src
/
QmlControls
/
ScreenToolsController
.
h
\
src
/
QmlControls
/
ScreenToolsController
.
h
\
src
/
QmlControls
/
QGCQGeoCoordinate
.
h
\
src
/
QmlControls
/
QGroundControlQmlGlobal
.
h
\
src
/
QmlControls
/
QGroundControlQmlGlobal
.
h
\
src
/
QmlControls
/
QmlObjectListModel
.
h
\
src
/
QmlControls
/
QmlObjectListModel
.
h
\
src
/
SerialPortIds
.
h
\
src
/
SerialPortIds
.
h
\
...
@@ -390,8 +392,10 @@ SOURCES += \
...
@@ -390,8 +392,10 @@ SOURCES += \
src
/
QGCQuickWidget
.
cc
\
src
/
QGCQuickWidget
.
cc
\
src
/
QGCSingleton
.
cc
\
src
/
QGCSingleton
.
cc
\
src
/
QGCTemporaryFile
.
cc
\
src
/
QGCTemporaryFile
.
cc
\
src
/
QmlControls
/
CoordinateVector
.
cc
\
src
/
QmlControls
/
ParameterEditorController
.
cc
\
src
/
QmlControls
/
ParameterEditorController
.
cc
\
src
/
QmlControls
/
ScreenToolsController
.
cc
\
src
/
QmlControls
/
ScreenToolsController
.
cc
\
src
/
QmlControls
/
QGCQGeoCoordinate
.
cc
\
src
/
QmlControls
/
QGroundControlQmlGlobal
.
cc
\
src
/
QmlControls
/
QGroundControlQmlGlobal
.
cc
\
src
/
QmlControls
/
QmlObjectListModel
.
cc
\
src
/
QmlControls
/
QmlObjectListModel
.
cc
\
src
/
uas
/
FileManager
.
cc
\
src
/
uas
/
FileManager
.
cc
\
...
...
src/FlightDisplay/FlightDisplayView.qml
View file @
4ef772d6
...
@@ -120,6 +120,22 @@ Item {
...
@@ -120,6 +120,22 @@ Item {
visible
:
_activeVehicle
?
_activeVehicle
.
homePositionAvailable
:
false
visible
:
_activeVehicle
?
_activeVehicle
.
homePositionAvailable
:
false
}
}
// Add trajectory points to the map
MapItemView
{
model
:
multiVehicleManager
.
activeVehicle
?
multiVehicleManager
.
activeVehicle
.
trajectoryPoints
:
0
delegate
:
MapPolyline
{
line.width
:
3
line.color
:
"
orange
"
path
:
[
{
latitude
:
object
.
coordinate1
.
latitude
,
longitude
:
object
.
coordinate1
.
longitude
},
{
latitude
:
object
.
coordinate2
.
latitude
,
longitude
:
object
.
coordinate2
.
longitude
},
]
}
}
// Add the vehicles to the map
// Add the vehicles to the map
MapItemView
{
MapItemView
{
model
:
multiVehicleManager
.
vehicles
model
:
multiVehicleManager
.
vehicles
...
...
src/QGCApplication.cc
View file @
4ef772d6
...
@@ -84,6 +84,8 @@
...
@@ -84,6 +84,8 @@
#include "QGroundControlQmlGlobal.h"
#include "QGroundControlQmlGlobal.h"
#include "HomePositionManager.h"
#include "HomePositionManager.h"
#include "FlightMapSettings.h"
#include "FlightMapSettings.h"
#include "QGCQGeoCoordinate.h"
#include "CoordinateVector.h"
#ifndef __ios__
#ifndef __ios__
#include "SerialLink.h"
#include "SerialLink.h"
...
@@ -343,6 +345,8 @@ void QGCApplication::_initCommon(void)
...
@@ -343,6 +345,8 @@ void QGCApplication::_initCommon(void)
qmlRegisterUncreatableType
<
JoystickManager
>
(
"QGroundControl.JoystickManager"
,
1
,
0
,
"JoystickManager"
,
"Reference only"
);
qmlRegisterUncreatableType
<
JoystickManager
>
(
"QGroundControl.JoystickManager"
,
1
,
0
,
"JoystickManager"
,
"Reference only"
);
qmlRegisterUncreatableType
<
Joystick
>
(
"QGroundControl.JoystickManager"
,
1
,
0
,
"Joystick"
,
"Reference only"
);
qmlRegisterUncreatableType
<
Joystick
>
(
"QGroundControl.JoystickManager"
,
1
,
0
,
"Joystick"
,
"Reference only"
);
qmlRegisterUncreatableType
<
QmlObjectListModel
>
(
"QGroundControl"
,
1
,
0
,
"QmlObjectListModel"
,
"Reference only"
);
qmlRegisterUncreatableType
<
QmlObjectListModel
>
(
"QGroundControl"
,
1
,
0
,
"QmlObjectListModel"
,
"Reference only"
);
qmlRegisterUncreatableType
<
QGCQGeoCoordinate
>
(
"QGroundControl"
,
1
,
0
,
"QGCQGeoCoordinate"
,
"Reference only"
);
qmlRegisterUncreatableType
<
CoordinateVector
>
(
"QGroundControl"
,
1
,
0
,
"CoordinateVector"
,
"Reference only"
);
qmlRegisterType
<
ViewWidgetController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"ViewWidgetController"
);
qmlRegisterType
<
ViewWidgetController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"ViewWidgetController"
);
qmlRegisterType
<
ParameterEditorController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"ParameterEditorController"
);
qmlRegisterType
<
ParameterEditorController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"ParameterEditorController"
);
...
...
src/QmlControls/CoordinateVector.cc
0 → 100644
View file @
4ef772d6
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/// @file
/// @author Don Gagne <don@thegagnes.com>
#include "CoordinateVector.h"
CoordinateVector
::
CoordinateVector
(
QObject
*
parent
)
:
QObject
(
parent
)
{
}
CoordinateVector
::
CoordinateVector
(
const
QGeoCoordinate
&
coordinate1
,
const
QGeoCoordinate
&
coordinate2
,
QObject
*
parent
)
:
QObject
(
parent
)
,
_coordinate1
(
coordinate1
)
,
_coordinate2
(
coordinate2
)
{
}
CoordinateVector
::~
CoordinateVector
()
{
}
void
CoordinateVector
::
setCoordinates
(
const
QGeoCoordinate
&
coordinate1
,
const
QGeoCoordinate
&
coordinate2
)
{
_coordinate1
=
coordinate1
;
_coordinate2
=
coordinate2
;
emit
coordinate1Changed
(
_coordinate1
);
emit
coordinate2Changed
(
_coordinate2
);
}
src/QmlControls/CoordinateVector.h
0 → 100644
View file @
4ef772d6
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
#ifndef CoordinateVector_H
#define CoordinateVector_H
#include <QObject>
#include <QGeoCoordinate>
class
CoordinateVector
:
public
QObject
{
Q_OBJECT
public:
CoordinateVector
(
QObject
*
parent
=
NULL
);
CoordinateVector
(
const
QGeoCoordinate
&
coordinate1
,
const
QGeoCoordinate
&
coordinate2
,
QObject
*
parent
=
NULL
);
~
CoordinateVector
();
Q_PROPERTY
(
QGeoCoordinate
coordinate1
MEMBER
_coordinate1
NOTIFY
coordinate1Changed
)
Q_PROPERTY
(
QGeoCoordinate
coordinate2
MEMBER
_coordinate2
NOTIFY
coordinate2Changed
)
void
setCoordinates
(
const
QGeoCoordinate
&
coordinate1
,
const
QGeoCoordinate
&
coordinate2
);
signals:
void
coordinate1Changed
(
QGeoCoordinate
coordinate
);
void
coordinate2Changed
(
QGeoCoordinate
coordinate
);
private:
QGeoCoordinate
_coordinate1
;
QGeoCoordinate
_coordinate2
;
};
#endif
src/QmlControls/QGCQGeoCoordinate.cc
0 → 100644
View file @
4ef772d6
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/// @file
/// @author Don Gagne <don@thegagnes.com>
#include "QGCQGeoCoordinate.h"
QGCQGeoCoordinate
::
QGCQGeoCoordinate
(
QObject
*
parent
)
:
QObject
(
parent
)
{
}
QGCQGeoCoordinate
::
QGCQGeoCoordinate
(
const
QGeoCoordinate
&
coordinate
,
QObject
*
parent
)
:
QObject
(
parent
)
,
_coordinate
(
coordinate
)
{
}
QGCQGeoCoordinate
::~
QGCQGeoCoordinate
()
{
}
void
QGCQGeoCoordinate
::
setCoordinate
(
const
QGeoCoordinate
&
coordinate
)
{
_coordinate
=
coordinate
;
emit
coordinateChanged
(
_coordinate
);
}
src/QmlControls/QGCQGeoCoordinate.h
0 → 100644
View file @
4ef772d6
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
#ifndef QGCQGeoCoordinate_H
#define QGCQGeoCoordinate_H
#include <QObject>
#include <QGeoCoordinate>
/// This class wraps a QGeoCoordinate in a QObject so that it can be used from within a
/// QmlObjectListModel.
class
QGCQGeoCoordinate
:
public
QObject
{
Q_OBJECT
public:
QGCQGeoCoordinate
(
QObject
*
parent
=
NULL
);
QGCQGeoCoordinate
(
const
QGeoCoordinate
&
coordinate
,
QObject
*
parent
=
NULL
);
~
QGCQGeoCoordinate
();
Q_PROPERTY
(
QGeoCoordinate
coordinate
MEMBER
_coordinate
NOTIFY
coordinateChanged
)
void
setCoordinate
(
const
QGeoCoordinate
&
coordinate
);
signals:
void
coordinateChanged
(
QGeoCoordinate
coordinate
);
private:
QGeoCoordinate
_coordinate
;
};
#endif
src/Vehicle/Vehicle.cc
View file @
4ef772d6
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include "UAS.h"
#include "UAS.h"
#include "JoystickManager.h"
#include "JoystickManager.h"
#include "MissionManager.h"
#include "MissionManager.h"
#include "CoordinateVector.h"
QGC_LOGGING_CATEGORY
(
VehicleLog
,
"VehicleLog"
)
QGC_LOGGING_CATEGORY
(
VehicleLog
,
"VehicleLog"
)
...
@@ -169,6 +170,9 @@ Vehicle::Vehicle(LinkInterface* link, int vehicleId, MAV_AUTOPILOT firmwareType,
...
@@ -169,6 +170,9 @@ Vehicle::Vehicle(LinkInterface* link, int vehicleId, MAV_AUTOPILOT firmwareType,
_sendMultipleTimer
.
start
(
_sendMessageMultipleIntraMessageDelay
);
_sendMultipleTimer
.
start
(
_sendMessageMultipleIntraMessageDelay
);
connect
(
&
_sendMultipleTimer
,
&
QTimer
::
timeout
,
this
,
&
Vehicle
::
_sendMessageMultipleNext
);
connect
(
&
_sendMultipleTimer
,
&
QTimer
::
timeout
,
this
,
&
Vehicle
::
_sendMessageMultipleNext
);
_mapTrajectoryTimer
.
setInterval
(
_mapTrajectoryMsecsBetweenPoints
);
connect
(
&
_mapTrajectoryTimer
,
&
QTimer
::
timeout
,
this
,
&
Vehicle
::
_addNewMapTrajectoryPoint
);
}
}
Vehicle
::~
Vehicle
()
Vehicle
::~
Vehicle
()
...
@@ -257,6 +261,13 @@ void Vehicle::_handleHeartbeat(mavlink_message_t& message)
...
@@ -257,6 +261,13 @@ void Vehicle::_handleHeartbeat(mavlink_message_t& message)
if
(
_armed
!=
newArmed
)
{
if
(
_armed
!=
newArmed
)
{
_armed
=
newArmed
;
_armed
=
newArmed
;
emit
armedChanged
(
_armed
);
emit
armedChanged
(
_armed
);
// We are transitioning to the armed state, begin tracking trajectory points for the map
if
(
_armed
)
{
_mapTrajectoryStart
();
}
else
{
_mapTrajectoryStop
();
}
}
}
if
(
heartbeat
.
base_mode
!=
_base_mode
||
heartbeat
.
custom_mode
!=
_custom_mode
)
{
if
(
heartbeat
.
base_mode
!=
_base_mode
||
heartbeat
.
custom_mode
!=
_custom_mode
)
{
...
@@ -1129,3 +1140,24 @@ void Vehicle::_missionManagerError(int errorCode, const QString& errorMsg)
...
@@ -1129,3 +1140,24 @@ void Vehicle::_missionManagerError(int errorCode, const QString& errorMsg)
Q_UNUSED
(
errorCode
);
Q_UNUSED
(
errorCode
);
qgcApp
()
->
showToolBarMessage
(
QString
(
"Error during Mission communication with Vehicle: %1"
).
arg
(
errorMsg
));
qgcApp
()
->
showToolBarMessage
(
QString
(
"Error during Mission communication with Vehicle: %1"
).
arg
(
errorMsg
));
}
}
void
Vehicle
::
_addNewMapTrajectoryPoint
(
void
)
{
if
(
_mapTrajectoryHaveFirstCoordinate
)
{
_mapTrajectoryList
.
append
(
new
CoordinateVector
(
_mapTrajectoryLastCoordinate
,
_geoCoordinate
,
this
));
}
_mapTrajectoryHaveFirstCoordinate
=
true
;
_mapTrajectoryLastCoordinate
=
_geoCoordinate
;
}
void
Vehicle
::
_mapTrajectoryStart
(
void
)
{
_mapTrajectoryHaveFirstCoordinate
=
false
;
_mapTrajectoryList
.
clear
();
_mapTrajectoryTimer
.
start
();
}
void
Vehicle
::
_mapTrajectoryStop
()
{
_mapTrajectoryTimer
.
stop
();
}
src/Vehicle/Vehicle.h
View file @
4ef772d6
...
@@ -73,6 +73,8 @@ public:
...
@@ -73,6 +73,8 @@ public:
Q_PROPERTY
(
bool
missingParameters
READ
missingParameters
NOTIFY
missingParametersChanged
)
Q_PROPERTY
(
bool
missingParameters
READ
missingParameters
NOTIFY
missingParametersChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
trajectoryPoints
READ
trajectoryPoints
CONSTANT
)
Q_INVOKABLE
QString
getMavIconColor
();
Q_INVOKABLE
QString
getMavIconColor
();
//-- System Messages
//-- System Messages
...
@@ -185,6 +187,8 @@ public:
...
@@ -185,6 +187,8 @@ public:
bool
hilMode
(
void
);
bool
hilMode
(
void
);
void
setHilMode
(
bool
hilMode
);
void
setHilMode
(
bool
hilMode
);
QmlObjectListModel
*
trajectoryPoints
(
void
)
{
return
&
_mapTrajectoryList
;
}
/// Requests the specified data stream from the vehicle
/// Requests the specified data stream from the vehicle
/// @param stream Stream which is being requested
/// @param stream Stream which is being requested
/// @param rate Rate at which to send stream in Hz
/// @param rate Rate at which to send stream in Hz
...
@@ -300,6 +304,7 @@ private slots:
...
@@ -300,6 +304,7 @@ private slots:
void
_linkDisconnected
(
LinkInterface
*
link
);
void
_linkDisconnected
(
LinkInterface
*
link
);
void
_sendMessage
(
mavlink_message_t
message
);
void
_sendMessage
(
mavlink_message_t
message
);
void
_sendMessageMultipleNext
(
void
);
void
_sendMessageMultipleNext
(
void
);
void
_addNewMapTrajectoryPoint
(
void
);
void
_handleTextMessage
(
int
newCount
);
void
_handleTextMessage
(
int
newCount
);
/** @brief Attitude from main autopilot / system state */
/** @brief Attitude from main autopilot / system state */
...
@@ -335,6 +340,8 @@ private:
...
@@ -335,6 +340,8 @@ private:
void
_handleHomePosition
(
mavlink_message_t
&
message
);
void
_handleHomePosition
(
mavlink_message_t
&
message
);
void
_handleHeartbeat
(
mavlink_message_t
&
message
);
void
_handleHeartbeat
(
mavlink_message_t
&
message
);
void
_missionManagerError
(
int
errorCode
,
const
QString
&
errorMsg
);
void
_missionManagerError
(
int
errorCode
,
const
QString
&
errorMsg
);
void
_mapTrajectoryStart
(
void
);
void
_mapTrajectoryStop
(
void
);
bool
_isAirplane
();
bool
_isAirplane
();
void
_addChange
(
int
id
);
void
_addChange
(
int
id
);
...
@@ -425,6 +432,12 @@ private:
...
@@ -425,6 +432,12 @@ private:
QTimer
_sendMultipleTimer
;
QTimer
_sendMultipleTimer
;
int
_nextSendMessageMultipleIndex
;
int
_nextSendMessageMultipleIndex
;
QTimer
_mapTrajectoryTimer
;
QmlObjectListModel
_mapTrajectoryList
;
QGeoCoordinate
_mapTrajectoryLastCoordinate
;
bool
_mapTrajectoryHaveFirstCoordinate
;
static
const
int
_mapTrajectoryMsecsBetweenPoints
=
1000
;
// Settings keys
// Settings keys
static
const
char
*
_settingsGroup
;
static
const
char
*
_settingsGroup
;
static
const
char
*
_joystickModeSettingsKey
;
static
const
char
*
_joystickModeSettingsKey
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment