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
15954fd5
Commit
15954fd5
authored
Sep 16, 2011
by
pixhawk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Last setpoint fixes
parent
7490ed51
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
12 deletions
+41
-12
UAS.cc
src/uas/UAS.cc
+1
-1
HSIDisplay.cc
src/ui/HSIDisplay.cc
+36
-11
HSIDisplay.h
src/ui/HSIDisplay.h
+4
-0
No files found.
src/uas/UAS.cc
View file @
15954fd5
...
...
@@ -2095,7 +2095,7 @@ void UAS::halt()
{
mavlink_message_t
msg
;
// 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
,
&
msg
,
this
->
getUASID
(),
MAV_COMP_ID_IMU
,
(
int
)
MAV_ACTION_H
ALT
);
mavlink_msg_action_pack
(
MG
::
SYSTEM
::
ID
,
MG
::
SYSTEM
::
COMPID
,
&
msg
,
this
->
getUASID
(),
MAV_COMP_ID_IMU
,
(
int
)
MAV_ACTION_H
OLD
);
// Send message twice to increase chance of reception
sendMessage
(
msg
);
sendMessage
(
msg
);
...
...
src/ui/HSIDisplay.cc
View file @
15954fd5
...
...
@@ -103,7 +103,8 @@ HSIDisplay::HSIDisplay(QWidget *parent) :
userSetPointSet
(
false
),
dragStarted
(
false
),
leftDragStarted
(
false
),
mouseHasMoved
(
false
)
mouseHasMoved
(
false
),
actionPending
(
false
)
{
refreshTimer
->
setInterval
(
updateInterval
);
...
...
@@ -568,10 +569,10 @@ void HSIDisplay::mouseReleaseEvent(QMouseEvent * event)
{
if
(
leftDragStarted
)
{
qDebug
()
<<
"Z CHANGED"
<<
uiZSetCoordinate
;
setStatusMessage
(
QString
(
"SENT NEW Z: %1"
).
arg
(
uiZSetCoordinate
));
setBodySetpointCoordinateZ
(
uiZSetCoordinate
);
leftDragStarted
=
false
;
//
qDebug() << "Z CHANGED" << uiZSetCoordinate;
//
setStatusMessage(QString("SENT NEW Z: %1").arg(uiZSetCoordinate));
//
setBodySetpointCoordinateZ(uiZSetCoordinate);
//
leftDragStarted = false;
}
}
}
...
...
@@ -606,14 +607,29 @@ void HSIDisplay::mouseMoveEvent(QMouseEvent * event)
if
(
leftDragStarted
)
{
uiZSetCoordinate
-=
0.06
f
*
(
startY
-
event
->
y
())
/
this
->
frameSize
().
height
();
setStatusMessage
(
QString
(
"NEW Z: %1"
).
arg
(
uiZSetCoordinate
));
//
uiZSetCoordinate -= 0.06f*(startY - event->y()) / this->frameSize().height();
//
setStatusMessage(QString("NEW Z: %1").arg(uiZSetCoordinate));
}
if
(
leftDragStarted
||
dragStarted
)
mouseHasMoved
=
true
;
}
}
void
HSIDisplay
::
keyPressEvent
(
QKeyEvent
*
event
)
{
if
(
event
->
key
()
==
Qt
::
Key_Enter
||
event
->
key
()
==
Qt
::
Key_S
)
{
actionPending
=
false
;
statusMessage
=
"SETPOINT SENT"
;
statusClearTimer
.
start
();
sendBodySetPointCoordinates
();
}
else
{
HDDisplay
::
keyPressEvent
(
event
);
}
}
void
HSIDisplay
::
contextMenuEvent
(
QContextMenuEvent
*
event
)
{
event
->
ignore
();
...
...
@@ -703,7 +719,10 @@ void HSIDisplay::setBodySetpointCoordinateXY(double x, double y)
if
(
uas
&&
mavInitialized
)
{
sendBodySetPointCoordinates
();
//sendBodySetPointCoordinates();
statusMessage
=
"POSITION SET, PRESS <ENTER> TO SEND"
;
actionPending
=
true
;
statusClearTimer
.
start
();
qDebug
()
<<
"Setting new setpoint at x: "
<<
x
<<
"metric y:"
<<
y
;
}
}
...
...
@@ -713,7 +732,10 @@ void HSIDisplay::setBodySetpointCoordinateZ(double z)
userSetPointSet
=
true
;
// Set coordinates and send them out to MAV
uiZSetCoordinate
=
z
;
sendBodySetPointCoordinates
();
statusMessage
=
"Z SET, PRESS <ENTER> TO SEND"
;
actionPending
=
true
;
statusClearTimer
.
start
();
//sendBodySetPointCoordinates();
}
void
HSIDisplay
::
setBodySetpointCoordinateYaw
(
double
yaw
)
...
...
@@ -733,7 +755,10 @@ void HSIDisplay::setBodySetpointCoordinateYaw(double yaw)
// Set coordinates and send them out to MAV
uiYawSet
=
atan2
(
sin
(
yaw
),
cos
(
yaw
));
qDebug
()
<<
"YAW IN"
<<
yaw
<<
"YAW OUT"
<<
uiYawSet
;
sendBodySetPointCoordinates
();
statusMessage
=
"YAW SET, PRESS <ENTER> TO SEND"
;
statusClearTimer
.
start
();
actionPending
=
true
;
//sendBodySetPointCoordinates();
}
void
HSIDisplay
::
sendBodySetPointCoordinates
()
...
...
@@ -791,7 +816,7 @@ void HSIDisplay::updatePositionSetpoints(int uasid, float xDesired, float yDesir
{
uiXSetCoordinate
=
bodyXSetCoordinate
;
uiYSetCoordinate
=
bodyYSetCoordinate
;
uiZSetCoordinate
=
bodyZSetCoordinate
;
//
uiZSetCoordinate = bodyZSetCoordinate;
uiYawSet
=
bodyYawSet
;
}
}
...
...
src/ui/HSIDisplay.h
View file @
15954fd5
...
...
@@ -89,6 +89,7 @@ public slots:
void
clearStatusMessage
()
{
statusMessage
=
""
;
actionPending
=
false
;
}
signals:
...
...
@@ -123,6 +124,8 @@ protected slots:
void
mouseMoveEvent
(
QMouseEvent
*
event
);
/** @brief Receive mouse wheel events */
void
wheelEvent
(
QWheelEvent
*
event
);
/** @brief Read out send keys */
void
keyPressEvent
(
QKeyEvent
*
event
);
/** @brief Ignore context menu event */
void
contextMenuEvent
(
QContextMenuEvent
*
event
);
/** @brief Set status message on screen */
...
...
@@ -166,6 +169,7 @@ protected:
float
startY
;
QTimer
statusClearTimer
;
QString
statusMessage
;
bool
actionPending
;
/**
* @brief Private data container class to be used within the HSI widget
...
...
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