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
b7452c85
Commit
b7452c85
authored
Jun 30, 2010
by
pixhawk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for IR/Ultrasound and waypoints in HSI
parent
398361d3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
22 deletions
+58
-22
UASInterface.h
src/uas/UASInterface.h
+5
-0
HSIDisplay.cc
src/ui/HSIDisplay.cc
+34
-0
HSIDisplay.h
src/ui/HSIDisplay.h
+19
-22
No files found.
src/uas/UASInterface.h
View file @
b7452c85
...
...
@@ -340,6 +340,11 @@ signals:
* @param fix 0: lost, 1: 2D local position hold, 2: 2D localization, 3: 3D localization
*/
void
visionLocalizationChanged
(
UASInterface
*
uas
,
int
fix
);
/**
* @brief IR/U localization quality changed
* @param fix 0: No IR/Ultrasound sensor, N > 0: Found N active sensors
*/
void
irUltraSoundLocalizationChanged
(
UASInterface
*
uas
,
int
fix
);
};
Q_DECLARE_INTERFACE
(
UASInterface
,
"org.qgroundcontrol/1.0"
);
...
...
src/ui/HSIDisplay.cc
View file @
b7452c85
...
...
@@ -145,6 +145,7 @@ void HSIDisplay::paintDisplay()
drawPositionLock
(
2
,
5
,
tr
(
"POS"
),
positionFix
,
painter
);
drawPositionLock
(
22
,
5
,
tr
(
"VIS"
),
visionFix
,
painter
);
drawPositionLock
(
44
,
5
,
tr
(
"GPS"
),
gpsFix
,
painter
);
drawPositionLock
(
66
,
5
,
tr
(
"IRU"
),
iruFix
,
painter
);
// Draw base instrument
...
...
@@ -422,6 +423,7 @@ void HSIDisplay::setActiveUAS(UASInterface* uas)
connect
(
uas
,
SIGNAL
(
localizationChanged
(
UASInterface
*
,
int
)),
this
,
SLOT
(
updateLocalization
(
UASInterface
*
,
int
)));
connect
(
uas
,
SIGNAL
(
visionLocalizationChanged
(
UASInterface
*
,
int
)),
this
,
SLOT
(
updateVisionLocalization
(
UASInterface
*
,
int
)));
connect
(
uas
,
SIGNAL
(
gpsLocalizationChanged
(
UASInterface
*
,
int
)),
this
,
SLOT
(
updateGpsLocalization
(
UASInterface
*
,
int
)));
connect
(
uas
,
SIGNAL
(
irUltraSoundLocalizationChanged
(
UASInterface
*
,
int
)),
this
,
SLOT
(
updateInfraredUltrasoundLocalization
(
UASInterface
*
,
int
)));
// Now connect the new UAS
...
...
@@ -569,6 +571,15 @@ void HSIDisplay::updateVisionLocalization(UASInterface* uas, int fix)
visionFix
=
fix
;
}
/**
* @param fix 0: lost, 1-N: Localized with N ultrasound or infrared sensors
*/
void
HSIDisplay
::
updateInfraredUltrasoundLocalization
(
UASInterface
*
uas
,
int
fix
)
{
Q_UNUSED
(
uas
);
iruFix
=
fix
;
}
QColor
HSIDisplay
::
getColorForSNR
(
float
snr
)
{
QColor
color
;
...
...
@@ -615,6 +626,29 @@ void HSIDisplay::drawSetpointXY(float x, float y, float yaw, const QColor &color
drawCircle
(
p
.
x
(),
p
.
y
(),
radius
*
0.1
f
,
0.1
f
,
color
,
&
painter
);
}
void
HSIDisplay
::
drawWaypoints
(
QPainter
&
painter
)
{
QColor
color
=
uas
->
getColor
();
float
x
=
1.1
;
float
y
=
1.1
;
float
radius
=
vwidth
/
20.0
f
;
QPen
pen
(
color
);
pen
.
setWidthF
(
refLineWidthToPen
(
0.4
f
));
pen
.
setColor
(
color
);
painter
.
setPen
(
pen
);
painter
.
setBrush
(
Qt
::
NoBrush
);
QPointF
in
(
x
,
y
);
// Transform from body to world coordinates
in
=
metricWorldToBody
(
in
);
// Scale from metric to screen reference coordinates
QPointF
p
=
metricBodyToRef
(
in
);
drawCircle
(
p
.
x
(),
p
.
y
(),
radius
,
0.4
f
,
color
,
&
painter
);
radius
*=
0.8
;
drawLine
(
p
.
x
(),
p
.
y
(),
p
.
x
()
+
sin
(
yaw
)
*
radius
,
p
.
y
()
-
cos
(
yaw
)
*
radius
,
refLineWidthToPen
(
0.4
f
),
color
,
&
painter
);
painter
.
setBrush
(
color
);
drawCircle
(
p
.
x
(),
p
.
y
(),
radius
*
0.1
f
,
0.1
f
,
color
,
&
painter
);
}
void
HSIDisplay
::
drawSafetyArea
(
const
QPointF
&
topLeft
,
const
QPointF
&
bottomRight
,
const
QColor
&
color
,
QPainter
&
painter
)
{
QPen
pen
(
color
);
...
...
src/ui/HSIDisplay.h
View file @
b7452c85
...
...
@@ -65,22 +65,16 @@ public slots:
/** @brief Heading control enabled/disabled */
void
updatePositionYawControllerEnabled
(
bool
enabled
);
/**
* @brief Localization quality changed
* @param fix 0: lost, 1: 2D local position hold, 2: 2D localization, 3: 3D localization
*/
/** @brief Localization quality changed */
void
updateLocalization
(
UASInterface
*
uas
,
int
localization
);
/**
* @brief GPS localization quality changed
* @param fix 0: lost, 1: at least one satellite, but no GPS fix, 2: 2D localization, 3: 3D localization
*/
/** @brief GPS localization quality changed */
void
updateGpsLocalization
(
UASInterface
*
uas
,
int
localization
);
/**
* @brief Vision localization quality changed
* @param fix 0: lost, 1: 2D local position hold, 2: 2D localization, 3: 3D localization
*/
/** @brief Vision localization quality changed */
void
updateVisionLocalization
(
UASInterface
*
uas
,
int
localization
);
/** @brief Ultrasound/Infrared localization changed */
void
updateInfraredUltrasoundLocalization
(
UASInterface
*
uas
,
int
fix
);
void
paintEvent
(
QPaintEvent
*
event
);
/** @brief Update state from joystick */
void
updateJoystick
(
double
roll
,
double
pitch
,
double
yaw
,
double
thrust
,
int
xHat
,
int
yHat
);
...
...
@@ -101,6 +95,8 @@ protected slots:
void
sendBodySetPointCoordinates
();
/** @brief Draw one setpoint */
void
drawSetpointXY
(
float
x
,
float
y
,
float
yaw
,
const
QColor
&
color
,
QPainter
&
painter
);
/** @brief Draw waypoints of this system */
void
drawWaypoints
(
QPainter
&
painter
);
/** @brief Draw the limiting safety area */
void
drawSafetyArea
(
const
QPointF
&
topLeft
,
const
QPointF
&
bottomRight
,
const
QColor
&
color
,
QPainter
&
painter
);
...
...
@@ -208,18 +204,19 @@ protected:
float
metricWidth
;
///< Width the instrument represents in meters (the width of the ground shown by the widget)
//
float
xCenterPos
;
float
yCenterPos
;
float
xCenterPos
;
///< X center of instrument in virtual coordinates
float
yCenterPos
;
///< Y center of instrument in virtual coordinates
bool
positionLock
;
bool
attControlEnabled
;
bool
xyControlEnabled
;
bool
zControlEnabled
;
bool
yawControlEnabled
;
int
positionFix
;
int
gpsFix
;
int
visionFix
;
int
laserFix
;
bool
attControlEnabled
;
///< Attitude control enabled
bool
xyControlEnabled
;
///< Horizontal control enabled
bool
zControlEnabled
;
///< Vertical control enabled
bool
yawControlEnabled
;
///< Yaw angle position control enabled
int
positionFix
;
///< Total dimensions the MAV is localizaed in
int
gpsFix
;
///< Localization dimensions based on GPS
int
visionFix
;
///< Localizaiton dimensions based on computer vision
int
laserFix
;
///< Localization dimensions based on laser
int
iruFix
;
///< Localization dimensions based on ultrasound
bool
mavInitialized
;
///< The MAV is initialized once the setpoint has been received
float
bottomMargin
;
///< Margin on the bottom of the page, in virtual coordinates
float
topMargin
;
///< Margin on top of the page, in virtual coordinates
...
...
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