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
63fe5526
Commit
63fe5526
authored
May 13, 2010
by
pixhawk
Browse files
Finished communication settings widget
parent
0042aebd
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/uas/UAS.cc
View file @
63fe5526
...
@@ -513,9 +513,11 @@ int UAS::getCommunicationStatus() const
...
@@ -513,9 +513,11 @@ int UAS::getCommunicationStatus() const
void
UAS
::
requestWaypoints
()
void
UAS
::
requestWaypoints
()
{
{
mavlink_message_t
m
essage
;
mavlink_message_t
m
sg
;
//messagePackGetWaypoints(MG::SYSTEM::ID, &message); FIXME
//messagePackGetWaypoints(MG::SYSTEM::ID, &message); FIXME
sendMessage
(
message
);
// Send message twice to increase chance of reception
sendMessage
(
msg
);
sendMessage
(
msg
);
qDebug
()
<<
"UAS Request WPs"
;
qDebug
()
<<
"UAS Request WPs"
;
}
}
...
@@ -523,6 +525,8 @@ void UAS::requestParameters()
...
@@ -523,6 +525,8 @@ void UAS::requestParameters()
{
{
mavlink_message_t
msg
;
mavlink_message_t
msg
;
mavlink_msg_param_request_list_pack
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
this
->
getUASID
(),
0
);
mavlink_msg_param_request_list_pack
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
this
->
getUASID
(),
0
);
// Send message twice to increase chance of reception
sendMessage
(
msg
);
sendMessage
(
msg
);
sendMessage
(
msg
);
}
}
...
@@ -551,6 +555,8 @@ void UAS::enableAllDataTransmission(bool enabled)
...
@@ -551,6 +555,8 @@ void UAS::enableAllDataTransmission(bool enabled)
stream
.
target_component
=
0
;
stream
.
target_component
=
0
;
// Encode and send the message
// Encode and send the message
mavlink_msg_request_data_stream_encode
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
&
stream
);
mavlink_msg_request_data_stream_encode
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
&
stream
);
// Send message twice to increase chance of reception
sendMessage
(
msg
);
sendMessage
(
msg
);
sendMessage
(
msg
);
}
}
...
@@ -571,6 +577,8 @@ void UAS::enableRawSensorDataTransmission(bool enabled)
...
@@ -571,6 +577,8 @@ void UAS::enableRawSensorDataTransmission(bool enabled)
stream
.
target_component
=
0
;
stream
.
target_component
=
0
;
// Encode and send the message
// Encode and send the message
mavlink_msg_request_data_stream_encode
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
&
stream
);
mavlink_msg_request_data_stream_encode
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
&
stream
);
// Send message twice to increase chance of reception
sendMessage
(
msg
);
sendMessage
(
msg
);
sendMessage
(
msg
);
}
}
...
@@ -591,6 +599,8 @@ void UAS::enableExtendedSystemStatusTransmission(bool enabled)
...
@@ -591,6 +599,8 @@ void UAS::enableExtendedSystemStatusTransmission(bool enabled)
stream
.
target_component
=
0
;
stream
.
target_component
=
0
;
// Encode and send the message
// Encode and send the message
mavlink_msg_request_data_stream_encode
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
&
stream
);
mavlink_msg_request_data_stream_encode
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
&
stream
);
// Send message twice to increase chance of reception
sendMessage
(
msg
);
sendMessage
(
msg
);
sendMessage
(
msg
);
}
}
...
@@ -611,6 +621,8 @@ void UAS::enableRCChannelDataTransmission(bool enabled)
...
@@ -611,6 +621,8 @@ void UAS::enableRCChannelDataTransmission(bool enabled)
stream
.
target_component
=
0
;
stream
.
target_component
=
0
;
// Encode and send the message
// Encode and send the message
mavlink_msg_request_data_stream_encode
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
&
stream
);
mavlink_msg_request_data_stream_encode
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
&
stream
);
// Send message twice to increase chance of reception
sendMessage
(
msg
);
sendMessage
(
msg
);
sendMessage
(
msg
);
}
}
...
@@ -631,6 +643,8 @@ void UAS::enableRawControllerDataTransmission(bool enabled)
...
@@ -631,6 +643,8 @@ void UAS::enableRawControllerDataTransmission(bool enabled)
stream
.
target_component
=
0
;
stream
.
target_component
=
0
;
// Encode and send the message
// Encode and send the message
mavlink_msg_request_data_stream_encode
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
&
stream
);
mavlink_msg_request_data_stream_encode
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
&
stream
);
// Send message twice to increase chance of reception
sendMessage
(
msg
);
sendMessage
(
msg
);
sendMessage
(
msg
);
}
}
...
@@ -651,6 +665,8 @@ void UAS::enableRawSensorFusionTransmission(bool enabled)
...
@@ -651,6 +665,8 @@ void UAS::enableRawSensorFusionTransmission(bool enabled)
stream
.
target_component
=
0
;
stream
.
target_component
=
0
;
// Encode and send the message
// Encode and send the message
mavlink_msg_request_data_stream_encode
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
&
stream
);
mavlink_msg_request_data_stream_encode
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
&
stream
);
// Send message twice to increase chance of reception
sendMessage
(
msg
);
sendMessage
(
msg
);
sendMessage
(
msg
);
}
}
...
@@ -692,12 +708,12 @@ void UAS::setParameter(int component, QString id, float value)
...
@@ -692,12 +708,12 @@ void UAS::setParameter(int component, QString id, float value)
**/
**/
void
UAS
::
launch
()
void
UAS
::
launch
()
{
{
mavlink_message_t
m
essage
;
mavlink_message_t
m
sg
;
// TODO Replace MG System ID with static function call and allow to change ID in GUI
// TODO Replace MG System ID with static function call and allow to change ID in GUI
mavlink_msg_action_pack
(
MG
::
SYSTEM
::
ID
,
MG
::
SYSTEM
::
COMPID
,
&
m
essage
,
this
->
getUASID
(),(
int
)
MAV_ACTION_LAUNCH
);
mavlink_msg_action_pack
(
MG
::
SYSTEM
::
ID
,
MG
::
SYSTEM
::
COMPID
,
&
m
sg
,
this
->
getUASID
(),(
int
)
MAV_ACTION_LAUNCH
);
s
end
M
essage
(
message
);
// S
end
m
essage
twice to increase chance of reception
qDebug
()
<<
"UAS LAUNCHED!"
;
sendMessage
(
msg
)
;
//emit commandSent(LAUNCH
);
sendMessage
(
msg
);
}
}
/**
/**
...
@@ -706,10 +722,12 @@ void UAS::launch()
...
@@ -706,10 +722,12 @@ void UAS::launch()
**/
**/
void
UAS
::
enable_motors
()
void
UAS
::
enable_motors
()
{
{
mavlink_message_t
m
essage
;
mavlink_message_t
m
sg
;
// TODO Replace MG System ID with static function call and allow to change ID in GUI
// TODO Replace MG System ID with static function call and allow to change ID in GUI
mavlink_msg_action_pack
(
MG
::
SYSTEM
::
ID
,
MG
::
SYSTEM
::
COMPID
,
&
message
,
this
->
getUASID
(),(
int
)
MAV_ACTION_MOTORS_START
);
mavlink_msg_action_pack
(
MG
::
SYSTEM
::
ID
,
MG
::
SYSTEM
::
COMPID
,
&
msg
,
this
->
getUASID
(),(
int
)
MAV_ACTION_MOTORS_START
);
sendMessage
(
message
);
// Send message twice to increase chance of reception
sendMessage
(
msg
);
sendMessage
(
msg
);
}
}
/**
/**
...
@@ -718,10 +736,12 @@ void UAS::enable_motors()
...
@@ -718,10 +736,12 @@ void UAS::enable_motors()
**/
**/
void
UAS
::
disable_motors
()
void
UAS
::
disable_motors
()
{
{
mavlink_message_t
m
essage
;
mavlink_message_t
m
sg
;
// TODO Replace MG System ID with static function call and allow to change ID in GUI
// TODO Replace MG System ID with static function call and allow to change ID in GUI
mavlink_msg_action_pack
(
MG
::
SYSTEM
::
ID
,
MG
::
SYSTEM
::
COMPID
,
&
message
,
this
->
getUASID
(),(
int
)
MAV_ACTION_MOTORS_STOP
);
mavlink_msg_action_pack
(
MG
::
SYSTEM
::
ID
,
MG
::
SYSTEM
::
COMPID
,
&
msg
,
this
->
getUASID
(),(
int
)
MAV_ACTION_MOTORS_STOP
);
sendMessage
(
message
);
// Send message twice to increase chance of reception
sendMessage
(
msg
);
sendMessage
(
msg
);
}
}
void
UAS
::
setManualControlCommands
(
double
roll
,
double
pitch
,
double
yaw
,
double
thrust
)
void
UAS
::
setManualControlCommands
(
double
roll
,
double
pitch
,
double
yaw
,
double
thrust
)
...
@@ -767,20 +787,23 @@ void UAS::receiveButton(int buttonIndex)
...
@@ -767,20 +787,23 @@ void UAS::receiveButton(int buttonIndex)
void
UAS
::
setWaypoint
(
Waypoint
*
wp
)
void
UAS
::
setWaypoint
(
Waypoint
*
wp
)
{
{
mavlink_message_t
m
essage
;
mavlink_message_t
m
sg
;
// FIXME
// FIXME
//messagePackSetWaypoint(MG::SYSTEM::ID, &message, wp->id, wp->x, wp->y, wp->z, wp->yaw, (wp->autocontinue ? 1 : 0));
//messagePackSetWaypoint(MG::SYSTEM::ID, &message, wp->id, wp->x, wp->y, wp->z, wp->yaw, (wp->autocontinue ? 1 : 0));
// mavlink_msg_waypoint_pack(MG::SYSTEM::ID, MG::SYSTEM::COMPID, &message, wp->name, wp->id,wp->x, wp->y, wp->z, wp->yaw, (wp->autocontinue ? 1 : 0));
// mavlink_msg_waypoint_pack(MG::SYSTEM::ID, MG::SYSTEM::COMPID, &message, wp->name, wp->id,wp->x, wp->y, wp->z, wp->yaw, (wp->autocontinue ? 1 : 0));
sendMessage
(
message
);
// Send message twice to increase chance of reception
qDebug
()
<<
"UAS SENT Waypoint "
<<
wp
->
id
;
sendMessage
(
msg
);
sendMessage
(
msg
);
}
}
void
UAS
::
setWaypointActive
(
int
id
)
void
UAS
::
setWaypointActive
(
int
id
)
{
{
mavlink_message_t
m
essage
;
mavlink_message_t
m
sg
;
// FIXME
// FIXME
//messagePackChooseWaypoint(MG::SYSTEM::ID, &message, id);
//messagePackChooseWaypoint(MG::SYSTEM::ID, &message, id);
sendMessage
(
message
);
// 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
// TODO This should be not directly emitted, but rather being fed back from the UAS
emit
waypointSelected
(
getUASID
(),
id
);
emit
waypointSelected
(
getUASID
(),
id
);
}
}
...
@@ -788,27 +811,33 @@ void UAS::setWaypointActive(int id)
...
@@ -788,27 +811,33 @@ void UAS::setWaypointActive(int id)
void
UAS
::
halt
()
void
UAS
::
halt
()
{
{
mavlink_message_t
m
essage
;
mavlink_message_t
m
sg
;
// TODO Replace MG System ID with static function call and allow to change ID in GUI
// TODO Replace MG System ID with static function call and allow to change ID in GUI
mavlink_msg_action_pack
(
MG
::
SYSTEM
::
ID
,
MG
::
SYSTEM
::
COMPID
,
&
message
,
this
->
getUASID
(),
(
int
)
MAV_ACTION_HALT
);
mavlink_msg_action_pack
(
MG
::
SYSTEM
::
ID
,
MG
::
SYSTEM
::
COMPID
,
&
msg
,
this
->
getUASID
(),
(
int
)
MAV_ACTION_HALT
);
sendMessage
(
message
);
// Send message twice to increase chance of reception
sendMessage
(
msg
);
sendMessage
(
msg
);
}
}
void
UAS
::
go
()
void
UAS
::
go
()
{
{
mavlink_message_t
m
essage
;
mavlink_message_t
m
sg
;
// TODO Replace MG System ID with static function call and allow to change ID in GUI
// TODO Replace MG System ID with static function call and allow to change ID in GUI
mavlink_msg_action_pack
(
MG
::
SYSTEM
::
ID
,
MG
::
SYSTEM
::
COMPID
,
&
message
,
this
->
getUASID
(),
(
int
)
MAV_ACTION_CONTINUE
);
mavlink_msg_action_pack
(
MG
::
SYSTEM
::
ID
,
MG
::
SYSTEM
::
COMPID
,
&
msg
,
this
->
getUASID
(),
(
int
)
MAV_ACTION_CONTINUE
);
sendMessage
(
message
);
// Send message twice to increase chance of reception
sendMessage
(
msg
);
sendMessage
(
msg
);
}
}
/** Order the robot to return home / to land on the runway **/
/** Order the robot to return home / to land on the runway **/
void
UAS
::
home
()
void
UAS
::
home
()
{
{
mavlink_message_t
m
essage
;
mavlink_message_t
m
sg
;
// TODO Replace MG System ID with static function call and allow to change ID in GUI
// TODO Replace MG System ID with static function call and allow to change ID in GUI
mavlink_msg_action_pack
(
MG
::
SYSTEM
::
ID
,
MG
::
SYSTEM
::
COMPID
,
&
message
,
this
->
getUASID
(),
(
int
)
MAV_ACTION_RETURN
);
mavlink_msg_action_pack
(
MG
::
SYSTEM
::
ID
,
MG
::
SYSTEM
::
COMPID
,
&
msg
,
this
->
getUASID
(),
(
int
)
MAV_ACTION_RETURN
);
sendMessage
(
message
);
// Send message twice to increase chance of reception
sendMessage
(
msg
);
sendMessage
(
msg
);
}
}
/**
/**
...
@@ -817,9 +846,12 @@ void UAS::home()
...
@@ -817,9 +846,12 @@ void UAS::home()
*/
*/
void
UAS
::
emergencySTOP
()
void
UAS
::
emergencySTOP
()
{
{
mavlink_message_t
m
essage
;
mavlink_message_t
m
sg
;
// TODO Replace MG System ID with static function call and allow to change ID in GUI
// TODO Replace MG System ID with static function call and allow to change ID in GUI
mavlink_msg_action_pack
(
MG
::
SYSTEM
::
ID
,
MG
::
SYSTEM
::
COMPID
,
&
message
,
this
->
getUASID
(),
(
int
)
MAV_ACTION_EMCY_LAND
);
mavlink_msg_action_pack
(
MG
::
SYSTEM
::
ID
,
MG
::
SYSTEM
::
COMPID
,
&
msg
,
this
->
getUASID
(),
(
int
)
MAV_ACTION_EMCY_LAND
);
// Send message twice to increase chance of reception
sendMessage
(
msg
);
sendMessage
(
msg
);
}
}
/**
/**
...
@@ -845,10 +877,12 @@ bool UAS::emergencyKILL()
...
@@ -845,10 +877,12 @@ bool UAS::emergencyKILL()
if
(
ret
==
QMessageBox
::
Yes
)
if
(
ret
==
QMessageBox
::
Yes
)
{
{
mavlink_message_t
m
essage
;
mavlink_message_t
m
sg
;
// TODO Replace MG System ID with static function call and allow to change ID in GUI
// TODO Replace MG System ID with static function call and allow to change ID in GUI
mavlink_msg_action_pack
(
MG
::
SYSTEM
::
ID
,
MG
::
SYSTEM
::
COMPID
,
&
message
,
this
->
getUASID
(),
(
int
)
MAV_ACTION_EMCY_KILL
);
mavlink_msg_action_pack
(
MG
::
SYSTEM
::
ID
,
MG
::
SYSTEM
::
COMPID
,
&
msg
,
this
->
getUASID
(),
(
int
)
MAV_ACTION_EMCY_KILL
);
sendMessage
(
message
);
// Send message twice to increase chance of reception
sendMessage
(
msg
);
sendMessage
(
msg
);
result
=
true
;
result
=
true
;
}
}
return
result
;
return
result
;
...
@@ -872,10 +906,12 @@ void UAS::shutdown()
...
@@ -872,10 +906,12 @@ void UAS::shutdown()
if
(
ret
==
QMessageBox
::
Yes
)
if
(
ret
==
QMessageBox
::
Yes
)
{
{
// If the active UAS is set, execute command
// If the active UAS is set, execute command
mavlink_message_t
m
essage
;
mavlink_message_t
m
sg
;
// TODO Replace MG System ID with static function call and allow to change ID in GUI
// TODO Replace MG System ID with static function call and allow to change ID in GUI
mavlink_msg_action_pack
(
MG
::
SYSTEM
::
ID
,
MG
::
SYSTEM
::
COMPID
,
&
message
,
this
->
getUASID
(),
(
int
)
MAV_ACTION_SHUTDOWN
);
mavlink_msg_action_pack
(
MG
::
SYSTEM
::
ID
,
MG
::
SYSTEM
::
COMPID
,
&
msg
,
this
->
getUASID
(),
(
int
)
MAV_ACTION_SHUTDOWN
);
sendMessage
(
message
);
// Send message twice to increase chance of reception
sendMessage
(
msg
);
sendMessage
(
msg
);
result
=
true
;
result
=
true
;
}
}
}
}
...
...
src/ui/QGCSensorSettingsWidget.ui
View file @
63fe5526
...
@@ -14,6 +14,9 @@
...
@@ -14,6 +14,9 @@
<string>
Form
</string>
<string>
Form
</string>
</property>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout_4"
>
<layout
class=
"QGridLayout"
name=
"gridLayout_4"
>
<property
name=
"margin"
>
<number>
0
</number>
</property>
<item
row=
"0"
column=
"0"
>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QGroupBox"
name=
"groupBox"
>
<widget
class=
"QGroupBox"
name=
"groupBox"
>
<property
name=
"title"
>
<property
name=
"title"
>
...
...
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