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
98f17071
Commit
98f17071
authored
Sep 09, 2011
by
pixhawk
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev-mac' of
https://github.com/pixhawk/qgroundcontrol
into dev
parents
3c3718e5
8c4e94dd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
81 additions
and
40 deletions
+81
-40
UAS.cc
src/uas/UAS.cc
+5
-1
UAS.h
src/uas/UAS.h
+17
-7
UASInterface.h
src/uas/UASInterface.h
+2
-0
WaypointList.cc
src/ui/WaypointList.cc
+57
-32
No files found.
src/uas/UAS.cc
View file @
98f17071
...
...
@@ -76,7 +76,9 @@ airframe(0),
attitudeKnown
(
false
),
paramManager
(
NULL
),
attitudeStamped
(
false
),
lastAttitude
(
0
)
lastAttitude
(
0
),
isLocalPositionKnown
(
false
),
isGlobalPositionKnown
(
false
)
{
color
=
UASInterface
::
getNextColor
();
setBattery
(
LIPOLY
,
3
);
...
...
@@ -545,6 +547,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
GAudioOutput
::
instance
()
->
notifyPositive
();
}
positionLock
=
true
;
isLocalPositionKnown
=
true
;
}
break
;
case
MAVLINK_MSG_ID_GLOBAL_POSITION_INT
:
...
...
@@ -573,6 +576,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
GAudioOutput
::
instance
()
->
notifyPositive
();
}
positionLock
=
true
;
isGlobalPositionKnown
=
true
;
//TODO fix this hack for forwarding of global position for patch antenna tracking
forwardMessage
(
message
);
}
...
...
src/uas/UAS.h
View file @
98f17071
...
...
@@ -105,6 +105,14 @@ public:
double
getAltitude
()
const
{
return
altitude
;
}
virtual
bool
localPositionKnown
()
const
{
return
isLocalPositionKnown
;
}
virtual
bool
globalPositionKnown
()
const
{
return
isGlobalPositionKnown
;
}
double
getRoll
()
const
{
return
roll
;
...
...
@@ -198,14 +206,16 @@ protected: //COMMENTS FOR TEST UNIT
quint64
imageStart
;
QMap
<
int
,
QMap
<
QString
,
float
>*
>
parameters
;
///< All parameters
bool
paramsOnceRequested
;
///< If the parameter list has been read at least once
int
airframe
;
///< The airframe type
bool
attitudeKnown
;
///< True if attitude was received, false else
bool
paramsOnceRequested
;
///< If the parameter list has been read at least once
int
airframe
;
///< The airframe type
bool
attitudeKnown
;
///< True if attitude was received, false else
QGCUASParamManager
*
paramManager
;
///< Parameter manager class
QString
shortStateText
;
///< Short textual state description
QString
shortModeText
;
///< Short textual mode description
bool
attitudeStamped
;
///< Should arriving data be timestamped with the last attitude? This helps with broken system time clocks on the MAV
quint64
lastAttitude
;
///< Timestamp of last attitude measurement
QString
shortStateText
;
///< Short textual state description
QString
shortModeText
;
///< Short textual mode description
bool
attitudeStamped
;
///< Should arriving data be timestamped with the last attitude? This helps with broken system time clocks on the MAV
quint64
lastAttitude
;
///< Timestamp of last attitude measurement
bool
isLocalPositionKnown
;
///< If the local position has been received for this MAV
bool
isGlobalPositionKnown
;
///< If the global position has been received for this MAV
public:
/** @brief Set the current battery type */
...
...
src/uas/UASInterface.h
View file @
98f17071
...
...
@@ -74,10 +74,12 @@ public:
virtual
double
getLocalX
()
const
=
0
;
virtual
double
getLocalY
()
const
=
0
;
virtual
double
getLocalZ
()
const
=
0
;
virtual
bool
localPositionKnown
()
const
=
0
;
virtual
double
getLatitude
()
const
=
0
;
virtual
double
getLongitude
()
const
=
0
;
virtual
double
getAltitude
()
const
=
0
;
virtual
bool
globalPositionKnown
()
const
=
0
;
virtual
double
getRoll
()
const
=
0
;
virtual
double
getPitch
()
const
=
0
;
...
...
src/ui/WaypointList.cc
View file @
98f17071
...
...
@@ -166,54 +166,72 @@ void WaypointList::read()
void
WaypointList
::
add
()
{
if
(
uas
)
{
if
(
uas
)
{
const
QVector
<
Waypoint
*>
&
waypoints
=
uas
->
getWaypointManager
()
->
getWaypointList
();
Waypoint
*
wp
;
if
(
waypoints
.
size
()
>
0
)
{
if
(
waypoints
.
size
()
>
0
)
{
// Create waypoint with last frame
Waypoint
*
last
=
waypoints
.
at
(
waypoints
.
size
()
-
1
);
wp
=
new
Waypoint
(
0
,
last
->
getX
(),
last
->
getY
(),
last
->
getZ
(),
last
->
getParam1
(),
last
->
getParam2
(),
last
->
getParam3
(),
last
->
getParam4
(),
last
->
getAutoContinue
(),
false
,
last
->
getFrame
(),
last
->
getAction
());
uas
->
getWaypointManager
()
->
addWaypoint
(
wp
);
}
else
{
// Create global frame waypoint per default
wp
=
new
Waypoint
(
0
,
uas
->
getLatitude
(),
uas
->
getLongitude
(),
uas
->
getAltitude
(),
0.0
,
0.0
,
0.0
,
0.0
,
true
,
true
,
MAV_FRAME_GLOBAL
,
MAV_CMD_NAV_WAYPOINT
);
uas
->
getWaypointManager
()
->
addWaypoint
(
wp
);
}
else
{
// Create first waypoint at current MAV position
addCurrentPositonWaypoint
();
}
}
}
void
WaypointList
::
addCurrentPositonWaypoint
()
{
/* TODO: implement with new waypoint structure
if
(
uas
)
{
// For Global Waypoints
//if(isGlobalWP)
//{
//isLocalWP = false;
//}
//else
const
QVector
<
Waypoint
*>
&
waypoints
=
uas
->
getWaypointManager
()
->
getWaypointList
();
Waypoint
*
wp
;
Waypoint
*
last
=
0
;
if
(
waypoints
.
size
()
>
0
)
{
const QVector<Waypoint *> &waypoints = uas->getWaypointManager()->getWaypointList();
if (waypoints.size() > 0)
last
=
waypoints
.
at
(
waypoints
.
size
()
-
1
);
}
if
(
uas
->
globalPositionKnown
())
{
float
acceptanceRadiusGlobal
=
10.0
f
;
float
holdTime
=
0.0
f
;
float
yawGlobal
=
0.0
f
;
if
(
last
)
{
Waypoint *last = waypoints.at(waypoints.size()-1
);
Waypoint *wp = new Waypoint(0, (qRound(mavX*100))/100., (qRound(mavY*100))/100., (qRound(mavZ*100))/100., (qRound(mavYaw*100))/100., last->getAutoContinue(), false, last->getOrbit(), last->getHoldTime()
);
uas->getWaypointManager()->addWaypoint(wp
);
acceptanceRadiusGlobal
=
last
->
getAcceptanceRadius
(
);
holdTime
=
last
->
getHoldTime
(
);
yawGlobal
=
last
->
getYaw
(
);
}
else
// Create global frame waypoint per default
wp
=
new
Waypoint
(
0
,
uas
->
getLatitude
(),
uas
->
getLongitude
(),
uas
->
getAltitude
(),
yawGlobal
,
acceptanceRadiusGlobal
,
holdTime
,
0.0
,
true
,
true
,
MAV_FRAME_GLOBAL_RELATIVE_ALT
,
MAV_CMD_NAV_WAYPOINT
);
uas
->
getWaypointManager
()
->
addWaypoint
(
wp
);
}
else
if
(
uas
->
localPositionKnown
())
{
float
acceptanceRadiusLocal
=
0.2
f
;
float
holdTime
=
0.5
f
;
if
(
last
)
{
Waypoint *wp = new Waypoint(0, (qRound(mavX*100))/100., (qRound(mavY*100))/100., (qRound(mavZ*100))/100., (qRound(mavYaw*100))/100., true, true, 0.15, 2000
);
uas->getWaypointManager()->addWaypoint(wp
);
acceptanceRadiusLocal
=
last
->
getAcceptanceRadius
(
);
holdTime
=
last
->
getHoldTime
(
);
}
//isLocalWP = true;
// Create local frame waypoint as second option
wp
=
new
Waypoint
(
0
,
uas
->
getLocalX
(),
uas
->
getLocalY
(),
uas
->
getLocalZ
(),
uas
->
getYaw
(),
acceptanceRadiusLocal
,
holdTime
,
0.0
,
true
,
true
,
MAV_FRAME_LOCAL
,
MAV_CMD_NAV_WAYPOINT
);
uas
->
getWaypointManager
()
->
addWaypoint
(
wp
);
}
else
{
// Do nothing
updateStatusLabel
(
tr
(
"Not adding waypoint, no position known of MAV known yet."
));
}
}
*/
}
void
WaypointList
::
updateStatusLabel
(
const
QString
&
string
)
...
...
@@ -223,23 +241,30 @@ void WaypointList::updateStatusLabel(const QString &string)
void
WaypointList
::
changeCurrentWaypoint
(
quint16
seq
)
{
if
(
uas
)
{
if
(
uas
)
{
uas
->
getWaypointManager
()
->
setCurrentWaypoint
(
seq
);
}
}
void
WaypointList
::
currentWaypointChanged
(
quint16
seq
)
{
if
(
uas
)
{
if
(
uas
)
{
const
QVector
<
Waypoint
*>
&
waypoints
=
uas
->
getWaypointManager
()
->
getWaypointList
();
if
(
seq
<
waypoints
.
size
())
{
for
(
int
i
=
0
;
i
<
waypoints
.
size
();
i
++
)
{
if
(
seq
<
waypoints
.
size
())
{
for
(
int
i
=
0
;
i
<
waypoints
.
size
();
i
++
)
{
WaypointView
*
widget
=
wpViews
.
find
(
waypoints
[
i
]).
value
();
if
(
waypoints
[
i
]
->
getId
()
==
seq
)
{
if
(
waypoints
[
i
]
->
getId
()
==
seq
)
{
widget
->
setCurrent
(
true
);
}
else
{
}
else
{
widget
->
setCurrent
(
false
);
}
}
...
...
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