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
1bf17999
Commit
1bf17999
authored
May 27, 2010
by
pixhawk
Browse files
deactivated waypoint management
parent
6dc9b706
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/uas/UAS.cc
View file @
1bf17999
...
...
@@ -356,17 +356,16 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
break
;
case
MAVLINK_MSG_ID_WAYPOINT
:
{
mavlink_waypoint_t
wp
;
mavlink_msg_waypoint_decode
(
&
message
,
&
wp
);
// FIXME
emit
waypointUpdated
(
uasId
,
wp
.
id
,
wp
.
x
,
wp
.
y
,
wp
.
z
,
wp
.
yaw
,
wp
.
autocontinue
,
wp
.
active
);
// mavlink_waypoint_t wp;
// mavlink_msg_waypoint_decode(&message, &wp);
// emit waypointUpdated(uasId, wp.id, wp.x, wp.y, wp.z, wp.yaw, wp.autocontinue, wp.active);
}
break
;
case
MAVLINK_MSG_ID_WAYPOINT_REACHED
:
{
mavlink_waypoint_reached_t
wp
;
mavlink_msg_waypoint_reached_decode
(
&
message
,
&
wp
);
emit
waypointReached
(
this
,
wp
.
id
);
//
mavlink_waypoint_reached_t wp;
//
mavlink_msg_waypoint_reached_decode(&message, &wp);
//
emit waypointReached(this, wp.id);
}
break
;
case
MAVLINK_MSG_ID_STATUSTEXT
:
...
...
@@ -556,15 +555,6 @@ int UAS::getCommunicationStatus() const
return
commStatus
;
}
void
UAS
::
requestWaypoints
()
{
mavlink_message_t
msg
;
mavlink_msg_waypoint_request_list_pack
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
uasId
,
25
);
// Send message twice to increase chance of reception
sendMessage
(
msg
);
qDebug
()
<<
"UAS Request WPs"
;
}
void
UAS
::
requestParameters
()
{
mavlink_message_t
msg
;
...
...
@@ -916,41 +906,63 @@ void UAS::receiveButton(int buttonIndex)
}
void
UAS
::
requestWaypoints
()
{
// mavlink_message_t msg;
// mavlink_msg_waypoint_request_list_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, uasId, 25);
// // Send message twice to increase chance of reception
// sendMessage(msg);
// qDebug() << "UAS Request WPs";
}
void
UAS
::
setWaypoint
(
Waypoint
*
wp
)
{
mavlink_message_t
msg
;
mavlink_waypoint_set_t
set
;
set
.
id
=
wp
->
id
;
//QString name = wp->name;
// FIXME Check if this works properly
//name.truncate(MAVLINK_MSG_WAYPOINT_SET_FIELD_NAME_LEN);
//strcpy((char*)set.name, name.toStdString().c_str());
set
.
autocontinue
=
wp
->
autocontinue
;
set
.
target_component
=
25
;
// FIXME
set
.
target_system
=
uasId
;
set
.
active
=
wp
->
current
;
set
.
x
=
wp
->
x
;
set
.
y
=
wp
->
y
;
set
.
z
=
wp
->
z
;
set
.
yaw
=
wp
->
yaw
;
mavlink_msg_waypoint_set_encode
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
&
set
);
// Send message twice to increase chance of reception
sendMessage
(
msg
);
//
mavlink_message_t msg;
//
mavlink_waypoint_set_t set;
//
set.id = wp->id;
//
//QString name = wp->name;
//
// FIXME Check if this works properly
//
//name.truncate(MAVLINK_MSG_WAYPOINT_SET_FIELD_NAME_LEN);
//
//strcpy((char*)set.name, name.toStdString().c_str());
//
set.autocontinue = wp->autocontinue;
//
set.target_component = 25; // FIXME
//
set.target_system = uasId;
//
set.active = wp->current;
//
set.x = wp->x;
//
set.y = wp->y;
//
set.z = wp->z;
//
set.yaw = wp->yaw;
//
mavlink_msg_waypoint_set_encode(mavlink->getSystemId(), mavlink->getComponentId(), &msg, &set);
//
// Send message twice to increase chance of reception
//
sendMessage(msg);
}
void
UAS
::
setWaypointActive
(
int
id
)
{
mavlink_message_t
msg
;
mavlink_waypoint_set_active_t
active
;
active
.
id
=
id
;
active
.
target_system
=
uasId
;
active
.
target_component
=
25
;
// FIXME
mavlink_msg_waypoint_set_active_encode
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
&
active
);
// Send message twice to increase chance of reception
sendMessage
(
msg
);
sendMessage
(
msg
);
// TODO This should be not directly emitted, but rather being fed back from the UAS
emit
waypointSelected
(
getUASID
(),
id
);
// mavlink_message_t msg;
// mavlink_waypoint_set_active_t active;
// active.id = id;
// active.target_system = uasId;
// active.target_component = 25; // FIXME
// mavlink_msg_waypoint_set_active_encode(mavlink->getSystemId(), mavlink->getComponentId(), &msg, &active);
// // Send message twice to increase chance of reception
// sendMessage(msg);
// sendMessage(msg);
// // TODO This should be not directly emitted, but rather being fed back from the UAS
// emit waypointSelected(getUASID(), id);
}
void
UAS
::
clearWaypointList
()
{
// mavlink_message_t msg;
// // FIXME
// mavlink_waypoint_clear_list_t clist;
// clist.target_system = uasId;
// clist.target_component = 25; // FIXME
// mavlink_msg_waypoint_clear_list_encode(MG::SYSTEM::ID, MG::SYSTEM::COMPID, &msg, &clist);
// sendMessage(msg);
// qDebug() << "UAS clears Waypoints!";
}
...
...
@@ -1174,15 +1186,3 @@ void UAS::stopLowBattAlarm()
lowBattAlarm
=
false
;
}
}
void
UAS
::
clearWaypointList
()
{
mavlink_message_t
msg
;
// FIXME
mavlink_waypoint_clear_list_t
clist
;
clist
.
target_system
=
uasId
;
clist
.
target_component
=
25
;
// FIXME
mavlink_msg_waypoint_clear_list_encode
(
MG
::
SYSTEM
::
ID
,
MG
::
SYSTEM
::
COMPID
,
&
msg
,
&
clist
);
sendMessage
(
msg
);
qDebug
()
<<
"UAS clears Waypoints!"
;
}
src/ui/WaypointList.cc
View file @
1bf17999
...
...
@@ -99,15 +99,16 @@ void WaypointList::setUAS(UASInterface* uas)
void
WaypointList
::
setWaypoint
(
int
uasId
,
int
id
,
double
x
,
double
y
,
double
z
,
double
yaw
,
bool
autocontinue
,
bool
current
)
{
transmitDelay
->
start
(
1000
);
QString
string
=
"New waypoint"
;
if
(
waypointNames
.
contains
(
id
))
{
string
=
waypointNames
.
value
(
id
);
}
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
);
addWaypoint
(
wp
);
}
...
...
@@ -152,7 +153,6 @@ void WaypointList::transmit()
m_ui
->
transmitButton
->
setEnabled
(
false
);
emit
clearWaypointList
();
waypointNames
.
clear
();
emit
for
(
int
i
=
0
;
i
<
waypoints
.
size
();
i
++
)
{
Waypoint
*
wp
=
waypoints
[
i
];
...
...
@@ -186,7 +186,13 @@ void WaypointList::add()
void
WaypointList
::
addWaypoint
(
Waypoint
*
wp
)
{
if
(
waypoints
.
contains
(
wp
))
{
removeWaypoint
(
wp
);
}
waypoints
.
insert
(
wp
->
id
,
wp
);
if
(
!
wpViews
.
contains
(
wp
))
{
WaypointView
*
wpview
=
new
WaypointView
(
wp
,
this
);
...
...
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