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
348087f9
Commit
348087f9
authored
Nov 17, 2010
by
tecnosapiens
Browse files
add mavlink message a fuctions to send PDI values
parent
76df6050
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/uas/SlugsMAV.cc
View file @
348087f9
...
...
@@ -297,6 +297,13 @@ void SlugsMAV::receiveMessage(LinkInterface* link, mavlink_message_t message)
break
;
}
case
MAVLINK_MSG_ID_ACTION_ACK
:
{
mavlink_action_ack_t
ack
;
mavlink_msg_action_ack_decode
(
&
message
,
&
ack
);
emit
slugsActionAck
(
uasId
,
ack
.
action
,
ack
.
result
);
}
// case MAVLINK_MSG_ID_MID_LVL_CMDS://180
// {
...
...
src/uas/SlugsMAV.h
View file @
348087f9
...
...
@@ -135,6 +135,10 @@ signals:
uint8_t
gpsvisSat
,
quint64
time
);
void
slugsActionAck
(
int
systemId
,
uint8_t
action
,
uint8_t
result
);
...
...
src/ui/MainWindow.cc
View file @
348087f9
...
...
@@ -228,6 +228,7 @@ void MainWindow::connectWidgets()
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
dynamic_cast
<
SlugsHilSim
*>
(
slugsHilSimWidget
->
widget
()),
SLOT
(
activeUasSet
(
UASInterface
*
))
);
}
}
void
MainWindow
::
arrangeCenterStack
()
...
...
src/ui/SlugsPIDControl.cpp
View file @
348087f9
...
...
@@ -5,29 +5,93 @@
#include
<QPalette>
#include
<QColor>
#include
<QDebug>
#include
<UASManager.h>
#include
<UAS.h>
#include
"LinkManager.h"
SlugsPIDControl
::
SlugsPIDControl
(
QWidget
*
parent
)
:
QWidget
(
parent
),
ui
(
new
Ui
::
SlugsPIDControl
)
{
ui
->
setupUi
(
this
);
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
this
,
SLOT
(
activeUasSet
(
UASInterface
*
)));
activeUAS
=
NULL
;
setRedColorStyle
();
setGreenColorStyle
();
connect_set_pushButtons
();
connect_AirSpeed_LineEdit
();
// connect_set_pushButtons();
// connect_AirSpeed_LineEdit();
// connect_PitchFollowei_LineEdit();
// connect_RollControl_LineEdit();
// connect_HeigthError_LineEdit();
// connect_YawDamper_LineEdit();
// connect_Pitch2dT_LineEdit();
}
/**
* @brief Called when the a new UAS is set to active.
*
* Called when the a new UAS is set to active.
*
* @param uas The new active UAS
*/
void
SlugsPIDControl
::
activeUasSet
(
UASInterface
*
uas
)
{
SlugsMAV
*
slugsMav
=
dynamic_cast
<
SlugsMAV
*>
(
uas
);
if
(
slugsMav
!=
NULL
)
{
connect
(
slugsMav
,
SIGNAL
(
slugsActionAck
(
int
,
uint8_t
,
uint8_t
)),
this
,
SLOT
(
recibeMensaje
(
int
,
uint8_t
,
uint8_t
)));
}
// Set this UAS as active if it is the first one
if
(
activeUAS
==
0
)
{
activeUAS
=
uas
;
systemId
=
activeUAS
->
getUASID
();
connect_editLinesPDIvalues
();
//qDebug()<<"------------------->Active UAS ID: "<<uas->getUASID();
}
}
/**
* @brief Connect Edition Lines for PID Values
*
* @param
*/
void
SlugsPIDControl
::
connect_editLinesPDIvalues
()
{
if
(
activeUAS
)
{
connect_set_pushButtons
();
connect_AirSpeed_LineEdit
();
connect_PitchFollowei_LineEdit
();
connect_RollControl_LineEdit
();
connect_HeigthError_LineEdit
();
connect_YawDamper_LineEdit
();
connect_Pitch2dT_LineEdit
();
}
}
SlugsPIDControl
::~
SlugsPIDControl
()
{
delete
ui
;
}
/**
* Set the background color RED style for the GroupBox PID when change lineEdit information
*
@brief
Set the background color RED style for the GroupBox PID when change lineEdit information
*
*/
void
SlugsPIDControl
::
setRedColorStyle
()
...
...
@@ -46,7 +110,7 @@ void SlugsPIDControl::setRedColorStyle()
}
/**
* Set the background color GREEN style for the GroupBox PID when change lineEdit information
*
@brief
Set the background color GREEN style for the GroupBox PID when change lineEdit information
*
*/
void
SlugsPIDControl
::
setGreenColorStyle
()
...
...
@@ -64,12 +128,17 @@ void SlugsPIDControl::setGreenColorStyle()
}
/**
* Connection Signal and Slot of the set buttons on the widget
*
@brief
Connection Signal and Slot of the set buttons on the widget
*/
void
SlugsPIDControl
::
connect_set_pushButtons
()
{
//ToDo connect buttons set and get. Before create the slots
connect
(
ui
->
dT_PID_set_pushButton
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
changeColor_GREEN_AirSpeed_groupBox
()));
connect
(
ui
->
dT_PID_set_pushButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
changeColor_GREEN_AirSpeed_groupBox
()));
connect
(
ui
->
dE_PID_set_pushButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
changeColor_GREEN_PitchFollowei_groupBox
()));
connect
(
ui
->
dA_PID_set_pushButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
changeColor_GREEN_RollControl_groupBox
()));
connect
(
ui
->
HELPComm_PDI_set_pushButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
changeColor_GREEN_HeigthError_groupBox
()));
connect
(
ui
->
dR_PDI_set_pushButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
changeColor_GREEN_YawDamper_groupBox
()));
connect
(
ui
->
Pitch2dT_PDI_set_pushButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
changeColor_GREEN_Pitch2dT_groupBox
()));
}
...
...
@@ -90,7 +159,188 @@ void SlugsPIDControl::changeColor_RED_AirSpeed_groupBox(QString text)
void
SlugsPIDControl
::
changeColor_GREEN_AirSpeed_groupBox
()
{
//create the packet
pidMessage
.
target
=
activeUAS
->
getUASID
();
pidMessage
.
idx
=
0
;
pidMessage
.
pVal
=
ui
->
dT_P_set
->
text
().
toFloat
();
pidMessage
.
iVal
=
ui
->
dT_I_set
->
text
().
toFloat
();
pidMessage
.
dVal
=
ui
->
dT_D_set
->
text
().
toFloat
();
UAS
*
uas
=
dynamic_cast
<
UAS
*>
(
UASManager
::
instance
()
->
getActiveUAS
());
mavlink_message_t
msg
;
mavlink_msg_pid_encode
(
MG
::
SYSTEM
::
ID
,
MG
::
SYSTEM
::
COMPID
,
&
msg
,
&
pidMessage
);
uas
->
sendMessage
(
msg
);
ui
->
AirSpeedHold_groupBox
->
setStyleSheet
(
GREENcolorStyle
);
}
void
SlugsPIDControl
::
connect_PitchFollowei_LineEdit
()
{
connect
(
ui
->
dE_P_set
,
SIGNAL
(
textChanged
(
QString
)),
this
,
SLOT
(
changeColor_RED_PitchFollowei_groupBox
(
QString
)));
connect
(
ui
->
dE_I_set
,
SIGNAL
(
textChanged
(
QString
)),
this
,
SLOT
(
changeColor_RED_PitchFollowei_groupBox
(
QString
)));
connect
(
ui
->
dE_D_set
,
SIGNAL
(
textChanged
(
QString
)),
this
,
SLOT
(
changeColor_RED_PitchFollowei_groupBox
(
QString
)));
}
void
SlugsPIDControl
::
changeColor_RED_PitchFollowei_groupBox
(
QString
text
)
{
Q_UNUSED
(
text
);
ui
->
PitchFlowei_groupBox
->
setStyleSheet
(
REDcolorStyle
);
}
void
SlugsPIDControl
::
changeColor_GREEN_PitchFollowei_groupBox
()
{
ui
->
PitchFlowei_groupBox
->
setStyleSheet
(
GREENcolorStyle
);
}
// Functions for Roll Control GroupBox
/**
* @brief Change color style to red when PID values of Roll Control are edited
*
*
* @param
*/
void
SlugsPIDControl
::
changeColor_RED_RollControl_groupBox
(
QString
text
)
{
Q_UNUSED
(
text
);
ui
->
RollControl_groupBox
->
setStyleSheet
(
REDcolorStyle
);
}
/**
* @brief Change color style to green when PID values of Roll Control are send to UAS
*
* @param
*/
void
SlugsPIDControl
::
changeColor_GREEN_RollControl_groupBox
()
{
ui
->
RollControl_groupBox
->
setStyleSheet
(
GREENcolorStyle
);
}
/**
* @brief Connects the SIGNALS from the editline to SLOT RollControl_groupBox
*
* @param
*/
void
SlugsPIDControl
::
connect_RollControl_LineEdit
()
{
connect
(
ui
->
dA_P_set
,
SIGNAL
(
textChanged
(
QString
)),
this
,
SLOT
(
changeColor_RED_RollControl_groupBox
(
QString
)));
connect
(
ui
->
dA_I_set
,
SIGNAL
(
textChanged
(
QString
)),
this
,
SLOT
(
changeColor_RED_RollControl_groupBox
(
QString
)));
connect
(
ui
->
dA_D_set
,
SIGNAL
(
textChanged
(
QString
)),
this
,
SLOT
(
changeColor_RED_RollControl_groupBox
(
QString
)));
}
// Functions for Heigth Error GroupBox
/**
* @brief Change color style to red when PID values of Heigth Error are edited
*
*
* @param
*/
void
SlugsPIDControl
::
changeColor_RED_HeigthError_groupBox
(
QString
text
)
{
Q_UNUSED
(
text
);
ui
->
HeightErrorLoPitch_groupBox
->
setStyleSheet
(
REDcolorStyle
);
}
/**
* @brief Change color style to green when PID values of Heigth Error are send to UAS
*
* @param
*/
void
SlugsPIDControl
::
changeColor_GREEN_HeigthError_groupBox
()
{
ui
->
HeightErrorLoPitch_groupBox
->
setStyleSheet
(
GREENcolorStyle
);
}
/**
* @brief Connects the SIGNALS from the editline to SLOT HeigthError_groupBox
*
* @param
*/
void
SlugsPIDControl
::
connect_HeigthError_LineEdit
()
{
connect
(
ui
->
HELPComm_P_set
,
SIGNAL
(
textChanged
(
QString
)),
this
,
SLOT
(
changeColor_RED_HeigthError_groupBox
(
QString
)));
connect
(
ui
->
HELPComm_I_set
,
SIGNAL
(
textChanged
(
QString
)),
this
,
SLOT
(
changeColor_RED_HeigthError_groupBox
(
QString
)));
connect
(
ui
->
HELPComm_FF_set
,
SIGNAL
(
textChanged
(
QString
)),
this
,
SLOT
(
changeColor_RED_HeigthError_groupBox
(
QString
)));
}
// Functions for Yaw Damper GroupBox
/**
* @brief Change color style to red when PID values of Yaw Damper are edited
*
*
* @param
*/
void
SlugsPIDControl
::
changeColor_RED_YawDamper_groupBox
(
QString
text
)
{
Q_UNUSED
(
text
);
ui
->
YawDamper_groupBox
->
setStyleSheet
(
REDcolorStyle
);
}
/**
* @brief Change color style to green when PID values of Yaw Damper are send to UAS
*
* @param
*/
void
SlugsPIDControl
::
changeColor_GREEN_YawDamper_groupBox
()
{
ui
->
YawDamper_groupBox
->
setStyleSheet
(
GREENcolorStyle
);
}
/**
* @brief Connects the SIGNALS from the editline to SLOT YawDamper_groupBox
*
* @param
*/
void
SlugsPIDControl
::
connect_YawDamper_LineEdit
()
{
connect
(
ui
->
dR_P_set
,
SIGNAL
(
textChanged
(
QString
)),
this
,
SLOT
(
changeColor_RED_YawDamper_groupBox
(
QString
)));
connect
(
ui
->
dR_I_set
,
SIGNAL
(
textChanged
(
QString
)),
this
,
SLOT
(
changeColor_RED_YawDamper_groupBox
(
QString
)));
connect
(
ui
->
dR_D_set
,
SIGNAL
(
textChanged
(
QString
)),
this
,
SLOT
(
changeColor_RED_YawDamper_groupBox
(
QString
)));
}
// Functions for Pitch to dT GroupBox
/**
* @brief Change color style to red when PID values of Pitch to dT are edited
*
*
* @param
*/
void
SlugsPIDControl
::
changeColor_RED_Pitch2dT_groupBox
(
QString
text
)
{
Q_UNUSED
(
text
);
ui
->
Pitch2dTFFterm_groupBox
->
setStyleSheet
(
REDcolorStyle
);
}
/**
* @brief Change color style to green when PID values of Pitch to dT are send to UAS
*
* @param
*/
void
SlugsPIDControl
::
changeColor_GREEN_Pitch2dT_groupBox
()
{
ui
->
Pitch2dTFFterm_groupBox
->
setStyleSheet
(
GREENcolorStyle
);
}
/**
* @brief Connects the SIGNALS from the editline to SLOT Pitch2dT_groupBox
*
* @param
*/
void
SlugsPIDControl
::
connect_Pitch2dT_LineEdit
()
{
connect
(
ui
->
P2dT_FF_set
,
SIGNAL
(
textChanged
(
QString
)),
this
,
SLOT
(
changeColor_RED_Pitch2dT_groupBox
(
QString
)));
}
void
SlugsPIDControl
::
recibeMensaje
(
int
systemId
,
uint8_t
action
,
uint8_t
result
)
{
ui
->
recepcion_label
->
setText
(
QString
::
number
(
action
));
}
src/ui/SlugsPIDControl.h
View file @
348087f9
...
...
@@ -3,6 +3,10 @@
#include
<QWidget>
#include
<QGroupBox>
#include
"UASInterface.h"
#include
"QGCMAVLink.h"
#include
"SlugsMAV.h"
namespace
Ui
{
class
SlugsPIDControl
;
...
...
@@ -18,11 +22,52 @@ public:
public
slots
:
/**
* @brief Called when the a new UAS is set to active.
*
* Called when the a new UAS is set to active.
*
* @param uas The new active UAS
*/
void
activeUasSet
(
UASInterface
*
uas
);
/**
*/
void
setRedColorStyle
();
/**
* @brief Set color StyleSheet GREEN
*
* @param
*/
void
setGreenColorStyle
();
/**
* @brief Connect Set pushButtons to change the color GroupBox
*
* @param
*/
void
connect_set_pushButtons
();
/**
* @brief Connect Edition Lines for PID Values
*
* @param
*/
void
connect_editLinesPDIvalues
();
// Fuctions for Air Speed GroupBox
/**
* @brief Change color style to red when PID values of Air Speed are edited
*
*
* @param
*/
void
changeColor_RED_AirSpeed_groupBox
(
QString
text
);
/**
* @brief Change color style to green when PID values of Air Speed are send to UAS
*
* @param
*/
void
changeColor_GREEN_AirSpeed_groupBox
();
/**
* @brief Connects the SIGNALS from the editline to SLOT changeColor_RED_AirSpeed_groupBox()
...
...
@@ -31,20 +76,134 @@ public slots:
*/
void
connect_AirSpeed_LineEdit
();
// Functions for Pitch Followei GroupBox
/**
* @brief Change color style to red when PID values of Pitch Followei are edited
*
*
* @param
*/
void
changeColor_RED_PitchFollowei_groupBox
(
QString
text
);
/**
* @brief Change color style to green when PID values of Pitch Followei are send to UAS
*
* @param
*/
void
changeColor_GREEN_PitchFollowei_groupBox
();
/**
* @brief Connects the SIGNALS from the editline to SLOT PitchFlowei_groupBox
*
* @param
*/
void
connect_PitchFollowei_LineEdit
();
// Functions for Roll Control GroupBox
/**
* @brief Change color style to red when PID values of Roll Control are edited
*
*
* @param
*/
void
changeColor_RED_RollControl_groupBox
(
QString
text
);
/**
* @brief Change color style to green when PID values of Roll Control are send to UAS
*
* @param
*/
void
changeColor_GREEN_RollControl_groupBox
();
/**
* @brief Connects the SIGNALS from the editline to SLOT RollControl_groupBox
*
* @param
*/
void
connect_RollControl_LineEdit
();
// Functions for Heigth Error GroupBox
/**
* @brief Change color style to red when PID values of Heigth Error are edited
*
*
* @param
*/
void
changeColor_RED_HeigthError_groupBox
(
QString
text
);
/**
* @brief Change color style to green when PID values of Heigth Error are send to UAS
*
* @param
*/
void
changeColor_GREEN_HeigthError_groupBox
();
/**
* @brief Connects the SIGNALS from the editline to SLOT HeigthError_groupBox
*
* @param
*/
void
connect_HeigthError_LineEdit
();
// Functions for Yaw Damper GroupBox
/**
* @brief Change color style to red when PID values of Yaw Damper are edited
*
*
* @param
*/
void
changeColor_RED_YawDamper_groupBox
(
QString
text
);
/**
* @brief Change color style to green when PID values of Yaw Damper are send to UAS
*
* @param
*/
void
changeColor_GREEN_YawDamper_groupBox
();
/**
* @brief Connects the SIGNALS from the editline to SLOT YawDamper_groupBox
*
* @param
*/
void
connect_YawDamper_LineEdit
();
// Functions for Pitch to dT GroupBox
/**
* @brief Change color style to red when PID values of Pitch to dT are edited
*
*
* @param
*/
void
changeColor_RED_Pitch2dT_groupBox
(
QString
text
);
/**
* @brief Change color style to green when PID values of Pitch to dT are send to UAS
*
* @param
*/
void
changeColor_GREEN_Pitch2dT_groupBox
();
/**
* @brief Connects the SIGNALS from the editline to SLOT Pitch2dT_groupBox
*
* @param
*/
void
connect_Pitch2dT_LineEdit
();
//Create, send and get Messages PID
// void createMessagePID();
void
recibeMensaje
(
int
systemId
,
uint8_t
action
,
uint8_t
result
);
void
connect_set_pushButtons
();
private:
Ui
::
SlugsPIDControl
*
ui
;
UASInterface
*
activeUAS
;
int
systemId
;
bool
change_dT
;
//Color Styles
QString
REDcolorStyle
;
QString
GREENcolorStyle
;
QString
ORIGINcolorStyle
;
//SlugsMav Message
mavlink_pid_t
pidMessage
;
};
#endif // SLUGSPIDCONTROL_H
src/ui/SlugsPIDControl.ui
View file @
348087f9
...
...
@@ -122,6 +122,13 @@
</item>
</layout>
</item>
<item>
<widget
class=
"QLabel"
name=
"recepcion_label"
>
<property
name=
"text"
>
<string>
Recepcion
</string>
</property>
</widget>
</item>
<item>
<spacer
name=
"verticalSpacer_5"
>
<property
name=
"orientation"
>
...
...
@@ -671,14 +678,14 @@
<item>
<layout
class=
"QGridLayout"
name=
"gridLayout_12"
>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QPushButton"
name=
"HELPComm_set_pushButton"
>
<widget
class=
"QPushButton"
name=
"HELPComm_
PDI_
set_pushButton"
>
<property
name=
"text"
>
<string>
SET
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"2"
>
<widget
class=
"QPushButton"
name=
"HELPComm_get_pushButton"
>
<widget
class=
"QPushButton"
name=
"HELPComm_
PDI_
get_pushButton"
>
<property
name=
"text"
>
<string>
GET
</string>
</property>
...
...
@@ -834,14 +841,14 @@
<item>
<layout
class=
"QGridLayout"
name=
"gridLayout_14"
>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QPushButton"
name=
"dR_set_pushButton"
>
<widget
class=
"QPushButton"
name=
"dR_
PDI_
set_pushButton"
>
<property
name=
"text"
>
<string>
SET
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"2"
>
<widget
class=
"QPushButton"
name=
"dR_get_pushButton"
>
<widget
class=
"QPushButton"
name=
"dR_
PDI_
get_pushButton"
>
<property
name=
"text"
>
<string>
GET
</string>
</property>
...
...
@@ -922,14 +929,14 @@
<item>
<layout
class=
"QGridLayout"
name=
"gridLayout_16"
>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QPushButton"
name=
"Pitch2dT_set_pushButton"
>
<widget
class=
"QPushButton"
name=
"Pitch2dT_
PDI_
set_pushButton"
>
<property
name=
"text"
>
<string>
SET
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"2"
>
<widget
class=
"QPushButton"
name=
"Pitch2dT_get_pushButton"
>
<widget
class=
"QPushButton"
name=
"Pitch2dT_
PDI_
get_pushButton"
>
<property
name=
"text"
>
<string>
GET
</string>
</property>
...
...
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