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
cd9d96b0
Commit
cd9d96b0
authored
May 25, 2010
by
pixhawk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed compile error for MAVLink
parent
fc38a557
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
49 additions
and
24 deletions
+49
-24
.gitignore
.gitignore
+1
-0
PxQuadMAV.cc
src/uas/PxQuadMAV.cc
+13
-0
PxQuadMAV.h
src/uas/PxQuadMAV.h
+2
-0
MainWindow.h
src/ui/MainWindow.h
+0
-2
WatchdogControl.cc
src/ui/watchdog/WatchdogControl.cc
+14
-12
WatchdogControl.h
src/ui/watchdog/WatchdogControl.h
+19
-10
No files found.
.gitignore
View file @
cd9d96b0
...
...
@@ -16,6 +16,7 @@ tmp
debug
release
qgroundcontrol
mavlinkgen
*.wav
qgroundcontrol.xcodeproj/**
doc/html
...
...
src/uas/PxQuadMAV.cc
View file @
cd9d96b0
...
...
@@ -52,3 +52,16 @@ void PxQuadMAV::receiveMessage(LinkInterface* link, mavlink_message_t message)
break
;
}
}
void
PxQuadMAV
::
sendProcessCommand
(
int
watchdogId
,
int
processId
,
unsigned
int
command
)
{
mavlink_watchdog_command_t
payload
;
payload
.
target_system_id
=
uasId
;
payload
.
watchdog_id
=
watchdogId
;
payload
.
process_id
=
processId
;
payload
.
command_id
=
(
uint8_t
)
command
;
mavlink_message_t
msg
;
mavlink_msg_watchdog_command_encode
(
sysid
,
compid
,
&
msg
,
&
payload
);
sendMessage
(
msg
);
}
src/uas/PxQuadMAV.h
View file @
cd9d96b0
...
...
@@ -11,6 +11,8 @@ public:
public
slots
:
/** @brief Receive a MAVLink message from this MAV */
void
receiveMessage
(
LinkInterface
*
link
,
mavlink_message_t
message
);
/** @brief Send a command to an onboard process */
void
sendProcessCommand
(
int
watchdogId
,
int
processId
,
unsigned
int
command
);
signals:
void
watchdogReceived
(
int
systemId
,
int
watchdogId
,
int
processCount
);
void
processReceived
(
int
systemId
,
int
watchdogId
,
int
processId
,
QString
name
,
QString
arguments
,
int
timeout
);
...
...
src/ui/MainWindow.h
View file @
cd9d96b0
...
...
@@ -53,7 +53,6 @@ This file is part of the PIXHAWK project
#include "ObjectDetectionView.h"
#include "HUD.h"
#include "PFD.h"
#include "GaugePanel.h"
#include "JoystickWidget.h"
#include "input/JoystickInput.h"
#include "DebugConsole.h"
...
...
@@ -147,7 +146,6 @@ protected:
XMLCommProtocolWidget
*
protocol
;
HDDisplay
*
headDown1
;
HDDisplay
*
headDown2
;
GaugePanel
*
gaugePanel
;
// Popup widgets
JoystickWidget
*
joystickWidget
;
...
...
src/ui/watchdog/WatchdogControl.cc
View file @
cd9d96b0
#include "WatchdogControl.h"
#include "ui_WatchdogControl.h"
#include "PxQuadMAV.h"
#include <QDebug>
WatchdogControl
::
WatchdogControl
(
QWidget
*
parent
)
:
WatchdogControl
::
WatchdogControl
(
UASInterface
*
uas
,
QWidget
*
parent
)
:
QWidget
(
parent
),
mav
(
NULL
),
ui
(
new
Ui
::
WatchdogControl
)
{
ui
->
setupUi
(
this
);
...
...
@@ -15,6 +17,16 @@ WatchdogControl::~WatchdogControl()
delete
ui
;
}
void
WatchdogControl
::
setUAS
(
UASInterface
*
uas
)
{
PxQuadMAV
*
qmav
=
dynamic_cast
<
PxQuadMAV
>
(
uas
);
if
(
qmav
)
{
connect
(
qmav
,
SIGNAL
(
processReceived
(
int
,
int
,
int
,
QString
,
QString
,
int
)),
this
,
SLOT
(
addProcess
(
int
,
int
,
int
,
QString
,
QString
,
int
)));
}
}
void
WatchdogControl
::
updateWatchdog
(
int
systemId
,
int
watchdogId
,
unsigned
int
processCount
)
{
// request the watchdog with the given ID
...
...
@@ -101,17 +113,7 @@ WatchdogControl::ProcessInfo& WatchdogControl::WatchdogInfo::getProcess(uint16_t
*/
void
WatchdogControl
::
sendCommand
(
const
WatchdogID
&
w_id
,
uint16_t
p_id
,
Command
::
Enum
command
)
{
/*
mavlink_watchdog_command_t payload;
payload.target_system_id = w_id.system_id_;
payload.watchdog_id = w_id.watchdog_id_;
payload.process_id = p_id;
payload.command_id = (uint8_t)command;
mavlink_message_t msg;
mavlink_msg_watchdog_command_encode(sysid, compid, &msg, &payload);
mavlink_message_t_publish(this->lcm_, "MAVLINK", &msg);*/
//std::cout << "--> sent mavlink_watchdog_command_t " << payload.target_system_id << " / " << payload.watchdog_id << " / " << payload.process_id << " / " << (int)payload.command_id << std::endl;
emit
sendProcessCommand
(
w_id
.
watchdog_id_
,
p_id
,
command
);
}
void
WatchdogControl
::
changeEvent
(
QEvent
*
e
)
...
...
src/ui/watchdog/WatchdogControl.h
View file @
cd9d96b0
#ifndef WATCHDOGCONTROL_H
#define WATCHDOGCONTROL_H
#include <inttypes.h>
#include <QWidget>
#include <QTimer>
...
...
@@ -8,6 +10,8 @@
#include <string>
#include <sstream>
#include "UASInterface.h"
namespace
Ui
{
class
WatchdogControl
;
}
...
...
@@ -30,7 +34,7 @@ public:
RequestInfo
=
254
,
RequestStatus
=
255
};
};
};
///! This struct represents a process on the watchdog. Used to store all values.
...
...
@@ -46,7 +50,7 @@ public:
Stopped
=
2
,
Stopped_OK
=
3
,
Stopped_ERROR
=
4
};
};
};
///! Constructor - initialize the values
...
...
@@ -62,8 +66,8 @@ public:
uint16_t
crashes_
;
///< The number of crashes
int32_t
pid_
;
///< The PID of the process
// Timer requestTimer_; ///< Internal timer, used to repeat status and info requests after some time (in case of packet loss)
// Timer updateTimer_; ///< Internal timer, used to measure the time since the last update (used only for graphics)
// Timer requestTimer_; ///< Internal timer, used to repeat status and info requests after some time (in case of packet loss)
// Timer updateTimer_; ///< Internal timer, used to measure the time since the last update (used only for graphics)
};
///! This struct identifies a watchdog. It's a combination of system-ID and watchdog-ID. implements operator< to be used as key in a std::map
...
...
@@ -77,7 +81,7 @@ public:
///! Comparison operator which is used by std::map
inline
bool
operator
<
(
const
WatchdogID
&
other
)
const
{
return
(
this
->
system_id_
!=
other
.
system_id_
)
?
(
this
->
system_id_
<
other
.
system_id_
)
:
(
this
->
watchdog_id_
<
other
.
watchdog_id_
);
}
{
return
(
this
->
system_id_
!=
other
.
system_id_
)
?
(
this
->
system_id_
<
other
.
system_id_
)
:
(
this
->
watchdog_id_
<
other
.
watchdog_id_
);
}
};
...
...
@@ -90,7 +94,7 @@ public:
QTimer
*
timeoutTimer_
;
///< Internal timer, used to measure the time since the last heartbeat message
};
WatchdogControl
(
QWidget
*
parent
=
0
);
WatchdogControl
(
UASInterface
*
uas
,
QWidget
*
parent
=
0
);
~
WatchdogControl
();
static
const
uint16_t
ALL
=
(
uint16_t
)
-
1
;
///< A magic value for a process-ID which addresses "all processes"
...
...
@@ -102,9 +106,14 @@ public slots:
void
addProcess
(
int
systemId
,
int
watchdogId
,
int
processId
,
QString
name
,
QString
arguments
,
int
timeout
);
void
updateProcess
(
int
systemId
,
int
watchdogId
,
int
processId
,
int
state
,
bool
muted
,
int
crashed
,
int
pid
);
signals:
void
sendProcessCommand
(
int
watchdogId
,
int
processId
,
unsigned
int
command
);
protected:
void
changeEvent
(
QEvent
*
e
);
UASInterface
*
mav
;
private:
Ui
::
WatchdogControl
*
ui
;
...
...
@@ -120,9 +129,9 @@ private:
///! Convert a value to std::string
template
<
class
T
>
std
::
string
convertToString
(
T
value
)
std
::
string
convertToString
(
T
value
)
{
std
::
ostringstream
oss
;
oss
<<
value
;
return
oss
.
str
();
std
::
ostringstream
oss
;
oss
<<
value
;
return
oss
.
str
();
}
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