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
748f1dd9
Commit
748f1dd9
authored
Sep 08, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1853 from DonLakeFlyer/MissionEdit
More mission editing work
parents
c6aff9f4
2ca5bd84
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
213 additions
and
83 deletions
+213
-83
Fact.h
src/FactSystem/Fact.h
+3
-0
MissionItem.cc
src/MissionItem.cc
+142
-33
MissionItem.h
src/MissionItem.h
+40
-21
MissionItemEditor.qml
src/QmlControls/MissionItemEditor.qml
+24
-25
HSIDisplay.cc
src/ui/HSIDisplay.cc
+1
-1
QGCMapWidget.cc
src/ui/map/QGCMapWidget.cc
+1
-1
Waypoint2DIcon.cc
src/ui/map/Waypoint2DIcon.cc
+2
-2
No files found.
src/FactSystem/Fact.h
View file @
748f1dd9
...
...
@@ -92,6 +92,9 @@ public:
void
_containerSetValue
(
const
QVariant
&
value
);
/// Generally you should not change the name of a fact. But if you know what you are doing, you can.
void
_setName
(
const
QString
&
name
)
{
_name
=
name
;
}
signals:
/// QObject Property System signal for value property changes
///
...
...
src/MissionItem.cc
View file @
748f1dd9
This diff is collapsed.
Click to expand it.
src/MissionItem.h
View file @
748f1dd9
...
...
@@ -33,6 +33,8 @@
#include "QGCMAVLink.h"
#include "QGC.h"
#include "MavlinkQmlSingleton.h"
#include "QmlObjectListModel.h"
#include "Fact.h"
class
MissionItem
:
public
QObject
{
...
...
@@ -56,17 +58,18 @@ public:
const
MissionItem
&
operator
=
(
const
MissionItem
&
other
);
Q_PROPERTY
(
int
sequenceNumber
READ
sequenceNumber
WRITE
setSequenceNumber
NOTIFY
sequenceNumberChanged
)
Q_PROPERTY
(
bool
isCurrentItem
READ
isCurrentItem
WRITE
setIsCurrentItem
NOTIFY
isCurrentItemChanged
)
Q_PROPERTY
(
bool
specifiesCoordinate
READ
specifiesCoordinate
NOTIFY
specifiesCoordinateChanged
)
Q_PROPERTY
(
QGeoCoordinate
coordinate
READ
coordinate
WRITE
setCoordinate
NOTIFY
coordinateChanged
)
Q_PROPERTY
(
double
yaw
READ
yaw
WRITE
setYaw
NOTIFY
yawChanged
)
Q_PROPERTY
(
QStringList
commandNames
READ
commandNames
CONSTANT
)
Q_PROPERTY
(
QString
commandName
READ
commandName
NOTIFY
commandChanged
)
Q_PROPERTY
(
QStringList
valueLabels
READ
valueLabels
NOTIFY
commandChanged
)
Q_PROPERTY
(
QStringList
valueStrings
READ
valueStrings
NOTIFY
valueStringsChanged
)
Q_PROPERTY
(
int
commandByIndex
READ
commandByIndex
WRITE
setCommandByIndex
NOTIFY
commandChanged
)
Q_PROPERTY
(
MavlinkQmlSingleton
::
Qml_MAV_CMD
command
READ
command
WRITE
setCommand
NOTIFY
commandChanged
)
Q_PROPERTY
(
int
sequenceNumber
READ
sequenceNumber
WRITE
setSequenceNumber
NOTIFY
sequenceNumberChanged
)
Q_PROPERTY
(
bool
isCurrentItem
READ
isCurrentItem
WRITE
setIsCurrentItem
NOTIFY
isCurrentItemChanged
)
Q_PROPERTY
(
bool
specifiesCoordinate
READ
specifiesCoordinate
NOTIFY
specifiesCoordinateChanged
)
Q_PROPERTY
(
QGeoCoordinate
coordinate
READ
coordinate
WRITE
setCoordinate
NOTIFY
coordinateChanged
)
Q_PROPERTY
(
double
yaw
READ
yawDegrees
WRITE
setYawDegrees
NOTIFY
yawChanged
)
Q_PROPERTY
(
QStringList
commandNames
READ
commandNames
CONSTANT
)
Q_PROPERTY
(
QString
commandName
READ
commandName
NOTIFY
commandChanged
)
Q_PROPERTY
(
QStringList
valueLabels
READ
valueLabels
NOTIFY
commandChanged
)
Q_PROPERTY
(
QStringList
valueStrings
READ
valueStrings
NOTIFY
valueStringsChanged
)
Q_PROPERTY
(
int
commandByIndex
READ
commandByIndex
WRITE
setCommandByIndex
NOTIFY
commandChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
facts
READ
facts
NOTIFY
commandChanged
)
Q_PROPERTY
(
MavlinkQmlSingleton
::
Qml_MAV_CMD
command
READ
command
WRITE
setCommand
NOTIFY
commandChanged
)
// Property accesors
...
...
@@ -93,6 +96,11 @@ public:
QStringList
valueLabels
(
void
);
QStringList
valueStrings
(
void
);
QmlObjectListModel
*
facts
(
void
);
double
yawDegrees
(
void
)
const
;
void
setYawDegrees
(
double
yaw
);
// C++ only methods
double
latitude
(
void
)
const
{
return
_coordinate
.
latitude
();
}
...
...
@@ -111,8 +119,8 @@ public:
void
setY
(
double
y
);
void
setZ
(
double
z
);
double
yaw
(
void
)
const
{
return
_yaw
;
}
void
setYaw
(
double
yaw
);
double
yaw
Radians
(
void
)
const
;
void
setYaw
Radians
(
double
yaw
);
bool
getAutoContinue
()
const
{
return
_autocontinue
;
...
...
@@ -136,7 +144,7 @@ public:
return
_orbit
;
}
double
getParam4
()
const
{
return
yaw
();
return
yaw
Radians
();
}
double
getParam5
()
const
{
return
latitude
();
...
...
@@ -147,9 +155,6 @@ public:
double
getParam7
()
const
{
return
altitude
();
}
int
getTurns
()
const
{
return
_param1
;
}
// MAV_FRAME
int
getFrame
()
const
{
return
_frame
;
...
...
@@ -201,8 +206,6 @@ public:
void
setAcceptanceRadius
(
double
radius
);
void
setHoldTime
(
int
holdTime
);
void
setHoldTime
(
double
holdTime
);
/** @brief Number of turns for loiter waypoints */
void
setTurns
(
int
_turns
);
/** @brief Set waypoint as reached */
void
setReached
()
{
_reachedTime
=
QGC
::
groundTimeMilliseconds
();
}
/** @brief Wether this waypoint has been reached yet */
...
...
@@ -223,7 +226,7 @@ private:
int
_sequenceNumber
;
QGeoCoordinate
_coordinate
;
double
_yaw
;
double
_yaw
Radians
;
int
_frame
;
int
_action
;
bool
_autocontinue
;
...
...
@@ -231,9 +234,25 @@ private:
double
_orbit
;
double
_param1
;
double
_param2
;
int
_turns
;
quint64
_reachedTime
;
Fact
*
_yawFact
;
Fact
*
_pitchFact
;
Fact
*
_loiterRadiusFact
;
Fact
*
_param1Fact
;
Fact
*
_param2Fact
;
FactMetaData
*
_yawMetaData
;
FactMetaData
*
_pitchMetaData
;
FactMetaData
*
_acceptanceRadiusMetaData
;
FactMetaData
*
_holdTimeMetaData
;
FactMetaData
*
_loiterRadiusMetaData
;
FactMetaData
*
_loiterTurnsMetaData
;
FactMetaData
*
_loiterSecondsMetaData
;
FactMetaData
*
_delaySecondsMetaData
;
FactMetaData
*
_jumpSequenceMetaData
;
FactMetaData
*
_jumpRepeatMetaData
;
static
const
int
_cMavCmd2Name
=
9
;
static
const
MavCmd2Name_t
_rgMavCmd2Name
[
_cMavCmd2Name
];
};
...
...
src/QmlControls/MissionItemEditor.qml
View file @
748f1dd9
...
...
@@ -4,6 +4,8 @@ import QtQuick.Controls.Styles 1.2
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Vehicle
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
FactControls
1.0
/// Mission item edit control
Rectangle
{
...
...
@@ -117,32 +119,29 @@ Rectangle {
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
anchors.top
:
missionItem
.
specifiesCoordinate
?
_altitudeField
.
bottom
:
_commandCombo
.
bottom
spacing
:
parent
.
radius
/
2
Repeater
{
model
:
missionItem
.
valueLabels
QGCLabel
{
color
:
"
black
"
text
:
modelData
model
:
missionItem
.
facts
Item
{
width
:
_valueColumn
.
width
height
:
textField
.
height
QGCLabel
{
anchors.baseline
:
textField
.
baseline
color
:
"
black
"
text
:
object
.
name
}
FactTextField
{
id
:
textField
anchors.right
:
parent
.
right
width
:
_editFieldWidth
showUnits
:
true
fact
:
object
}
}
}
}
Column
{
anchors.margins
:
parent
.
radius
/
2
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
anchors.top
:
_valueColumn
.
top
Repeater
{
model
:
missionItem
.
valueStrings
QGCLabel
{
width
:
_valueColumn
.
width
color
:
"
black
"
text
:
modelData
horizontalAlignment
:
Text
.
AlignRight
}
}
}
}
}
// Column - Values column
}
// Rectangle
src/ui/HSIDisplay.cc
View file @
748f1dd9
...
...
@@ -1313,7 +1313,7 @@ void HSIDisplay::drawWaypoint(QPainter& painter, const QColor& color, float widt
float
radius
=
(
waypointSize
/
2.0
f
)
*
0.8
*
(
1
/
sqrt
(
2.0
f
));
float
acceptRadius
=
w
->
getAcceptanceRadius
();
double
yawDiff
=
w
->
yaw
()
/
180.0
*
M_PI
-
yaw
;
double
yawDiff
=
w
->
yaw
Radians
()
/
180.0
*
M_PI
-
yaw
;
// Draw background
pen
.
setColor
(
Qt
::
black
);
...
...
src/ui/map/QGCMapWidget.cc
View file @
748f1dd9
...
...
@@ -750,7 +750,7 @@ void QGCMapWidget::updateWaypoint(int uas, MissionItem* wp)
// Use safe standard interfaces for non MissionItem-class based wps
icon
->
SetCoord
(
internals
::
PointLatLng
(
wp
->
latitude
(),
wp
->
longitude
()));
icon
->
SetAltitude
(
wp
->
altitude
());
icon
->
SetHeading
(
wp
->
yaw
());
icon
->
SetHeading
(
wp
->
yaw
Radians
());
icon
->
SetNumber
(
wpindex
);
}
// Re-enable signals again
...
...
src/ui/map/Waypoint2DIcon.cc
View file @
748f1dd9
...
...
@@ -33,7 +33,7 @@ Waypoint2DIcon::Waypoint2DIcon(mapcontrol::MapGraphicItem* map, mapcontrol::OPMa
showOrbit
(
false
),
color
(
color
)
{
SetHeading
(
wp
->
yaw
());
SetHeading
(
wp
->
yaw
Radians
());
SetNumber
(
listindex
);
this
->
setFlag
(
QGraphicsItem
::
ItemIgnoresTransformations
,
true
);
picture
=
QPixmap
(
radius
+
1
,
radius
+
1
);
...
...
@@ -59,7 +59,7 @@ void Waypoint2DIcon::updateWaypoint()
// Store old size
static
QRectF
oldSize
;
SetHeading
(
waypoint
->
yaw
());
SetHeading
(
waypoint
->
yaw
Radians
());
SetCoord
(
internals
::
PointLatLng
(
waypoint
->
latitude
(),
waypoint
->
longitude
()));
// qDebug() << "UPDATING WP:" << waypoint->sequenceNumber() << "LAT:" << waypoint->latitude() << "LON:" << waypoint->longitude();
...
...
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