Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
a3e2cb96
Commit
a3e2cb96
authored
Aug 30, 2010
by
pixhawk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added new calibration actions
parent
9597d772
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
104 additions
and
32 deletions
+104
-32
UAS.cc
src/uas/UAS.cc
+38
-0
UAS.h
src/uas/UAS.h
+7
-0
UASInterface.h
src/uas/UASInterface.h
+8
-0
QGCRemoteControlView.cc
src/ui/QGCRemoteControlView.cc
+18
-18
QGCRemoteControlView.h
src/ui/QGCRemoteControlView.h
+1
-1
QGCSensorSettingsWidget.cc
src/ui/QGCSensorSettingsWidget.cc
+6
-0
QGCSensorSettingsWidget.ui
src/ui/QGCSensorSettingsWidget.ui
+26
-13
No files found.
src/uas/UAS.cc
View file @
a3e2cb96
...
...
@@ -391,6 +391,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
{
mavlink_rc_channels_t
channels
;
mavlink_msg_rc_channels_decode
(
&
message
,
&
channels
);
emit
remoteControlRSSIChanged
(
channels
.
rssi
/
255.0
f
);
for
(
int
i
=
0
;
i
<
8
;
i
++
)
{
switch
(
i
)
...
...
@@ -561,6 +562,43 @@ void UAS::setLocalPositionSetpoint(float x, float y, float z, float yaw)
#endif
}
void
UAS
::
setLocalPositionOffset
(
float
x
,
float
y
,
float
z
,
float
yaw
)
{
#ifdef MAVLINK_ENABLED_PIXHAWK_MESSAGES
mavlink_message_t
msg
;
mavlink_msg_position_control_offset_set_pack
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
uasId
,
0
,
x
,
y
,
z
,
yaw
);
sendMessage
(
msg
);
#endif
}
void
UAS
::
startRadioControlCalibration
()
{
mavlink_message_t
msg
;
mavlink_msg_action_pack
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
uasId
,
MAV_COMP_ID_IMU
,
MAV_ACTION_CALIBRATE_RC
);
sendMessage
(
msg
);
}
void
UAS
::
startMagnetometerCalibration
()
{
mavlink_message_t
msg
;
mavlink_msg_action_pack
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
uasId
,
MAV_COMP_ID_IMU
,
MAV_ACTION_CALIBRATE_MAG
);
sendMessage
(
msg
);
}
void
UAS
::
startGyroscopeCalibration
()
{
mavlink_message_t
msg
;
mavlink_msg_action_pack
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
uasId
,
MAV_COMP_ID_IMU
,
MAV_ACTION_CALIBRATE_GYRO
);
sendMessage
(
msg
);
}
void
UAS
::
startPressureCalibration
()
{
mavlink_message_t
msg
;
mavlink_msg_action_pack
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
uasId
,
MAV_COMP_ID_IMU
,
MAV_ACTION_CALIBRATE_PRESSURE
);
sendMessage
(
msg
);
}
quint64
UAS
::
getUnixTime
(
quint64
time
)
{
if
(
time
==
0
)
...
...
src/uas/UAS.h
View file @
a3e2cb96
...
...
@@ -221,6 +221,13 @@ public slots:
/** @brief Set local position setpoint */
void
setLocalPositionSetpoint
(
float
x
,
float
y
,
float
z
,
float
yaw
);
/** @brief Add an offset in body frame to the setpoint */
void
setLocalPositionOffset
(
float
x
,
float
y
,
float
z
,
float
yaw
);
void
startRadioControlCalibration
();
void
startMagnetometerCalibration
();
void
startGyroscopeCalibration
();
void
startPressureCalibration
();
signals:
...
...
src/uas/UASInterface.h
View file @
a3e2cb96
...
...
@@ -211,6 +211,12 @@ public slots:
virtual
void
enableRawSensorFusionTransmission
(
bool
enabled
)
=
0
;
virtual
void
setLocalPositionSetpoint
(
float
x
,
float
y
,
float
z
,
float
yaw
)
=
0
;
virtual
void
setLocalPositionOffset
(
float
x
,
float
y
,
float
z
,
float
yaw
)
=
0
;
virtual
void
startRadioControlCalibration
()
=
0
;
virtual
void
startMagnetometerCalibration
()
=
0
;
virtual
void
startGyroscopeCalibration
()
=
0
;
virtual
void
startPressureCalibration
()
=
0
;
protected:
QColor
color
;
...
...
@@ -331,6 +337,8 @@ signals:
void
positionYawControlEnabled
(
bool
enabled
);
/** @brief Value of a remote control channel */
void
remoteControlChannelChanged
(
int
channelId
,
float
raw
,
float
normalized
);
/** @brief Remote control RSSI changed */
void
remoteControlRSSIChanged
(
float
rssi
);
/**
* @brief Localization quality changed
...
...
src/ui/QGCRemoteControlView.cc
View file @
a3e2cb96
...
...
@@ -52,18 +52,21 @@ QGCRemoteControlView::QGCRemoteControlView(QWidget *parent) :
nameLabel
=
new
QLabel
(
this
);
nameLabel
->
setText
(
"No MAV selected yet.."
);
layout
->
addWidget
(
nameLabel
,
0
,
0
,
1
,
2
);
// Add spacer left of button
layout
->
addItem
(
new
QSpacerItem
(
0
,
0
,
QSizePolicy
::
Expanding
,
QSizePolicy
::
Expanding
),
2
,
0
);
// Set stretch to maximize spacer, not button
layout
->
setColumnStretch
(
0
,
100
);
layout
->
setColumnStretch
(
1
,
1
);
// Calibrate button
QPushButton
*
calibrateButton
=
new
QPushButton
(
this
);
calibrateButton
->
setText
(
tr
(
"Calibrate"
));
// Connect to calibration slot
connect
(
calibrateButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
calibrate
()));
// Add button
layout
->
addWidget
(
calibrateButton
,
2
,
1
);
// RSSI bar
// Create new layout
QHBoxLayout
*
rssiLayout
=
new
QHBoxLayout
();
rssiLayout
->
setSpacing
(
5
);
// Add content
rssiLayout
->
addWidget
(
new
QLabel
(
tr
(
"Signal"
),
this
));
// Append raw label
// Append progress bar
rssiBar
=
new
QProgressBar
(
this
);
rssiBar
->
setMinimum
(
0
);
rssiBar
->
setMaximum
(
100
);
rssiBar
->
setValue
(
0
);
rssiLayout
->
addWidget
(
rssiBar
);
layout
->
addItem
(
rssiLayout
,
2
,
0
,
1
,
2
);
setVisible
(
false
);
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
int
)),
this
,
SLOT
(
setUASId
(
int
)));
...
...
@@ -75,11 +78,6 @@ QGCRemoteControlView::~QGCRemoteControlView()
delete
channelLayout
;
}
void
QGCRemoteControlView
::
calibrate
()
{
// Run auto-calibration
}
void
QGCRemoteControlView
::
setUASId
(
int
id
)
{
if
(
uasId
!=
-
1
)
...
...
@@ -89,6 +87,7 @@ void QGCRemoteControlView::setUASId(int id)
{
// The UAS exists, disconnect any existing connections
disconnect
(
uas
,
SIGNAL
(
remoteControlChannelChanged
(
int
,
float
,
float
)),
this
,
SLOT
(
setChannel
(
int
,
float
,
float
)));
disconnect
(
uas
,
SIGNAL
(
remoteControlRSSIChanged
(
float
)),
this
,
SLOT
(
setRemoteRSSI
(
float
)));
}
}
...
...
@@ -99,6 +98,7 @@ void QGCRemoteControlView::setUASId(int id)
// New UAS exists, connect
nameLabel
->
setText
(
QString
(
"RC Input of %1"
).
arg
(
newUAS
->
getUASName
()));
connect
(
newUAS
,
SIGNAL
(
remoteControlChannelChanged
(
int
,
float
,
float
)),
this
,
SLOT
(
setChannel
(
int
,
float
,
float
)));
connect
(
newUAS
,
SIGNAL
(
remoteControlRSSIChanged
(
float
)),
this
,
SLOT
(
setRemoteRSSI
(
float
)));
}
}
...
...
@@ -132,7 +132,7 @@ void QGCRemoteControlView::setRemoteRSSI(float rssiNormalized)
void
QGCRemoteControlView
::
appendChannelWidget
(
int
channelId
)
{
// Create new layout
QHBoxLayout
*
layout
=
new
QHBoxLayout
(
this
);
QHBoxLayout
*
layout
=
new
QHBoxLayout
();
// Add content
layout
->
addWidget
(
new
QLabel
(
QString
(
"Channel %1"
).
arg
(
channelId
+
1
),
this
));
QLabel
*
raw
=
new
QLabel
(
this
);
...
...
src/ui/QGCRemoteControlView.h
View file @
a3e2cb96
...
...
@@ -51,7 +51,6 @@ public slots:
void
setUASId
(
int
id
);
void
setChannel
(
int
channelId
,
float
raw
,
float
normalized
);
void
setRemoteRSSI
(
float
rssiNormalized
);
void
calibrate
();
void
redraw
();
protected
slots
:
...
...
@@ -67,6 +66,7 @@ protected:
QVector
<
float
>
normalized
;
QVector
<
QLabel
*>
rawLabels
;
QVector
<
QProgressBar
*>
progressBars
;
QProgressBar
*
rssiBar
;
QLabel
*
nameLabel
;
private:
...
...
src/ui/QGCSensorSettingsWidget.cc
View file @
a3e2cb96
...
...
@@ -46,6 +46,12 @@ QGCSensorSettingsWidget::QGCSensorSettingsWidget(UASInterface* uas, QWidget *par
connect
(
ui
->
sendExtra1CheckBox
,
SIGNAL
(
toggled
(
bool
)),
mav
,
SLOT
(
enableExtra1Transmission
(
bool
)));
connect
(
ui
->
sendExtra2CheckBox
,
SIGNAL
(
toggled
(
bool
)),
mav
,
SLOT
(
enableExtra2Transmission
(
bool
)));
connect
(
ui
->
sendExtra3CheckBox
,
SIGNAL
(
toggled
(
bool
)),
mav
,
SLOT
(
enableExtra3Transmission
(
bool
)));
// Calibration
connect
(
ui
->
rcCalButton
,
SIGNAL
(
clicked
()),
mav
,
SLOT
(
startRadioControlCalibration
()));
connect
(
ui
->
magCalButton
,
SIGNAL
(
clicked
()),
mav
,
SLOT
(
startMagnetometerCalibration
()));
connect
(
ui
->
pressureCalButton
,
SIGNAL
(
clicked
()),
mav
,
SLOT
(
startPressureCalibration
()));
connect
(
ui
->
gyroCalButton
,
SIGNAL
(
clicked
()),
mav
,
SLOT
(
startGyroscopeCalibration
()));
}
QGCSensorSettingsWidget
::~
QGCSensorSettingsWidget
()
...
...
src/ui/QGCSensorSettingsWidget.ui
View file @
a3e2cb96
...
...
@@ -90,38 +90,51 @@
<property
name=
"title"
>
<string>
Calibration Wizards
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<layout
class=
"QGridLayout"
name=
"gridLayout"
columnstretch=
"0,50"
>
<property
name=
"margin"
>
<number>
6
</number>
</property>
<item
row=
"
0
"
column=
"0"
>
<widget
class=
"QPushButton"
name=
"
gyro
CalButton"
>
<item
row=
"
1
"
column=
"0"
>
<widget
class=
"QPushButton"
name=
"
mag
CalButton"
>
<property
name=
"text"
>
<string>
Start
dynamic c
alibration
</string>
<string>
Start
Mag. C
alibration
</string>
</property>
</widget>
</item>
<item
row=
"
0"
column=
"1
"
>
<widget
class=
"Q
Label"
name=
"gyroCalDate
"
>
<item
row=
"
4"
column=
"0
"
>
<widget
class=
"Q
PushButton"
name=
"gyroCalButton
"
>
<property
name=
"text"
>
<string>
Date unknow
n
</string>
<string>
Start Gyro Calibratio
n
</string>
</property>
</widget>
</item>
<item
row=
"
1
"
column=
"0"
>
<widget
class=
"QPushButton"
name=
"
mag
CalButton"
>
<item
row=
"
0
"
column=
"0"
>
<widget
class=
"QPushButton"
name=
"
rc
CalButton"
>
<property
name=
"text"
>
<string>
Start
static c
alibration
</string>
<string>
Start
RC C
alibration
</string>
</property>
</widget>
</item>
<item
row=
"
1"
column=
"1
"
>
<widget
class=
"Q
Label"
name=
"magCalLabel
"
>
<item
row=
"
2"
column=
"0
"
>
<widget
class=
"Q
PushButton"
name=
"pressureCalButton
"
>
<property
name=
"text"
>
<string>
Date unknow
n
</string>
<string>
Start Pressure Calibratio
n
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"1"
>
<spacer
name=
"horizontalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
0
</width>
<height>
0
</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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