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
ae3d4965
Commit
ae3d4965
authored
Apr 21, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return and Offboard must be on separate channel
parent
c3251189
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
170 additions
and
124 deletions
+170
-124
FlightModesComponent.qml
src/AutoPilotPlugins/PX4/FlightModesComponent.qml
+138
-117
FlightModesComponentController.cc
src/AutoPilotPlugins/PX4/FlightModesComponentController.cc
+28
-5
FlightModesComponentController.h
src/AutoPilotPlugins/PX4/FlightModesComponentController.h
+4
-2
No files found.
src/AutoPilotPlugins/PX4/FlightModesComponent.qml
View file @
ae3d4965
This diff is collapsed.
Click to expand it.
src/AutoPilotPlugins/PX4/FlightModesComponentController.cc
View file @
ae3d4965
...
@@ -82,8 +82,8 @@ void FlightModesComponentController::_validateConfiguration(void)
...
@@ -82,8 +82,8 @@ void FlightModesComponentController::_validateConfiguration(void)
QStringList
switchParams
,
switchNames
;
QStringList
switchParams
,
switchNames
;
QList
<
int
>
switchMappings
;
QList
<
int
>
switchMappings
;
switchParams
<<
"RC_MAP_MODE_SW"
<<
"RC_MAP_RETURN_SW"
<<
"RC_MAP_LOITER_SW"
<<
"RC_MAP_POSCTL_SW"
;
switchParams
<<
"RC_MAP_MODE_SW"
<<
"RC_MAP_RETURN_SW"
<<
"RC_MAP_LOITER_SW"
<<
"RC_MAP_POSCTL_SW"
<<
"RC_MAP_OFFB_SW"
;
switchNames
<<
"Mode Switch"
<<
"Return Switch"
<<
"Loiter Switch"
<<
"PosCtl Switch"
;
switchNames
<<
"Mode Switch"
<<
"Return Switch"
<<
"Loiter Switch"
<<
"PosCtl Switch"
<<
"Offboard Switch"
;
for
(
int
i
=
0
;
i
<
switchParams
.
count
();
i
++
)
{
for
(
int
i
=
0
;
i
<
switchParams
.
count
();
i
++
)
{
int
map
=
_autoPilotPlugin
->
getParameterFact
(
switchParams
[
i
])
->
value
().
toInt
();
int
map
=
_autoPilotPlugin
->
getParameterFact
(
switchParams
[
i
])
->
value
().
toInt
();
...
@@ -95,12 +95,12 @@ void FlightModesComponentController::_validateConfiguration(void)
...
@@ -95,12 +95,12 @@ void FlightModesComponentController::_validateConfiguration(void)
}
}
}
}
// Make sure switches are not
mapped to attitude control channels
// Make sure switches are not
double-mapped
QStringList
attitudeParams
,
attitudeNames
;
QStringList
attitudeParams
,
attitudeNames
;
attitudeParams
<<
"RC_MAP_THROTTLE"
<<
"RC_MAP_YAW"
<<
"RC_MAP_PITCH"
<<
"RC_MAP_ROLL"
<<
"RC_MAP_FLAPS"
<<
"RC_MAP_AUX1"
<<
"RC_MAP_AUX2"
;
attitudeParams
<<
"RC_MAP_THROTTLE"
<<
"RC_MAP_YAW"
<<
"RC_MAP_PITCH"
<<
"RC_MAP_ROLL"
<<
"RC_MAP_FLAPS"
<<
"RC_MAP_AUX1"
<<
"RC_MAP_AUX2"
<<
"RC_MAP_ACRO_SW"
;
attitudeNames
<<
"Throttle"
<<
"Yaw"
<<
"Pitch"
<<
"Roll"
<<
"Flaps"
<<
"Aux1"
<<
"Aux2"
;
attitudeNames
<<
"Throttle"
<<
"Yaw"
<<
"Pitch"
<<
"Roll"
<<
"Flaps"
<<
"Aux1"
<<
"Aux2"
<<
"Acro"
;
for
(
int
i
=
0
;
i
<
attitudeParams
.
count
();
i
++
)
{
for
(
int
i
=
0
;
i
<
attitudeParams
.
count
();
i
++
)
{
int
map
=
_autoPilotPlugin
->
getParameterFact
(
attitudeParams
[
i
])
->
value
().
toInt
();
int
map
=
_autoPilotPlugin
->
getParameterFact
(
attitudeParams
[
i
])
->
value
().
toInt
();
...
@@ -112,6 +112,24 @@ void FlightModesComponentController::_validateConfiguration(void)
...
@@ -112,6 +112,24 @@ void FlightModesComponentController::_validateConfiguration(void)
}
}
}
}
}
}
// Check for switches that must be on their own channel
QStringList
singleSwitchParams
,
singleSwitchNames
;
singleSwitchParams
<<
"RC_MAP_RETURN_SW"
<<
"RC_MAP_OFFB_SW"
;
singleSwitchNames
<<
"Return Switch"
<<
"Offboard Switch"
;
for
(
int
i
=
0
;
i
<
singleSwitchParams
.
count
();
i
++
)
{
int
map
=
_autoPilotPlugin
->
getParameterFact
(
singleSwitchParams
[
i
])
->
value
().
toInt
();
for
(
int
j
=
0
;
j
<
switchParams
.
count
();
j
++
)
{
if
(
map
!=
0
&&
singleSwitchParams
[
i
]
!=
switchParams
[
j
]
&&
map
==
switchMappings
[
j
])
{
_validConfiguration
=
false
;
_configurationErrors
+=
QString
(
"%1 must be on seperate channel, but is set to same channel as %2.
\n
"
).
arg
(
singleSwitchNames
[
i
]).
arg
(
switchParams
[
j
]);
}
}
}
}
}
void
FlightModesComponentController
::
setSendLiveRCSwitchRanges
(
bool
start
)
void
FlightModesComponentController
::
setSendLiveRCSwitchRanges
(
bool
start
)
...
@@ -190,6 +208,11 @@ double FlightModesComponentController::returnSwitchLiveRange(void)
...
@@ -190,6 +208,11 @@ double FlightModesComponentController::returnSwitchLiveRange(void)
return
_switchLiveRange
(
"RC_MAP_RETURN_SW"
);
return
_switchLiveRange
(
"RC_MAP_RETURN_SW"
);
}
}
double
FlightModesComponentController
::
offboardSwitchLiveRange
(
void
)
{
return
_switchLiveRange
(
"RC_MAP_OFFB_SW"
);
}
double
FlightModesComponentController
::
loiterSwitchLiveRange
(
void
)
double
FlightModesComponentController
::
loiterSwitchLiveRange
(
void
)
{
{
return
_switchLiveRange
(
"RC_MAP_LOITER_SW"
);
return
_switchLiveRange
(
"RC_MAP_LOITER_SW"
);
...
...
src/AutoPilotPlugins/PX4/FlightModesComponentController.h
View file @
ae3d4965
...
@@ -49,16 +49,18 @@ public:
...
@@ -49,16 +49,18 @@ public:
Q_PROPERTY
(
int
channelCount
MEMBER
_channelCount
CONSTANT
)
Q_PROPERTY
(
int
channelCount
MEMBER
_channelCount
CONSTANT
)
Q_PROPERTY
(
double
modeSwitchLiveRange
READ
modeSwitchLiveRange
NOTIFY
switchLiveRangeChanged
)
Q_PROPERTY
(
double
modeSwitchLiveRange
READ
modeSwitchLiveRange
NOTIFY
switchLiveRangeChanged
)
Q_PROPERTY
(
double
returnSwitchLiveRange
READ
returnSwitchLiveRange
NOTIFY
switchLiveRangeChanged
)
Q_PROPERTY
(
double
loiterSwitchLiveRange
READ
loiterSwitchLiveRange
NOTIFY
switchLiveRangeChanged
)
Q_PROPERTY
(
double
loiterSwitchLiveRange
READ
loiterSwitchLiveRange
NOTIFY
switchLiveRangeChanged
)
Q_PROPERTY
(
double
posCtlSwitchLiveRange
READ
posCtlSwitchLiveRange
NOTIFY
switchLiveRangeChanged
)
Q_PROPERTY
(
double
posCtlSwitchLiveRange
READ
posCtlSwitchLiveRange
NOTIFY
switchLiveRangeChanged
)
Q_PROPERTY
(
double
returnSwitchLiveRange
READ
returnSwitchLiveRange
NOTIFY
switchLiveRangeChanged
)
Q_PROPERTY
(
double
offboardSwitchLiveRange
READ
offboardSwitchLiveRange
NOTIFY
switchLiveRangeChanged
)
Q_PROPERTY
(
bool
sendLiveRCSwitchRanges
READ
sendLiveRCSwitchRanges
WRITE
setSendLiveRCSwitchRanges
NOTIFY
liveRCSwitchRangesChanged
)
Q_PROPERTY
(
bool
sendLiveRCSwitchRanges
READ
sendLiveRCSwitchRanges
WRITE
setSendLiveRCSwitchRanges
NOTIFY
liveRCSwitchRangesChanged
)
double
modeSwitchLiveRange
(
void
);
double
modeSwitchLiveRange
(
void
);
double
returnSwitchLiveRange
(
void
);
double
loiterSwitchLiveRange
(
void
);
double
loiterSwitchLiveRange
(
void
);
double
posCtlSwitchLiveRange
(
void
);
double
posCtlSwitchLiveRange
(
void
);
double
returnSwitchLiveRange
(
void
);
double
offboardSwitchLiveRange
(
void
);
bool
sendLiveRCSwitchRanges
(
void
)
{
return
_liveRCValues
;
}
bool
sendLiveRCSwitchRanges
(
void
)
{
return
_liveRCValues
;
}
void
setSendLiveRCSwitchRanges
(
bool
start
);
void
setSendLiveRCSwitchRanges
(
bool
start
);
...
...
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