Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
88cf8600
Commit
88cf8600
authored
Jun 10, 2010
by
lm
Browse files
Fixed merge conflict
parents
9ec14c0e
88671631
Changes
12
Hide whitespace changes
Inline
Side-by-side
qgroundcontrol.pro
View file @
88cf8600
...
...
@@ -3,9 +3,9 @@
#
from
http
://
github
.
com
/
pixhawk
/
qmapcontrol
/
#
over
bundled
version
in
lib
directory
#
Version
from
GIT
repository
is
preferred
include
(
"../qmapcontrol/QMapControl/QMapControl.pri"
)
#
{
#
include
(
"../qmapcontrol/QMapControl/QMapControl.pri"
)
#
{
#
Include
bundled
version
if
necessary
#
include
(
lib
/
QMapControl
/
QMapControl
.
pri
)
include
(
lib
/
QMapControl
/
QMapControl
.
pri
)
#
message
(
"Including bundled QMapControl version as FALLBACK. This is fine on Linux and MacOS, but not the best choice in Windows"
)
...
...
src/Waypoint.cc
View file @
88cf8600
...
...
@@ -26,29 +26,21 @@ This file is part of the PIXHAWK project
* @brief Waypoint class
*
* @author Benjamin Knecht <mavteam@student.ethz.ch>
* @author Petri Tanskanen <mavteam@student.ethz.ch>
*
*/
#include
"Waypoint.h"
Waypoint
::
Waypoint
(
QString
name
,
int
id
,
double
x
,
double
y
,
double
z
,
double
yaw
,
bool
autocontinue
,
bool
current
)
Waypoint
::
Waypoint
(
qu
int
16
id
,
float
x
,
float
y
,
float
z
,
float
yaw
,
bool
autocontinue
,
bool
current
)
{
this
->
id
=
id
;
this
->
x
=
x
;
this
->
y
=
y
;
this
->
z
=
z
;
this
->
yaw
=
yaw
;
this
->
autocontinue
=
autocontinue
;
this
->
current
=
current
;
this
->
name
=
name
;
}
int
Waypoint
::
getId
()
{
return
id
;
}
Waypoint
::~
Waypoint
()
...
...
@@ -56,27 +48,27 @@ Waypoint::~Waypoint()
}
void
Waypoint
::
set
Name
(
QString
name
)
void
Waypoint
::
set
Id
(
quint16
id
)
{
this
->
name
=
name
;
this
->
id
=
id
;
}
void
Waypoint
::
setX
(
double
x
)
void
Waypoint
::
setX
(
float
x
)
{
this
->
x
=
x
;
}
void
Waypoint
::
setY
(
double
y
)
void
Waypoint
::
setY
(
float
y
)
{
this
->
y
=
y
;
}
void
Waypoint
::
setZ
(
double
z
)
void
Waypoint
::
setZ
(
float
z
)
{
this
->
z
=
z
;
}
void
Waypoint
::
setYaw
(
double
yaw
)
void
Waypoint
::
setYaw
(
float
yaw
)
{
this
->
yaw
=
yaw
;
}
...
...
@@ -90,3 +82,23 @@ void Waypoint::setCurrent(bool current)
{
this
->
current
=
current
;
}
void
Waypoint
::
setX
(
double
x
)
{
this
->
x
=
x
;
}
void
Waypoint
::
setY
(
double
y
)
{
this
->
y
=
y
;
}
void
Waypoint
::
setZ
(
double
z
)
{
this
->
z
=
z
;
}
void
Waypoint
::
setYaw
(
double
yaw
)
{
this
->
yaw
=
yaw
;
}
src/Waypoint.h
View file @
88cf8600
...
...
@@ -26,6 +26,7 @@ This file is part of the PIXHAWK project
* @brief Waypoint class
*
* @author Benjamin Knecht <mavteam@student.ethz.ch>
* @author Petri Tanskanen <mavteam@student.ethz.ch>
*
*/
...
...
@@ -38,35 +39,42 @@ This file is part of the PIXHAWK project
class
Waypoint
:
public
QObject
{
Q_OBJECT
public:
Waypoint
(
QString
name
,
int
id
=
0
,
double
x
=
0.0
f
,
double
y
=
0.0
f
,
double
z
=
0.0
f
,
double
yaw
=
0.0
f
,
bool
autocontinue
=
false
,
bool
current
=
false
);
Waypoint
(
qu
int
16
id
=
0
,
float
x
=
0.0
f
,
float
y
=
0.0
f
,
float
z
=
0.0
f
,
float
yaw
=
0.0
f
,
bool
autocontinue
=
false
,
bool
current
=
false
);
~
Waypoint
();
int
getId
();
int
id
;
double
x
;
double
y
;
double
z
;
double
yaw
;
quint16
getId
()
const
{
return
id
;
}
float
getX
()
const
{
return
x
;
}
float
getY
()
const
{
return
y
;
}
float
getZ
()
const
{
return
z
;
}
float
getYaw
()
const
{
return
yaw
;
}
bool
getAutoContinue
()
const
{
return
autocontinue
;
}
bool
getCurrent
()
const
{
return
current
;
}
private:
quint16
id
;
float
x
;
float
y
;
float
z
;
float
yaw
;
bool
autocontinue
;
bool
current
;
QString
name
;
public
slots
:
void
setName
(
QString
name
);
void
setId
(
quint16
id
);
void
setX
(
float
x
);
void
setY
(
float
y
);
void
setZ
(
float
z
);
void
setYaw
(
float
yaw
);
void
setAutocontinue
(
bool
autoContinue
);
void
setCurrent
(
bool
current
);
//for QDoubleSpin
void
setX
(
double
x
);
void
setY
(
double
y
);
void
setZ
(
double
z
);
void
setYaw
(
double
yaw
);
void
setAutocontinue
(
bool
autoContinue
);
void
setCurrent
(
bool
current
);
};
#endif // WAYPOINT_H
src/uas/UASWaypointManager.cc
View file @
88cf8600
...
...
@@ -15,22 +15,13 @@ void UASWaypointManager::handleWaypointCount(quint8 systemId, quint8 compId, qui
{
if
(
current_state
==
WP_GETLIST
&&
systemId
==
current_partner_systemid
&&
compId
==
current_partner_compid
)
{
qDebug
()
<<
"
handleW
aypoint
C
ount
"
;
qDebug
()
<<
"
got w
aypoint
c
ount
("
<<
count
<<
") from ID "
<<
systemId
;
current_count
=
count
;
mavlink_message_t
message
;
mavlink_waypoint_request_t
wpr
;
wpr
.
target_system
=
uas
.
getUASID
();
wpr
.
target_component
=
MAV_COMP_ID_WAYPOINTPLANNER
;
wpr
.
seq
=
0
;
current_wp_id
=
0
;
current_state
=
WP_GETLIST_GETWPS
;
mavlink_msg_waypoint_request_encode
(
uas
.
mavlink
->
getSystemId
(),
uas
.
mavlink
->
getComponentId
(),
&
message
,
&
wpr
);
uas
.
sendMessage
(
message
);
sendWaypointRequest
(
current_wp_id
);
}
}
...
...
@@ -38,7 +29,7 @@ void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_
{
if
(
systemId
==
current_partner_systemid
&&
compId
==
current_partner_compid
&&
current_state
==
WP_GETLIST_GETWPS
&&
wp
->
seq
==
current_wp_id
)
{
qDebug
()
<<
"
handleWaypoint"
;
qDebug
()
<<
"
got waypoint ("
<<
wp
->
seq
<<
") from ID "
<<
systemId
;
if
(
wp
->
seq
==
current_wp_id
)
{
...
...
@@ -50,15 +41,7 @@ void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_
if
(
current_wp_id
<
current_count
)
{
mavlink_message_t
message
;
mavlink_waypoint_request_t
wpr
;
wpr
.
target_system
=
uas
.
getUASID
();
wpr
.
target_component
=
MAV_COMP_ID_WAYPOINTPLANNER
;
wpr
.
seq
=
current_wp_id
;
mavlink_msg_waypoint_request_encode
(
uas
.
mavlink
->
getSystemId
(),
uas
.
mavlink
->
getComponentId
(),
&
message
,
&
wpr
);
uas
.
sendMessage
(
message
);
sendWaypointRequest
(
current_wp_id
);
}
else
{
...
...
@@ -68,6 +51,10 @@ void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_
current_wp_id
=
0
;
current_partner_systemid
=
0
;
current_partner_compid
=
0
;
emit
updateStatusString
(
"done."
);
qDebug
()
<<
"got all waypoints from from ID "
<<
systemId
;
}
}
else
...
...
@@ -83,7 +70,7 @@ void UASWaypointManager::handleWaypointRequest(quint8 systemId, quint8 compId, m
{
qDebug
()
<<
"handleWaypointRequest"
;
if
(
wpr
->
seq
>
0
)
if
(
wpr
->
seq
<
waypoint_buffer
.
count
()
)
{
//TODO: send waypoint
}
...
...
@@ -99,12 +86,12 @@ void UASWaypointManager::clearWaypointList()
}
void
UASWaypointManager
::
currentWaypointChanged
(
int
)
void
UASWaypointManager
::
currentWaypointChanged
(
qu
int
16
)
{
}
void
UASWaypointManager
::
removeWaypointId
(
int
)
void
UASWaypointManager
::
removeWaypointId
(
qu
int
16
)
{
}
...
...
@@ -113,7 +100,6 @@ void UASWaypointManager::requestWaypoints()
{
if
(
current_state
==
WP_IDLE
)
{
qDebug
()
<<
"requestWaypoints"
;
mavlink_message_t
message
;
mavlink_waypoint_request_list_t
wprl
;
...
...
@@ -125,27 +111,80 @@ void UASWaypointManager::requestWaypoints()
current_partner_systemid
=
uas
.
getUASID
();
current_partner_compid
=
MAV_COMP_ID_WAYPOINTPLANNER
;
qDebug
()
<<
"sent waypoint list request to ID "
<<
wprl
.
target_system
;
const
QString
str
=
QString
(
"requesting waypoint list..."
);
emit
updateStatusString
(
str
);
mavlink_msg_waypoint_request_list_encode
(
uas
.
mavlink
->
getSystemId
(),
uas
.
mavlink
->
getComponentId
(),
&
message
,
&
wprl
);
uas
.
sendMessage
(
message
);
uas
.
sendMessage
(
message
);
}
}
void
UASWaypointManager
::
sendWaypoints
(
void
)
void
UASWaypointManager
::
sendWaypoints
(
const
QVector
<
Waypoint
*>
&
list
)
{
mavlink_message_t
message
;
mavlink_waypoint_count_t
wpc
;
if
(
current_state
==
WP_IDLE
)
{
current_count
=
list
.
count
();
current_state
=
WP_SENDLIST
;
current_wp_id
=
0
;
wpc
.
target_system
=
uas
.
getUASID
();
wpc
.
target_component
=
MAV_COMP_ID_WAYPOINTPLANNER
;
wpc
.
count
=
0
;
//TODO
//copy waypoint data to local buffer
for
(
int
i
=
0
;
i
<
current_count
;
i
++
)
{
waypoint_buffer
.
push_back
(
new
mavlink_waypoint_t
);
mavlink_waypoint_t
*
cur_d
=
waypoint_buffer
.
back
();
memset
(
cur_d
,
0
,
sizeof
(
mavlink_waypoint_t
));
//initialize with zeros
const
Waypoint
*
cur_s
=
list
.
at
(
i
);
cur_d
->
autocontinue
=
cur_s
->
getAutoContinue
();
cur_d
->
current
=
cur_s
->
getCurrent
();
cur_d
->
seq
=
i
;
cur_d
->
x
=
cur_s
->
getX
();
cur_d
->
y
=
cur_s
->
getY
();
cur_d
->
z
=
cur_s
->
getZ
();
cur_d
->
yaw
=
cur_s
->
getYaw
();
}
mavlink_msg_waypoint_count_encode
(
uas
.
mavlink
->
getSystemId
(),
uas
.
mavlink
->
getComponentId
(),
&
message
,
&
wpc
);
uas
.
sendMessage
(
message
);
//send the waypoint count to UAS (this starts the send transaction)
mavlink_message_t
message
;
mavlink_waypoint_count_t
wpc
;
wpc
.
target_system
=
uas
.
getUASID
();
wpc
.
target_component
=
MAV_COMP_ID_WAYPOINTPLANNER
;
wpc
.
count
=
current_count
;
qDebug
()
<<
"sent waypoint count ("
<<
wpc
.
count
<<
") to ID "
<<
wpc
.
target_system
;
const
QString
str
=
QString
(
"start transmitting waypoints..."
);
emit
updateStatusString
(
str
);
mavlink_msg_waypoint_count_encode
(
uas
.
mavlink
->
getSystemId
(),
uas
.
mavlink
->
getComponentId
(),
&
message
,
&
wpc
);
uas
.
sendMessage
(
message
);
}
else
{
//we're in another transaction, ignore command
qDebug
()
<<
"UASWaypointManager::sendWaypoints() doing something else ignoring command"
;
}
}
void
UASWaypointManager
::
get
Waypoint
(
quint16
seq
)
void
UASWaypointManager
::
send
Waypoint
Request
(
quint16
seq
)
{
mavlink_message_t
message
;
mavlink_waypoint_request_t
wpr
;
wpr
.
target_system
=
uas
.
getUASID
();
wpr
.
target_component
=
MAV_COMP_ID_WAYPOINTPLANNER
;
wpr
.
seq
=
seq
;
mavlink_msg_waypoint_request_encode
(
uas
.
mavlink
->
getSystemId
(),
uas
.
mavlink
->
getComponentId
(),
&
message
,
&
wpr
);
uas
.
sendMessage
(
message
);
qDebug
()
<<
"sent waypoint request ("
<<
wpr
.
seq
<<
") to ID "
<<
wpr
.
target_system
;
const
QString
str
=
QString
(
"retrieving waypoint ID %1 of %2 total"
).
arg
(
wpr
.
seq
).
arg
(
current_count
);
emit
updateStatusString
(
str
);
}
void
UASWaypointManager
::
waypointChanged
(
Waypoint
*
)
...
...
src/uas/UASWaypointManager.h
View file @
88cf8600
...
...
@@ -2,6 +2,7 @@
#define UASWAYPOINTMANAGER_H
#include
<QObject>
#include
<QVector>
#include
"Waypoint.h"
#include
<mavlink.h>
class
UAS
;
...
...
@@ -26,26 +27,29 @@ public:
void
handleWaypointRequest
(
quint8
systemId
,
quint8
compId
,
mavlink_waypoint_request_t
*
wpr
);
private:
void
get
Waypoint
(
quint16
seq
);
void
send
Waypoint
Request
(
quint16
seq
);
public
slots
:
void
clearWaypointList
();
void
currentWaypointChanged
(
int
);
void
removeWaypointId
(
int
);
void
currentWaypointChanged
(
qu
int
16
);
void
removeWaypointId
(
qu
int
16
);
void
requestWaypoints
();
void
sendWaypoints
(
void
);
void
sendWaypoints
(
const
QVector
<
Waypoint
*>
&
list
);
void
waypointChanged
(
Waypoint
*
);
signals:
void
waypointUpdated
(
int
,
int
,
double
,
double
,
double
,
double
,
bool
,
bool
);
void
waypointUpdated
(
int
,
quint16
,
double
,
double
,
double
,
double
,
bool
,
bool
);
///< Adds a waypoint to the waypoint list widget
void
updateStatusString
(
const
QString
&
);
///< updates the current status string
private:
UAS
&
uas
;
quint16
current_wp_id
;
///< The last used waypoint ID
quint16
current_count
;
WaypointState
current_state
;
///< The current state
quint8
current_partner_systemid
;
quint8
current_partner_compid
;
UAS
&
uas
;
///< Reference to the corresponding UAS
quint16
current_wp_id
;
///< The last used waypoint ID in the current protocol transaction
quint16
current_count
;
///< The number of waypoints in the current protocol transaction
WaypointState
current_state
;
///< The current protocol state
quint8
current_partner_systemid
;
///< The current protocol communication target system
quint8
current_partner_compid
;
///< The current protocol communication target component
QVector
<
mavlink_waypoint_t
*>
waypoint_buffer
;
///< communication buffer for waypoints
};
#endif // UASWAYPOINTMANAGER_H
src/ui/WaypointList.cc
View file @
88cf8600
...
...
@@ -27,6 +27,7 @@ This file is part of the PIXHAWK project
*
* @author Lorenz Meier <mavteam@student.ethz.ch>
* @author Benjamin Knecht <mavteam@student.ethz.ch>
* @author Petri Tanskanen <mavteam@student.ethz.ch>
*
*/
...
...
@@ -74,6 +75,9 @@ WaypointList::WaypointList(QWidget *parent, UASInterface* uas) :
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
this
,
SLOT
(
setUAS
(
UASInterface
*
)));
connect
(
transmitDelay
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
reenableTransmit
()));
// STATUS LABEL
updateStatusLabel
(
""
);
// SET UAS AFTER ALL SIGNALS/SLOTS ARE CONNECTED
setUAS
(
uas
);
}
...
...
@@ -83,46 +87,48 @@ WaypointList::~WaypointList()
delete
m_ui
;
}
void
WaypointList
::
updateStatusLabel
(
const
QString
&
string
)
{
m_ui
->
statusLabel
->
setText
(
string
);
}
void
WaypointList
::
setUAS
(
UASInterface
*
uas
)
{
if
(
this
->
uas
==
NULL
&&
uas
!=
NULL
)
{
this
->
uas
=
uas
;
connect
(
&
uas
->
getWaypointManager
(),
SIGNAL
(
waypointUpdated
(
int
,
int
,
double
,
double
,
double
,
double
,
bool
,
bool
)),
this
,
SLOT
(
setWaypoint
(
int
,
int
,
double
,
double
,
double
,
double
,
bool
,
bool
)));
connect
(
&
uas
->
getWaypointManager
(),
SIGNAL
(
waypointReached
(
UASInterface
*
,
int
)),
this
,
SLOT
(
waypointReached
(
UASInterface
*
,
int
)));
connect
(
this
,
SIGNAL
(
waypointChanged
(
Waypoint
*
)),
&
uas
->
getWaypointManager
(),
SLOT
(
setWaypoint
(
Waypoint
*
)));
connect
(
this
,
SIGNAL
(
currentWaypointChanged
(
int
)),
&
uas
->
getWaypointManager
(),
SLOT
(
setWaypointActive
(
int
)));
connect
(
this
,
SIGNAL
(
requestWaypoints
()),
&
uas
->
getWaypointManager
(),
SLOT
(
requestWaypoints
()));
connect
(
this
,
SIGNAL
(
clearWaypointList
()),
&
uas
->
getWaypointManager
(),
SLOT
(
clearWaypointList
()));
connect
(
&
uas
->
getWaypointManager
(),
SIGNAL
(
waypointUpdated
(
int
,
quint16
,
double
,
double
,
double
,
double
,
bool
,
bool
)),
this
,
SLOT
(
setWaypoint
(
int
,
quint16
,
double
,
double
,
double
,
double
,
bool
,
bool
)));
//connect(this, SIGNAL(waypointChanged(Waypoint*)), &uas->getWaypointManager(), SLOT(setWaypoint(Waypoint*)));
//connect(this, SIGNAL(currentWaypointChanged(int)), &uas->getWaypointManager(), SLOT(setWaypointActive(quint16)));
connect
(
this
,
SIGNAL
(
sendWaypoints
(
const
QVector
<
Waypoint
*>
&
)),
&
uas
->
getWaypointManager
(),
SLOT
(
sendWaypoints
(
const
QVector
<
Waypoint
*>
&
)));
connect
(
this
,
SIGNAL
(
requestWaypoints
()),
&
uas
->
getWaypointManager
(),
SLOT
(
requestWaypoints
()));
connect
(
this
,
SIGNAL
(
clearWaypointList
()),
&
uas
->
getWaypointManager
(),
SLOT
(
clearWaypointList
()));
connect
(
&
uas
->
getWaypointManager
(),
SIGNAL
(
updateStatusString
(
const
QString
&
)),
this
,
SLOT
(
updateStatusLabel
(
const
QString
&
)));
// This slot is not implemented in UAS: connect(this, SIGNAL(removeWaypointId(int)), uas, SLOT(removeWaypoint(Waypoint*)));
qDebug
()
<<
"Requesting waypoints"
;
emit
requestWaypoints
();
//
qDebug() << "Requesting waypoints";
//
emit requestWaypoints();
}
}
void
WaypointList
::
setWaypoint
(
int
uasId
,
int
id
,
double
x
,
double
y
,
double
z
,
double
yaw
,
bool
autocontinue
,
bool
current
)
void
WaypointList
::
setWaypoint
(
int
uasId
,
qu
int
16
id
,
double
x
,
double
y
,
double
z
,
double
yaw
,
bool
autocontinue
,
bool
current
)
{
if
(
uasId
==
this
->
uas
->
getUASID
())
{
transmitDelay
->
start
(
1000
);
QString
string
=
"New waypoint"
;
if
(
waypointNames
.
contains
(
id
))
{
string
=
waypointNames
.
value
(
id
);
}
Waypoint
*
wp
=
new
Waypoint
(
string
,
id
,
x
,
y
,
z
,
yaw
,
autocontinue
,
current
);
Waypoint
*
wp
=
new
Waypoint
(
id
,
x
,
y
,
z
,
yaw
,
autocontinue
,
current
);
addWaypoint
(
wp
);
}
}
void
WaypointList
::
waypointReached
(
UASInterface
*
uas
,
int
waypointId
)
void
WaypointList
::
waypointReached
(
UASInterface
*
uas
,
qu
int
16
waypointId
)
{
Q_UNUSED
(
uas
);
if
(
waypoints
.
size
()
>
waypointId
)
qDebug
()
<<
"Waypoint reached: "
<<
waypointId
;
/*if (waypoints.size() > waypointId)
{
if (waypoints[waypointId]->autocontinue == true)
{
...
...
@@ -149,7 +155,7 @@ void WaypointList::waypointReached(UASInterface* uas, int waypointId)
qDebug() << "NEW WAYPOINT SET";
}
}
}
*/
}
void
WaypointList
::
transmit
()
...
...
@@ -157,15 +163,17 @@ void WaypointList::transmit()
transmitDelay
->
start
(
1000
);
m_ui
->
transmitButton
->
setEnabled
(
false
);
emit
clearWaypointList
();
waypointNames
.
clear
();
for
(
int
i
=
0
;
i
<
waypoints
.
size
();
i
++
)
{
Waypoint
*
wp
=
waypoints
[
i
];
waypointNames
.
insert
(
wp
->
id
,
wp
->
name
);
emit
waypointChanged
(
wp
);
if
(
wp
->
current
)
emit
currentWaypointChanged
(
wp
->
id
);
//Waypoint* wp = waypoints[i];
//emit waypointChanged(wp);
//if (wp->current)
// emit currentWaypointChanged(wp->id);
}
emit
sendWaypoints
(
waypoints
);
while
(
waypoints
.
size
()
>
0
)
{
removeWaypoint
(
waypoints
[
0
]);
...
...
@@ -180,11 +188,11 @@ void WaypointList::add()
{
if
(
waypoints
.
size
()
>
0
)
{
addWaypoint
(
new
Waypoint
(
"New waypoint"
,
waypoints
.
size
(),
0.0
,
0.1
,
-
0.5
,
0.0
,
false
,
false
));
addWaypoint
(
new
Waypoint
(
waypoints
.
size
(),
0.0
,
0.1
,
-
0.5
,
0.0
,
false
,
false
));
}
else
{
addWaypoint
(
new
Waypoint
(
"New waypoint"
,
waypoints
.
size
(),
0.0
,
0.0
,
-
0.5
,
360.0
,
false
,
true
));
addWaypoint
(
new
Waypoint
(
waypoints
.
size
(),
0.0
,
0.0
,
-
0.5
,
360.0
,
false
,
true
));
}
}
}
...
...
@@ -196,7 +204,7 @@ void WaypointList::addWaypoint(Waypoint* wp)
removeWaypoint
(
wp
);
}
waypoints
.
insert
(
wp
->
id
,
wp
);
waypoints
.
insert
(
wp
->
getId
()
,
wp
);
if
(
!
wpViews
.
contains
(
wp
))
{
...
...
@@ -205,7 +213,7 @@ void WaypointList::addWaypoint(Waypoint* wp)
listLayout
->
addWidget
(
wpViews
.
value
(
wp
));
connect
(
wpview
,
SIGNAL
(
moveDownWaypoint
(
Waypoint
*
)),
this
,
SLOT
(
moveDown
(
Waypoint
*
)));
connect
(
wpview
,
SIGNAL
(
moveUpWaypoint
(
Waypoint
*
)),
this
,
SLOT
(
moveUp
(
Waypoint
*
)));
connect
(
wpview
,
SIGNAL
(
removeWaypoint
(
Waypoint
*
)),
this
,
SLOT
(
removeWaypoint
AndName
(
Waypoint
*
)));
connect
(
wpview
,
SIGNAL
(
removeWaypoint
(
Waypoint
*
)),
this
,
SLOT
(
removeWaypoint
(
Waypoint
*
)));
connect
(
wpview
,
SIGNAL
(
setCurrentWaypoint
(
Waypoint
*
)),
this
,
SLOT
(
setCurrentWaypoint
(
Waypoint
*
)));
connect
(
wpview
,
SIGNAL
(
waypointUpdated
(
Waypoint
*
)),
this
,
SIGNAL
(
waypointChanged
(
Waypoint
*
)));
}
...
...
@@ -231,17 +239,9 @@ void WaypointList::redrawList()
}
}
void
WaypointList
::
debugOutputWaypoints
()
{
for
(
int
i
=
0
;
i
<
waypoints
.
size
();
i
++
)
{
qDebug
()
<<
i
<<
" "
<<
waypoints
[
i
]
->
name
;
}
}
void
WaypointList
::
moveUp
(
Waypoint
*
wp
)
{
int
id
=
wp
->
id
;
int
id
=
wp
->
getId
()
;
if
(
waypoints
.
size
()
>
1
&&
waypoints
.
size
()
>
id
)
{
Waypoint
*
temp
=
waypoints
[
id
];
...
...
@@ -249,15 +249,15 @@ void WaypointList::moveUp(Waypoint* wp)
{
waypoints
[
id
]
=
waypoints
[
id
-
1
];
waypoints
[
id
-
1
]
=
temp
;
waypoints
[
id
-
1
]
->
id
=
id
-
1
;
waypoints
[
id
]
->
id
=
id
;
waypoints
[
id
-
1
]
->
setId
(
id
-
1
)
;
waypoints
[
id
]
->
setId
(
id
)
;
}
else
{
waypoints
[
id
]
=
waypoints
[
waypoints
.
size
()
-
1
];
waypoints
[
waypoints
.
size
()
-
1
]
=
temp
;
waypoints
[
waypoints
.
size
()
-
1
]
->
id
=
waypoints
.
size
()
-
1
;
waypoints
[
id
]
->
id
=
id
;
waypoints
[
waypoints
.
size
()
-
1
]
->
setId
(
waypoints
.
size
()
-
1
)
;
waypoints
[
id
]
->
setId
(
id
)
;
}
redrawList
();
}
...
...
@@ -265,7 +265,7 @@ void WaypointList::moveUp(Waypoint* wp)
void
WaypointList
::
moveDown
(
Waypoint
*
wp
)
{
int
id
=
wp
->
id
;
int
id
=
wp
->
getId
()
;
if
(
waypoints
.
size
()
>
1
&&
waypoints
.
size
()
>
id
)
{
Waypoint
*
temp
=
waypoints
[
id
];
...
...
@@ -273,34 +273,33 @@ void WaypointList::moveDown(Waypoint* wp)
{
waypoints
[
id
]
=
waypoints
[
id
+
1
];
waypoints
[
id
+
1
]
=
temp
;
waypoints
[
id
+
1
]
->
id
=
id
+
1
;
waypoints
[
id
]
->
id
=
id
;
waypoints
[
id
+
1
]
->
setId
(
id
+
1
)
;
waypoints
[
id
]
->
setId
(
id
)
;
}
else
{
waypoints
[
id
]
=
waypoints
[
0
];
waypoints
[
0
]
=
temp
;
waypoints
[
0
]
->
id
=
0
;
waypoints
[
id
]
->
id
=
id
;
waypoints
[
0
]
->
setId
(
0
)
;
waypoints
[
id
]
->
setId
(
id
)
;
}
redrawList
();
}
}
void
WaypointList
::
removeWaypointAndName
(
Waypoint
*
wp
)
/*
void WaypointList::removeWaypointAndName(Waypoint* wp)
{
waypointNames
.
remove
(
wp
->
id
);
removeWaypoint(wp);
}
}
*/
void
WaypointList
::
removeWaypoint
(
Waypoint
*
wp
)
{
// Delete from list
if
(
wp
!=
NULL
){
waypoints
.
remove
(
wp
->
id
);
for
(
int
i
=
wp
->
id
;
i
<
waypoints
.
size
();
i
++
)
waypoints
.
remove
(
wp
->
getId
()
);
for
(
int
i
=
wp
->
getId
()
;
i
<
waypoints
.
size
();
i
++
)
{
waypoints
[
i
]
->
id
=
i
;
waypoints
[
i
]
->
setId
(
i
)
;
}
// Remove from view
...
...
@@ -318,15 +317,15 @@ void WaypointList::setCurrentWaypoint(Waypoint* wp)
{
if
(
waypoints
[
i
]
==
wp
)
{
waypoints
[
i
]
->
c
urrent
=
true
;
waypoints
[
i
]
->
setC
urrent
(
true
)
;
// Retransmit waypoint
//uas->getWaypointManager().setWaypointActive(i);
}
else
{
if
(
waypoints
[
i
]
->
c
urrent
)
if
(
waypoints
[
i
]
->
getC
urrent
()
)
{
waypoints
[
i
]
->
c
urrent
=
false
;
waypoints
[
i
]
->
setC
urrent
(
false
)
;
WaypointView
*
widget
=
wpViews
.
find
(
waypoints
[
i
]).
value
();
widget
->
removeCurrentCheck
();
}
...
...
@@ -361,7 +360,7 @@ void WaypointList::saveWaypoints()
for
(
int
i
=
0
;
i
<
waypoints
.
size
();
i
++
)
{
Waypoint
*
wp
=
waypoints
[
i
];
in
<<
wp
->
name
<<
"~"
<<
wp
->
id
<<
"~"
<<
wp
->
x
<<
"~"
<<
wp
->
y
<<
"~"
<<
wp
->
z
<<
"~"
<<
wp
->
yaw
<<
"~"
<<
wp
->
a
uto
c
ontinue
<<
"~"
<<
wp
->
c
urrent
<<
"
\n
"
;
in
<<
"~"
<<
wp
->
getId
()
<<
"~"
<<
wp
->
getX
()
<<
"~"
<<
wp
->
getY
()
<<
"~"
<<
wp
->
getZ
()
<<
"~"
<<
wp
->
getYaw
()
<<
"~"
<<
wp
->
getA
uto
C
ontinue
()
<<
"~"
<<
wp
->
getC
urrent
()
<<
"
\n
"
;
in
.
flush
();
}
file
.
close
();
...
...
@@ -376,7 +375,7 @@ void WaypointList::loadWaypoints()
while
(
waypoints
.
size
()
>
0
)
{
removeWaypoint
AndName
(
waypoints
[
0
]);
removeWaypoint
(
waypoints
[
0
]);
}
QTextStream
in
(
&
file
);
...
...
@@ -384,7 +383,7 @@ void WaypointList::loadWaypoints()
{
QStringList
wpParams
=
in
.
readLine
().
split
(
"~"
);
if
(
wpParams
.
size
()
==
8
)
addWaypoint
(
new
Waypoint
(
wpParams
[
0
],
wpParams
[
1
].
toInt
(),
wpParams
[
2
].
toDouble
(),
wpParams
[
3
].
toDouble
(),
wpParams
[
4
].
toDouble
(),
wpParams
[
5
].
toDouble
(),
(
wpParams
[
6
].
toInt
()
==
1
?
true
:
false
),
(
wpParams
[
7
].
toInt
()
==
1
?
true
:
false
)));
addWaypoint
(
new
Waypoint
(
wpParams
[
1
].
toInt
(),
wpParams
[
2
].
toDouble
(),
wpParams
[
3
].
toDouble
(),
wpParams
[
4
].
toDouble
(),
wpParams
[
5
].
toDouble
(),
(
wpParams
[
6
].
toInt
()
==
1
?
true
:
false
),
(
wpParams
[
7
].
toInt
()
==
1
?
true
:
false
)));
}
file
.
close
();
}
...
...
src/ui/WaypointList.h
View file @
88cf8600
...
...
@@ -27,6 +27,7 @@ This file is part of the PIXHAWK project
*
* @author Lorenz Meier <mavteam@student.ethz.ch>
* @author Benjamin Knecht <mavteam@student.ethz.ch>
* @author Petri Tanskanen <mavteam@student.ethz.ch>
*
*/
...
...
@@ -66,18 +67,19 @@ public slots:
void
moveDown
(
Waypoint
*
wp
);
void
setCurrentWaypoint
(
Waypoint
*
wp
);
/** @brief sets statusLabel string */
void
updateStatusLabel
(
const
QString
&
string
);
//To be moved to UASWaypointManager (?)
void
setWaypoint
(
int
uasId
,
int
id
,
double
x
,
double
y
,
double
z
,
double
yaw
,
bool
autocontinue
,
bool
current
);
void
setWaypoint
(
int
uasId
,
qu
int
16
id
,
double
x
,
double
y
,
double
z
,
double
yaw
,
bool
autocontinue
,
bool
current
);
void
addWaypoint
(
Waypoint
*
wp
);
void
removeWaypoint
AndName
(
Waypoint
*
wp
);
void
waypointReached
(
UASInterface
*
uas
,
int
waypointId
);
void
removeWaypoint
(
Waypoint
*
wp
);
void
waypointReached
(
UASInterface
*
uas
,
qu
int
16
waypointId
);
protected:
virtual
void
changeEvent
(
QEvent
*
e
);
void
debugOutputWaypoints
();
QVector
<
Waypoint
*>
waypoints
;
QMap
<
int
,
QString
>
waypointNames
;
QMap
<
Waypoint
*
,
WaypointView
*>
wpViews
;
QVBoxLayout
*
listLayout
;
QTimer
*
transmitDelay
;
...
...
@@ -85,12 +87,12 @@ protected:
private:
Ui
::
WaypointList
*
m_ui
;
void
removeWaypoint
(
Waypoint
*
wp
);
signals:
void
waypointChanged
(
Waypoint
*
);
void
currentWaypointChanged
(
int
);
void
removeWaypointId
(
int
);
//void waypointChanged(Waypoint*);
//void currentWaypointChanged(int);
//void removeWaypointId(int);
void
sendWaypoints
(
const
QVector
<
Waypoint
*>
&
);
void
requestWaypoints
();
void
clearWaypointList
();
};
...
...
src/ui/WaypointList.ui
View file @
88cf8600
...
...
@@ -6,8 +6,8 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
4
19
</width>
<height>
2
06
</height>
<width>
4
76
</width>
<height>
2
18
</height>
</rect>
</property>
<property
name=
"minimumSize"
>
...
...
@@ -19,14 +19,14 @@
<property
name=
"windowTitle"
>
<string>
Form
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
rowstretch=
"100,0"
>
<layout
class=
"QGridLayout"
name=
"gridLayout"
rowstretch=
"100,0
,0,0
"
>
<property
name=
"margin"
>
<number>
4
</number>
</property>
<property
name=
"spacing"
>
<number>
4
</number>
</property>
<item
row=
"0"
column=
"0"
colspan=
"
7
"
>
<item
row=
"0"
column=
"0"
colspan=
"
8
"
>
<widget
class=
"QScrollArea"
name=
"scrollArea"
>
<property
name=
"widgetResizable"
>
<bool>
true
</bool>
...
...
@@ -36,8 +36,8 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
4
09
</width>
<height>
1
5
8
</height>
<width>
4
66
</width>
<height>
1
4
8
</height>
</rect>
</property>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
...
...
@@ -54,66 +54,73 @@
</widget>
</widget>
</item>
<item
row=
"1"
column=
"0"
>
<spacer
name=
"horizontalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
127
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
<item
row=
"1"
column=
"3"
>
<widget
class=
"QToolButton"
name=
"addButton"
>
<item
row=
"2"
column=
"6"
>
<widget
class=
"QPushButton"
name=
"readButton"
>
<property
name=
"text"
>
<string>
...
</string>
<string>
Read
</string>
</property>
<property
name=
"icon"
>
<iconset
resource=
"../../mavground.qrc"
>
<normaloff>
:/images/
actions/list-add.svg
</normaloff>
:/images/actions/list-add
.svg
</iconset>
<normaloff>
:/images/
status/software-update-available.svg
</normaloff>
:/images/status/software-update-available
.svg
</iconset>
</property>
</widget>
</item>
<item
row=
"
1
"
column=
"
1
"
>
<widget
class=
"QPushButton"
name=
"
save
Button"
>
<item
row=
"
2
"
column=
"
7
"
>
<widget
class=
"QPushButton"
name=
"
transmit
Button"
>
<property
name=
"text"
>
<string>
Save WPs
</string>
<string>
Write
</string>
</property>
<property
name=
"icon"
>
<iconset
resource=
"../../mavground.qrc"
>
<normaloff>
:/images/devices/network-wireless.svg
</normaloff>
:/images/devices/network-wireless.svg
</iconset>
</property>
</widget>
</item>
<item
row=
"
1
"
column=
"
2
"
>
<widget
class=
"Q
PushButton"
name=
"loadButton
"
>
<item
row=
"
3
"
column=
"
0"
colspan=
"8
"
>
<widget
class=
"Q
Label"
name=
"statusLabel
"
>
<property
name=
"text"
>
<string>
Load WPs
</string>
<string>
TextLabel
</string>
</property>
</widget>
</item>
<item
row=
"
1
"
column=
"5"
>
<widget
class=
"Q
Push
Button"
name=
"
re
adButton"
>
<item
row=
"
2
"
column=
"5"
>
<widget
class=
"Q
Tool
Button"
name=
"a
d
dButton"
>
<property
name=
"text"
>
<string>
Read
</string>
<string>
...
</string>
</property>
<property
name=
"icon"
>
<iconset
resource=
"../../mavground.qrc"
>
<normaloff>
:/images/
status/software-update-available.svg
</normaloff>
:/images/status/software-update-available
.svg
</iconset>
<normaloff>
:/images/
actions/list-add.svg
</normaloff>
:/images/actions/list-add
.svg
</iconset>
</property>
</widget>
</item>
<item
row=
"
1
"
column=
"
6
"
>
<widget
class=
"QPushButton"
name=
"
transmit
Button"
>
<item
row=
"
2
"
column=
"
3
"
>
<widget
class=
"QPushButton"
name=
"
load
Button"
>
<property
name=
"text"
>
<string>
Write
</string>
<string>
Load WPs
</string>
</property>
<property
name=
"icon"
>
<iconset
resource=
"../../mavground.qrc"
>
<normaloff>
:/images/devices/network-wireless.svg
</normaloff>
:/images/devices/network-wireless.svg
</iconset>
</widget>
</item>
<item
row=
"2"
column=
"2"
>
<widget
class=
"QPushButton"
name=
"saveButton"
>
<property
name=
"text"
>
<string>
Save WPs
</string>
</property>
</widget>
</item>
<item
row=
"2"
column=
"4"
>
<spacer
name=
"horizontalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
127
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
</layout>
<action
name=
"actionAddWaypoint"
>
<property
name=
"icon"
>
...
...
src/ui/WaypointView.cc
View file @
88cf8600
...
...
@@ -27,6 +27,7 @@ This file is part of the PIXHAWK project
*
* @author Lorenz Meier <mavteam@student.ethz.ch>
* @author Benjamin Knecht <mavteam@student.ethz.ch>
* @author Petri Tanskanen <mavteam@student.ethz.ch>
*
*/
...
...
@@ -45,13 +46,13 @@ WaypointView::WaypointView(Waypoint* wp, QWidget* parent) :
this
->
wp
=
wp
;
// Read values and set user interface
m_ui
->
name
->
setText
(
wp
->
name
);
m_ui
->
x
SpinBox
->
setValue
(
wp
->
x
);
m_ui
->
y
SpinBox
->
setValue
(
wp
->
y
);
m_ui
->
z
SpinBox
->
setValue
(
wp
->
z
);
m_ui
->
yawSpinBox
->
setValue
(
wp
->
yaw
);
m_ui
->
selectedBox
->
setChecked
(
wp
->
current
);
m_ui
->
autoContinue
->
setChecked
(
wp
->
autocontinue
);
m_ui
->
xSpinBox
->
setValue
(
wp
->
getX
()
);
m_ui
->
y
SpinBox
->
setValue
(
wp
->
getY
()
);
m_ui
->
z
SpinBox
->
setValue
(
wp
->
getZ
()
);
m_ui
->
yaw
SpinBox
->
setValue
(
wp
->
getYaw
()
);
m_ui
->
selectedBox
->
setChecked
(
wp
->
getCurrent
()
);
m_ui
->
autoContinue
->
setChecked
(
wp
->
getAutoContinue
()
);
m_ui
->
idLabel
->
setText
(
QString
(
"%1"
).
arg
(
wp
->
getId
())
);
connect
(
m_ui
->
xSpinBox
,
SIGNAL
(
valueChanged
(
double
)),
wp
,
SLOT
(
setX
(
double
)));
connect
(
m_ui
->
ySpinBox
,
SIGNAL
(
valueChanged
(
double
)),
wp
,
SLOT
(
setY
(
double
)));
...
...
@@ -64,7 +65,6 @@ WaypointView::WaypointView(Waypoint* wp, QWidget* parent) :
connect
(
m_ui
->
autoContinue
,
SIGNAL
(
stateChanged
(
int
)),
this
,
SLOT
(
setAutoContinue
(
int
)));
connect
(
m_ui
->
selectedBox
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
setCurrent
()));
connect
(
m_ui
->
name
,
SIGNAL
(
editingFinished
()),
this
,
SLOT
(
setText
()));
}
void
WaypointView
::
moveUp
()
...
...
@@ -86,9 +86,9 @@ void WaypointView::remove()
void
WaypointView
::
setAutoContinue
(
int
state
)
{
if
(
state
==
0
)
wp
->
a
utocontinue
=
false
;
wp
->
setA
utocontinue
(
false
)
;
else
wp
->
a
utocontinue
=
true
;
wp
->
setA
utocontinue
(
true
)
;
emit
waypointUpdated
(
wp
);
}
...
...
@@ -105,11 +105,6 @@ void WaypointView::setCurrent()
m_ui
->
selectedBox
->
setCheckState
(
Qt
::
Checked
);
}
void
WaypointView
::
setText
()
{
wp
->
name
=
m_ui
->
name
->
text
();
}
WaypointView
::~
WaypointView
()
{
delete
m_ui
;
...
...
src/ui/WaypointView.h
View file @
88cf8600
...
...
@@ -27,6 +27,7 @@ This file is part of the PIXHAWK project
*
* @author Lorenz Meier <mavteam@student.ethz.ch>
* @author Benjamin Knecht <mavteam@student.ethz.ch>
* @author Petri Tanskanen <mavteam@student.ethz.ch>
*
*/
...
...
@@ -56,7 +57,7 @@ public slots:
void
remove
();
void
setAutoContinue
(
int
);
void
setCurrent
();
void
setText
();
//
void setText();
protected:
virtual
void
changeEvent
(
QEvent
*
e
);
...
...
src/ui/WaypointView.ui
View file @
88cf8600
...
...
@@ -155,7 +155,7 @@ QProgressBar::chunk#thrustBar {
<property
name=
"title"
>
<string/>
</property>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
stretch=
"0,
25
,5,0,0,0,0,0,0,0,0"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
stretch=
"0,
0
,5,0,0,0,0,0,0,0,0"
>
<property
name=
"spacing"
>
<number>
2
</number>
</property>
...
...
@@ -179,9 +179,9 @@ QProgressBar::chunk#thrustBar {
</widget>
</item>
<item>
<widget
class=
"QL
ineEdit
"
name=
"
name
"
>
<widget
class=
"QL
abel
"
name=
"
idLabel
"
>
<property
name=
"text"
>
<string>
Name
</string>
<string>
TextLabel
</string>
</property>
</widget>
</item>
...
...
src/ui/watchdog/WatchdogControl.cc
View file @
88cf8600
...
...
@@ -58,7 +58,7 @@ void WatchdogControl::updateWatchdog(int systemId, int watchdogId, unsigned int
// start the timeout timer
//watchdog.timeoutTimer_.reset();
qDebug
()
<<
"WATCHDOG RECEIVED"
;
//
qDebug() << "WATCHDOG RECEIVED";
//qDebug() << "<-- received mavlink_watchdog_heartbeat_t " << msg->sysid << " / " << payload.watchdog_id << " / " << payload.process_count << std::endl;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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