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
3b928588
Commit
3b928588
authored
Feb 01, 2011
by
Alejandro
Browse files
Options
Browse Files
Download
Plain Diff
Resolved assignament and reading mode from UAS
parents
ed323bbe
a3db5ec5
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
665 additions
and
627 deletions
+665
-627
qgroundcontrol.pri
qgroundcontrol.pri
+2
-1
Core.cc
src/Core.cc
+3
-0
main.cc
src/main.cc
+21
-0
UAS.cc
src/uas/UAS.cc
+12
-3
UAS.h
src/uas/UAS.h
+333
-330
UASControlWidget.cc
src/ui/uas/UASControlWidget.cc
+294
-293
No files found.
qgroundcontrol.pri
View file @
3b928588
...
@@ -380,7 +380,8 @@ win32-g++ {
...
@@ -380,7 +380,8 @@ win32-g++ {
message(Building for Windows Platform (32bit))
message(Building for Windows Platform (32bit))
# Special settings for debug
# Special settings for debug
#CONFIG += CONSOLE
CONFIG += CONSOLE
OUTPUT += CONSOLE
INCLUDEPATH += $$BASEDIR/lib/sdl/include \
INCLUDEPATH += $$BASEDIR/lib/sdl/include \
$$BASEDIR/lib/opal/include #\ #\
$$BASEDIR/lib/opal/include #\ #\
...
...
src/Core.cc
View file @
3b928588
...
@@ -65,8 +65,11 @@ This file is part of the QGROUNDCONTROL project
...
@@ -65,8 +65,11 @@ This file is part of the QGROUNDCONTROL project
* @param argv The string array of parameters
* @param argv The string array of parameters
**/
**/
Core
::
Core
(
int
&
argc
,
char
*
argv
[])
:
QApplication
(
argc
,
argv
)
Core
::
Core
(
int
&
argc
,
char
*
argv
[])
:
QApplication
(
argc
,
argv
)
{
{
// Set application name
// Set application name
this
->
setApplicationName
(
QGC_APPLICATION_NAME
);
this
->
setApplicationName
(
QGC_APPLICATION_NAME
);
this
->
setApplicationVersion
(
QGC_APPLICATION_VERSION
);
this
->
setApplicationVersion
(
QGC_APPLICATION_VERSION
);
...
...
src/main.cc
View file @
3b928588
...
@@ -39,6 +39,21 @@ This file is part of the QGROUNDCONTROL project
...
@@ -39,6 +39,21 @@ This file is part of the QGROUNDCONTROL project
#undef main
#undef main
#endif
#endif
// Install a message handler so you do not need
// the MSFT debug tools installed to se
// qDebug(), qWarning(), qCritical and qAbort
#ifdef Q_OS_WIN
void
msgHandler
(
QtMsgType
type
,
const
char
*
msg
)
{
const
char
symbols
[]
=
{
'I'
,
'E'
,
'!'
,
'X'
};
QString
output
=
QString
(
"[%1] %2"
).
arg
(
symbols
[
type
]
).
arg
(
msg
);
std
::
cerr
<<
output
.
toStdString
()
<<
std
::
endl
;
if
(
type
==
QtFatalMsg
)
abort
();
}
#endif
/**
/**
* @brief Starts the application
* @brief Starts the application
*
*
...
@@ -46,9 +61,15 @@ This file is part of the QGROUNDCONTROL project
...
@@ -46,9 +61,15 @@ This file is part of the QGROUNDCONTROL project
* @param argv Commandline arguments
* @param argv Commandline arguments
* @return exit code, 0 for normal exit and !=0 for error cases
* @return exit code, 0 for normal exit and !=0 for error cases
*/
*/
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
// install the message handler
#ifdef Q_OS_WIN
qInstallMsgHandler
(
msgHandler
);
#endif
Core
core
(
argc
,
argv
);
Core
core
(
argc
,
argv
);
return
core
.
exec
();
return
core
.
exec
();
}
}
src/uas/UAS.cc
View file @
3b928588
...
@@ -244,13 +244,13 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
...
@@ -244,13 +244,13 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
mavlink_msg_sys_status_decode
(
&
message
,
&
state
);
mavlink_msg_sys_status_decode
(
&
message
,
&
state
);
// FIXME
// FIXME
//qDebug() << "SYSTEM NAV MODE:" << state.nav_mode
;
qDebug
()
<<
"1 SYSTEM STATUS:"
<<
state
.
status
;
QString
audiostring
=
"System "
+
QString
::
number
(
this
->
getUASID
());
QString
audiostring
=
"System "
+
QString
::
number
(
this
->
getUASID
());
QString
stateAudio
=
""
;
QString
stateAudio
=
""
;
QString
modeAudio
=
""
;
QString
modeAudio
=
""
;
bool
statechanged
=
false
;
bool
statechanged
=
false
;
bool
modechanged
=
false
;
bool
modechanged
=
false
;
if
(
state
.
status
!=
this
->
status
)
if
(
state
.
status
!=
this
->
status
)
{
{
...
@@ -264,6 +264,8 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
...
@@ -264,6 +264,8 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
stateAudio
=
" changed status to "
+
uasState
;
stateAudio
=
" changed status to "
+
uasState
;
}
}
qDebug
()
<<
"1 SYSTEM MODE:"
<<
state
.
mode
;
qDebug
()
<<
"1 THIS MODE:"
<<
this
->
mode
;
if
(
this
->
mode
!=
static_cast
<
unsigned
int
>
(
state
.
mode
))
if
(
this
->
mode
!=
static_cast
<
unsigned
int
>
(
state
.
mode
))
{
{
modechanged
=
true
;
modechanged
=
true
;
...
@@ -305,6 +307,9 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
...
@@ -305,6 +307,9 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
}
}
emit
modeChanged
(
this
->
getUASID
(),
mode
,
""
);
emit
modeChanged
(
this
->
getUASID
(),
mode
,
""
);
qDebug
()
<<
"2 SYSTEM MODE:"
<<
mode
;
modeAudio
=
" is now in "
+
mode
;
modeAudio
=
" is now in "
+
mode
;
}
}
currentVoltage
=
state
.
vbat
/
1000.0
f
;
currentVoltage
=
state
.
vbat
/
1000.0
f
;
...
@@ -984,12 +989,16 @@ void UAS::setMode(int mode)
...
@@ -984,12 +989,16 @@ void UAS::setMode(int mode)
{
{
if
((
uint8_t
)
mode
>=
MAV_MODE_LOCKED
&&
(
uint8_t
)
mode
<=
MAV_MODE_RC_TRAINING
)
if
((
uint8_t
)
mode
>=
MAV_MODE_LOCKED
&&
(
uint8_t
)
mode
<=
MAV_MODE_RC_TRAINING
)
{
{
this
->
mode
=
mode
;
//this->mode = mode; //no call assignament, update receive message from UAS
mavlink_message_t
msg
;
mavlink_message_t
msg
;
mavlink_msg_set_mode_pack
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
(
uint8_t
)
uasId
,
(
uint8_t
)
mode
);
mavlink_msg_set_mode_pack
(
mavlink
->
getSystemId
(),
mavlink
->
getComponentId
(),
&
msg
,
(
uint8_t
)
uasId
,
(
uint8_t
)
mode
);
sendMessage
(
msg
);
sendMessage
(
msg
);
qDebug
()
<<
"SENDING REQUEST TO SET MODE TO SYSTEM"
<<
uasId
<<
", REQUEST TO SET MODE "
<<
(
uint8_t
)
mode
;
qDebug
()
<<
"SENDING REQUEST TO SET MODE TO SYSTEM"
<<
uasId
<<
", REQUEST TO SET MODE "
<<
(
uint8_t
)
mode
;
}
}
else
{
qDebug
()
<<
"uas Mode not assign: "
<<
mode
;
}
}
}
void
UAS
::
sendMessage
(
mavlink_message_t
message
)
void
UAS
::
sendMessage
(
mavlink_message_t
message
)
...
...
src/uas/UAS.h
View file @
3b928588
This diff is collapsed.
Click to expand it.
src/ui/uas/UASControlWidget.cc
View file @
3b928588
This diff is collapsed.
Click to expand it.
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