Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alberto Ruiz Garcia
Firmware
Commits
df194b1d
Commit
df194b1d
authored
7 years ago
by
bresch
Committed by
Roman Bapst
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Multicopter mixer - Rewrite unnecessarily complicated conditions
parent
5da2842d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lib/mixer/mixer_multirotor.cpp
+4
-4
4 additions, 4 deletions
src/lib/mixer/mixer_multirotor.cpp
with
4 additions
and
4 deletions
src/lib/mixer/mixer_multirotor.cpp
+
4
−
4
View file @
df194b1d
...
...
@@ -209,10 +209,10 @@ MultirotorMixer::mix(float *outputs, unsigned space)
// which may result in motor saturation after thrust boost is applied
// TODO: revise the saturation/boosting strategy
if
(
min_out
<
0.0
f
&&
max_out
<
1.0
f
&&
-
min_out
<=
1.0
f
-
max_out
)
{
if
(
min_out
<
0.0
f
&&
max_out
<
1.0
f
&&
max_out
-
min_out
<=
1.0
f
)
{
boost
=
-
min_out
;
}
else
if
(
max_out
>
1.0
f
&&
min_out
>
0.0
f
&&
m
in
_out
>=
max
_out
-
1.0
f
)
{
}
else
if
(
max_out
>
1.0
f
&&
min_out
>
0.0
f
&&
m
ax
_out
-
min
_out
<=
1.0
f
)
{
float
max_thrust_diff
=
thrust
-
thrust_decrease_factor
*
thrust
;
if
(
max_thrust_diff
>=
max_out
-
1.0
f
)
{
...
...
@@ -223,12 +223,12 @@ MultirotorMixer::mix(float *outputs, unsigned space)
roll_pitch_scale
=
(
1
-
(
thrust
+
boost
))
/
(
max_out
-
thrust
);
}
}
else
if
(
min_out
<
0.0
f
&&
max_out
<
1.0
f
&&
-
min_out
>
1.0
f
-
max_out
)
{
}
else
if
(
min_out
<
0.0
f
&&
max_out
<
1.0
f
&&
max_out
-
min_out
>
1.0
f
)
{
float
max_thrust_diff
=
thrust
*
thrust_increase_factor
-
thrust
;
boost
=
math
::
constrain
(
-
min_out
-
(
1.0
f
-
max_out
)
/
2.0
f
,
0.0
f
,
max_thrust_diff
);
roll_pitch_scale
=
(
thrust
+
boost
)
/
(
thrust
-
min_out
);
}
else
if
(
max_out
>
1.0
f
&&
min_out
>
0.0
f
&&
m
in
_out
<
m
ax
_out
-
1.0
f
)
{
}
else
if
(
max_out
>
1.0
f
&&
min_out
>
0.0
f
&&
m
ax
_out
-
m
in
_out
>
1.0
f
)
{
float
max_thrust_diff
=
thrust
-
thrust_decrease_factor
*
thrust
;
boost
=
math
::
constrain
(
-
(
max_out
-
1.0
f
-
min_out
)
/
2.0
f
,
-
max_thrust_diff
,
0.0
f
);
roll_pitch_scale
=
(
1
-
(
thrust
+
boost
))
/
(
max_out
-
thrust
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment