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
16d6ac6a
Commit
16d6ac6a
authored
7 years ago
by
Dennis Mannhart
Committed by
Beat Küng
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
FlightTaskManualStabilized: check for 0 maximum tilt and scale throttle linearly
parent
7f406aa2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lib/FlightTasks/tasks/FlightTaskManualStabilized.cpp
+9
-5
9 additions, 5 deletions
src/lib/FlightTasks/tasks/FlightTaskManualStabilized.cpp
with
9 additions
and
5 deletions
src/lib/FlightTasks/tasks/FlightTaskManualStabilized.cpp
+
9
−
5
View file @
16d6ac6a
...
...
@@ -85,8 +85,12 @@ void FlightTaskManualStabilized::_updateThrustSetpoints()
/* Rotate setpoint into local frame. */
matrix
::
Vector3f
sp
{
_sticks
(
0
),
_sticks
(
1
),
0.0
f
};
sp
=
(
matrix
::
Dcmf
(
matrix
::
Eulerf
(
0.0
f
,
0.0
f
,
_yaw
))
*
sp
);
const
float
x
=
sp
(
0
)
*
math
::
radians
(
_tilt_max_man
.
get
());
const
float
y
=
sp
(
1
)
*
math
::
radians
(
_tilt_max_man
.
get
());
/* Ensure that maximum tilt is in [0.001, Pi] */
float
tilt_max
=
math
::
constrain
(
math
::
radians
(
_tilt_max_man
.
get
()),
0.001
f
,
M_PI_F
);
const
float
x
=
sp
(
0
)
*
tilt_max
;
const
float
y
=
sp
(
1
)
*
tilt_max
;
/* The norm of the xy stick input provides the pointing
* direction of the horizontal desired thrust setpoint. The magnitude of the
...
...
@@ -97,8 +101,8 @@ void FlightTaskManualStabilized::_updateThrustSetpoints()
matrix
::
Vector2f
v
=
matrix
::
Vector2f
(
y
,
-
x
);
float
v_norm
=
v
.
norm
();
// the norm of v defines the tilt angle
if
(
v_norm
>
_
tilt_max
_man
.
get
()
)
{
// limit to the configured maximum tilt angle
v
*=
_
tilt_max
_man
.
get
()
/
v_norm
;
if
(
v_norm
>
tilt_max
)
{
// limit to the configured maximum tilt angle
v
*=
tilt_max
/
v_norm
;
}
/* The final thrust setpoint is found by rotating the scaled unit vector pointing
...
...
@@ -118,7 +122,7 @@ float FlightTaskManualStabilized::_throttleCurve()
{
/* Scale stick z from [-1,1] to [min thrust, max thrust]
* with hover throttle at 0.5 stick */
float
throttle
=
-
((
_sticks
_expo
(
2
)
-
1.0
f
)
*
0.5
f
);
float
throttle
=
-
((
_sticks
(
2
)
-
1.0
f
)
*
0.5
f
);
if
(
throttle
<
0.5
f
)
{
return
(
_throttle_hover
.
get
()
-
_throttle_min
.
get
())
/
0.5
f
*
throttle
+
_throttle_min
.
get
();
...
...
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