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
3e803237
Commit
3e803237
authored
Jun 04, 2010
by
pixhawk
Browse files
waypoint changes
parent
ea2fb98b
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/uas/UASInterface.h
View file @
3e803237
...
@@ -149,9 +149,9 @@ public slots:
...
@@ -149,9 +149,9 @@ public slots:
/** @brief Launches the system/Liftof **/
/** @brief Launches the system/Liftof **/
virtual
void
launch
()
=
0
;
virtual
void
launch
()
=
0
;
/** @brief Set a new waypoint **/
/** @brief Set a new waypoint **/
virtual
void
setWaypoint
(
Waypoint
*
wp
)
=
0
;
//
virtual void setWaypoint(Waypoint* wp) = 0;
/** @brief Set this waypoint as next waypoint to fly to */
/** @brief Set this waypoint as next waypoint to fly to */
virtual
void
setWaypointActive
(
int
wp
)
=
0
;
//
virtual void setWaypointActive(int wp) = 0;
/** @brief Order the robot to return home / to land on the runway **/
/** @brief Order the robot to return home / to land on the runway **/
virtual
void
home
()
=
0
;
virtual
void
home
()
=
0
;
/** @brief Halt the system */
/** @brief Halt the system */
...
@@ -171,9 +171,9 @@ public slots:
...
@@ -171,9 +171,9 @@ public slots:
*/
*/
virtual
void
shutdown
()
=
0
;
virtual
void
shutdown
()
=
0
;
/** @brief Request the list of stored waypoints from the robot */
/** @brief Request the list of stored waypoints from the robot */
virtual
void
requestWaypoints
()
=
0
;
//
virtual void requestWaypoints() = 0;
/** @brief Clear all existing waypoints on the robot */
/** @brief Clear all existing waypoints on the robot */
virtual
void
clearWaypointList
()
=
0
;
//
virtual void clearWaypointList() = 0;
/** @brief Request all onboard parameters of all components */
/** @brief Request all onboard parameters of all components */
virtual
void
requestParameters
()
=
0
;
virtual
void
requestParameters
()
=
0
;
/** @brief Write parameter to permanent storage */
/** @brief Write parameter to permanent storage */
...
...
src/uas/UASWaypointManager.cc
View file @
3e803237
...
@@ -2,7 +2,12 @@
...
@@ -2,7 +2,12 @@
#include
"UAS.h"
#include
"UAS.h"
UASWaypointManager
::
UASWaypointManager
(
UAS
&
_uas
)
UASWaypointManager
::
UASWaypointManager
(
UAS
&
_uas
)
:
uas
(
_uas
)
:
uas
(
_uas
),
current_wp_id
(
0
),
current_count
(
0
),
current_state
(
WP_IDLE
),
current_partner_systemid
(
0
),
current_partner_compid
(
0
)
{
{
}
}
...
@@ -22,17 +27,19 @@ void UASWaypointManager::requestWaypoints()
...
@@ -22,17 +27,19 @@ void UASWaypointManager::requestWaypoints()
{
{
if
(
current_state
==
WP_IDLE
)
if
(
current_state
==
WP_IDLE
)
{
{
qDebug
()
<<
"handleWaypointCount"
;
mavlink_message_t
message
;
mavlink_message_t
message
;
mavlink_waypoint_request_list_t
wprl
;
mavlink_waypoint_request_list_t
wprl
;
wprl
.
target_system
=
uas
.
getUASID
();
wprl
.
target_system
=
uas
.
getUASID
();
wprl
.
target_
system
=
MAV_COMP_ID_WAYPOINTPLANNER
;
wprl
.
target_
component
=
MAV_COMP_ID_WAYPOINTPLANNER
;
current_state
=
WP_GETLIST
;
current_state
=
WP_GETLIST
;
current_wp_id
=
0
;
current_wp_id
=
0
;
current_partner_systemid
=
uas
.
getUASID
();
current_partner_systemid
=
uas
.
getUASID
();
current_partner_compid
=
MAV_COMP_ID_WAYPOINTPLANNER
;
current_partner_compid
=
MAV_COMP_ID_WAYPOINTPLANNER
;
mavlink_msg_waypoint_request_list_encode
(
uas
.
mavlink
->
getSystemId
(),
uas
.
mavlink
->
getComponentId
(),
&
message
,
&
wprl
);
uas
.
sendMessage
(
message
);
uas
.
sendMessage
(
message
);
}
}
}
}
...
@@ -41,21 +48,67 @@ void UASWaypointManager::handleWaypointCount(quint8 systemId, quint8 compId, qui
...
@@ -41,21 +48,67 @@ void UASWaypointManager::handleWaypointCount(quint8 systemId, quint8 compId, qui
{
{
if
(
current_state
==
WP_GETLIST
&&
systemId
==
current_partner_systemid
&&
compId
==
current_partner_compid
)
if
(
current_state
==
WP_GETLIST
&&
systemId
==
current_partner_systemid
&&
compId
==
current_partner_compid
)
{
{
qDebug
()
<<
"handleWaypointCount"
;
current_count
=
count
;
current_count
=
count
;
mavlink_message_t
message
;
mavlink_message_t
message
;
mavlink_waypoint_request_t
wpr
;
mavlink_waypoint_request_t
wpr
;
wpr
.
target_system
=
uas
.
getUASID
();
wpr
.
target_system
=
uas
.
getUASID
();
wpr
.
target_
system
=
MAV_COMP_ID_WAYPOINTPLANNER
;
wpr
.
target_
component
=
MAV_COMP_ID_WAYPOINTPLANNER
;
wpr
.
seq
=
current_wp_id
;
wpr
.
seq
=
0
;
current_wp_id
=
0
;
current_state
=
WP_GETLIST_GETWPS
;
current_state
=
WP_GETLIST_GETWPS
;
mavlink_msg_waypoint_request_encode
(
uas
.
mavlink
->
getSystemId
(),
uas
.
mavlink
->
getComponentId
(),
&
message
,
&
wpr
);
uas
.
sendMessage
(
message
);
uas
.
sendMessage
(
message
);
}
}
}
}
void
UASWaypointManager
::
handleWaypoint
(
quint8
systemId
,
quint8
compId
,
mavlink_waypoint_t
*
wp
)
{
if
(
systemId
==
current_partner_systemid
&&
compId
==
current_partner_compid
&&
current_state
==
WP_GETLIST_GETWPS
&&
wp
->
seq
==
current_wp_id
)
{
qDebug
()
<<
"handleWaypoint"
;
if
(
wp
->
seq
==
current_wp_id
)
{
//update the UI FIXME
emit
waypointUpdated
(
uas
.
getUASID
(),
wp
->
seq
,
wp
->
x
,
wp
->
y
,
wp
->
z
,
wp
->
yaw
,
wp
->
autocontinue
,
wp
->
current
);
//get next waypoint
current_wp_id
++
;
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
);
}
else
{
current_state
=
WP_IDLE
;
current_count
=
0
;
current_wp_id
=
0
;
current_partner_systemid
=
0
;
current_partner_compid
=
0
;
}
}
else
{
//FIXME error handling
}
}
}
void
UASWaypointManager
::
getWaypoint
(
quint16
seq
)
void
UASWaypointManager
::
getWaypoint
(
quint16
seq
)
{
{
...
...
src/uas/UASWaypointManager.h
View file @
3e803237
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#include
<QObject>
#include
<QObject>
#include
"Waypoint.h"
#include
"Waypoint.h"
#include
<mavlink.h>
class
UAS
;
class
UAS
;
class
UASWaypointManager
:
public
QObject
class
UASWaypointManager
:
public
QObject
...
@@ -21,6 +22,7 @@ public:
...
@@ -21,6 +22,7 @@ public:
UASWaypointManager
(
UAS
&
);
UASWaypointManager
(
UAS
&
);
void
handleWaypointCount
(
quint8
systemId
,
quint8
compId
,
quint16
count
);
void
handleWaypointCount
(
quint8
systemId
,
quint8
compId
,
quint16
count
);
void
handleWaypoint
(
quint8
systemId
,
quint8
compId
,
mavlink_waypoint_t
*
wp
);
private:
private:
void
getWaypoint
(
quint16
seq
);
void
getWaypoint
(
quint16
seq
);
...
@@ -32,6 +34,9 @@ public slots:
...
@@ -32,6 +34,9 @@ public slots:
void
requestWaypoints
();
void
requestWaypoints
();
void
clearWaypointList
();
void
clearWaypointList
();
signals:
void
waypointUpdated
(
int
,
int
,
double
,
double
,
double
,
double
,
bool
,
bool
);
private:
private:
UAS
&
uas
;
UAS
&
uas
;
quint16
current_wp_id
;
///< The last used waypoint ID
quint16
current_wp_id
;
///< The last used waypoint ID
...
...
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