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
ed5015eb
Commit
ed5015eb
authored
Dec 27, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2484 from DonLakeFlyer/RadioTrigger
Update radio triggers
parents
04c3ca96
a01e805a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
15 deletions
+76
-15
APMRadioComponent.cc
src/AutoPilotPlugins/APM/APMRadioComponent.cc
+66
-12
APMRadioComponent.h
src/AutoPilotPlugins/APM/APMRadioComponent.h
+8
-1
APMArduCopterMockLink.params
src/comm/APMArduCopterMockLink.params
+1
-1
APMArduPlaneMockLink.params
src/comm/APMArduPlaneMockLink.params
+1
-1
No files found.
src/AutoPilotPlugins/APM/APMRadioComponent.cc
View file @
ed5015eb
...
@@ -29,6 +29,14 @@ APMRadioComponent::APMRadioComponent(Vehicle* vehicle, AutoPilotPlugin* autopilo
...
@@ -29,6 +29,14 @@ APMRadioComponent::APMRadioComponent(Vehicle* vehicle, AutoPilotPlugin* autopilo
APMComponent
(
vehicle
,
autopilot
,
parent
),
APMComponent
(
vehicle
,
autopilot
,
parent
),
_name
(
tr
(
"Radio"
))
_name
(
tr
(
"Radio"
))
{
{
_mapParams
<<
QStringLiteral
(
"RCMAP_ROLL"
)
<<
QStringLiteral
(
"RCMAP_PITCH"
)
<<
QStringLiteral
(
"RCMAP_YAW"
)
<<
QStringLiteral
(
"RCMAP_THROTTLE"
);
foreach
(
const
QString
&
mapParam
,
_mapParams
)
{
Fact
*
fact
=
_autopilot
->
getParameterFact
(
-
1
,
mapParam
);
connect
(
fact
,
&
Fact
::
valueChanged
,
this
,
&
APMRadioComponent
::
_triggerChanged
);
}
_connectSetupTriggers
();
}
}
QString
APMRadioComponent
::
name
(
void
)
const
QString
APMRadioComponent
::
name
(
void
)
const
...
@@ -56,25 +64,38 @@ bool APMRadioComponent::requiresSetup(void) const
...
@@ -56,25 +64,38 @@ bool APMRadioComponent::requiresSetup(void) const
bool
APMRadioComponent
::
setupComplete
(
void
)
const
bool
APMRadioComponent
::
setupComplete
(
void
)
const
{
{
// The best we can do to detect the need for a radio calibration is look for attitude
// The best we can do to detect the need for a radio calibration is look for attitude
// controls to be mapped.
// controls to be mapped as well as all attitude control rc min/max/trim still at defaults.
QStringList
attitudeMappings
;
QList
<
int
>
mapValues
;
attitudeMappings
<<
"RCMAP_ROLL"
<<
"RCMAP_PITCH"
<<
"RCMAP_YAW"
<<
"RCMAP_THROTTLE"
;
foreach
(
const
QString
&
mapParam
,
attitudeMappings
)
{
// First check for all attitude controls mapped
if
(
_autopilot
->
getParameterFact
(
FactSystem
::
defaultComponentId
,
mapParam
)
->
rawValue
().
toInt
()
==
0
)
{
for
(
int
i
=
0
;
i
<
_mapParams
.
count
();
i
++
)
{
mapValues
<<
_autopilot
->
getParameterFact
(
FactSystem
::
defaultComponentId
,
_mapParams
[
i
])
->
rawValue
().
toInt
();
if
(
mapValues
[
i
]
<=
0
)
{
return
false
;
return
false
;
}
}
}
}
// Next check RC#_MIN/MAX/TRIM all at defaults
foreach
(
const
QString
&
mapParam
,
_mapParams
)
{
int
channel
=
_autopilot
->
getParameterFact
(
-
1
,
mapParam
)
->
rawValue
().
toInt
();
if
(
_autopilot
->
getParameterFact
(
-
1
,
QString
(
"RC%1_MIN"
).
arg
(
channel
))
->
rawValue
().
toInt
()
!=
1100
)
{
return
true
;
}
if
(
_autopilot
->
getParameterFact
(
-
1
,
QString
(
"RC%1_MAX"
).
arg
(
channel
))
->
rawValue
().
toInt
()
!=
1900
)
{
return
true
;
}
if
(
_autopilot
->
getParameterFact
(
-
1
,
QString
(
"RC%1_TRIM"
).
arg
(
channel
))
->
rawValue
().
toInt
()
!=
1500
)
{
return
true
;
return
true
;
}
}
return
false
;
}
}
QStringList
APMRadioComponent
::
setupCompleteChangedTriggerList
(
void
)
const
QStringList
APMRadioComponent
::
setupCompleteChangedTriggerList
(
void
)
const
{
{
QStringList
triggers
;
// APMRadioComponent manages it's own triggers
return
QStringList
();
triggers
<<
"RCMAP_ROLL"
<<
"RCMAP_PITCH"
<<
"RCMAP_YAW"
<<
"RCMAP_THROTTLE"
;
return
triggers
;
}
}
QUrl
APMRadioComponent
::
setupSource
(
void
)
const
QUrl
APMRadioComponent
::
setupSource
(
void
)
const
...
@@ -93,8 +114,41 @@ QString APMRadioComponent::prerequisiteSetup(void) const
...
@@ -93,8 +114,41 @@ QString APMRadioComponent::prerequisiteSetup(void) const
if
(
!
plugin
->
airframeComponent
()
->
setupComplete
())
{
if
(
!
plugin
->
airframeComponent
()
->
setupComplete
())
{
return
plugin
->
airframeComponent
()
->
name
();
return
plugin
->
airframeComponent
()
->
name
();
}
}
return
QString
();
return
QString
();
}
}
void
APMRadioComponent
::
_connectSetupTriggers
(
void
)
{
// Disconnect previous triggers
foreach
(
Fact
*
fact
,
_triggerFacts
)
{
disconnect
(
fact
,
&
Fact
::
valueChanged
,
this
,
&
APMRadioComponent
::
_triggerChanged
);
}
_triggerFacts
.
clear
();
// Get the channels for attitude controls and connect to those values for triggers
foreach
(
const
QString
&
mapParam
,
_mapParams
)
{
int
channel
=
_autopilot
->
getParameterFact
(
FactSystem
::
defaultComponentId
,
mapParam
)
->
rawValue
().
toInt
();
Fact
*
fact
=
_autopilot
->
getParameterFact
(
-
1
,
QString
(
"RC%1_MIN"
).
arg
(
channel
));
_triggerFacts
<<
fact
;
connect
(
fact
,
&
Fact
::
valueChanged
,
this
,
&
APMRadioComponent
::
_triggerChanged
);
fact
=
_autopilot
->
getParameterFact
(
-
1
,
QString
(
"RC%1_MAX"
).
arg
(
channel
));
_triggerFacts
<<
fact
;
connect
(
fact
,
&
Fact
::
valueChanged
,
this
,
&
APMRadioComponent
::
_triggerChanged
);
fact
=
_autopilot
->
getParameterFact
(
-
1
,
QString
(
"RC%1_TRIM"
).
arg
(
channel
));
_triggerFacts
<<
fact
;
connect
(
fact
,
&
Fact
::
valueChanged
,
this
,
&
APMRadioComponent
::
_triggerChanged
);
}
}
void
APMRadioComponent
::
_triggerChanged
(
void
)
{
emit
setupCompleteChanged
(
setupComplete
());
// Control mapping may have changed so we need to reset triggers
_connectSetupTriggers
();
}
src/AutoPilotPlugins/APM/APMRadioComponent.h
View file @
ed5015eb
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#define APMRadioComponent_H
#define APMRadioComponent_H
#include "APMComponent.h"
#include "APMComponent.h"
#include "Fact.h"
class
APMRadioComponent
:
public
APMComponent
class
APMRadioComponent
:
public
APMComponent
{
{
...
@@ -46,9 +47,15 @@ public:
...
@@ -46,9 +47,15 @@ public:
virtual
QUrl
summaryQmlSource
(
void
)
const
;
virtual
QUrl
summaryQmlSource
(
void
)
const
;
virtual
QString
prerequisiteSetup
(
void
)
const
;
virtual
QString
prerequisiteSetup
(
void
)
const
;
private
slots
:
void
_triggerChanged
(
void
);
private:
private:
void
_connectSetupTriggers
(
void
);
const
QString
_name
;
const
QString
_name
;
QVariantList
_summaryItems
;
QStringList
_mapParams
;
QList
<
Fact
*>
_triggerFacts
;
};
};
#endif
#endif
src/comm/APMArduCopterMockLink.params
View file @
ed5015eb
...
@@ -331,7 +331,7 @@
...
@@ -331,7 +331,7 @@
1 1 RC14_TRIM 1500 4
1 1 RC14_TRIM 1500 4
1 1 RC1_DZ 30 4
1 1 RC1_DZ 30 4
1 1 RC1_MAX 1900 4
1 1 RC1_MAX 1900 4
1 1 RC1_MIN 110
0
4
1 1 RC1_MIN 110
1
4
1 1 RC1_REV 1 2
1 1 RC1_REV 1 2
1 1 RC1_TRIM 1500 4
1 1 RC1_TRIM 1500 4
1 1 RC2_DZ 30 4
1 1 RC2_DZ 30 4
...
...
src/comm/APMArduPlaneMockLink.params
View file @
ed5015eb
...
@@ -366,7 +366,7 @@
...
@@ -366,7 +366,7 @@
1 1 RC14_TRIM 1500 4
1 1 RC14_TRIM 1500 4
1 1 RC1_DZ 30 4
1 1 RC1_DZ 30 4
1 1 RC1_MAX 1900 4
1 1 RC1_MAX 1900 4
1 1 RC1_MIN 110
0
4
1 1 RC1_MIN 110
1
4
1 1 RC1_REV 1 2
1 1 RC1_REV 1 2
1 1 RC1_TRIM 1500 4
1 1 RC1_TRIM 1500 4
1 1 RC2_DZ 30 4
1 1 RC2_DZ 30 4
...
...
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