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
8bafdba4
Commit
8bafdba4
authored
7 years ago
by
Dennis Mannhart
Committed by
Beat Küng
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
FlightTaskManualStabilized: update comments
parent
85a263c7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/lib/FlightTasks/tasks/FlightTaskManualStabilized.cpp
+11
-5
11 additions, 5 deletions
src/lib/FlightTasks/tasks/FlightTaskManualStabilized.cpp
src/lib/FlightTasks/tasks/FlightTaskManualStabilized.hpp
+3
-4
3 additions, 4 deletions
src/lib/FlightTasks/tasks/FlightTaskManualStabilized.hpp
with
14 additions
and
9 deletions
src/lib/FlightTasks/tasks/FlightTaskManualStabilized.cpp
+
11
−
5
View file @
8bafdba4
...
...
@@ -61,8 +61,7 @@ bool FlightTaskManualStabilized::activate()
void
FlightTaskManualStabilized
::
_scaleSticks
()
{
/* Scale sticks to yaw and thrust using
* linear scale for yaw and quadratic for thrust.
* TODO: add thrust */
* linear scale for yaw and piecewise linear map for thrust. */
_yaw_rate_sp
=
_sticks
(
3
)
*
math
::
radians
(
_yaw_rate_scaling
.
get
());
_throttle
=
_throttleCurve
();;
}
...
...
@@ -84,13 +83,18 @@ void FlightTaskManualStabilized::_updateHeadingSetpoints()
void
FlightTaskManualStabilized
::
_updateThrustSetpoints
()
{
/* Body frame */
/* 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
());
/* The norm of the xy stick input provides the pointing
* direction of the horizontal desired thrust setpoint. The magnitude of the
* xy stick inputs represents the desired tilt. Both tilt and magnitude can
* be captured through Axis-Angle.
*/
/* The Axis-Angle is the perpendicular vector to xy-stick input */
matrix
::
Vector2f
v
=
matrix
::
Vector2f
(
y
,
-
x
);
float
v_norm
=
v
.
norm
();
// the norm of v defines the tilt angle
...
...
@@ -98,6 +102,9 @@ void FlightTaskManualStabilized::_updateThrustSetpoints()
v
*=
_tilt_max_man
.
get
()
/
v_norm
;
}
/* The final thrust setpoint is found by rotating the scaled unit vector pointing
* upward by the Axis-Angle.
*/
matrix
::
Quatf
q_sp
=
matrix
::
AxisAnglef
(
v
(
0
),
v
(
1
),
0.0
f
);
_thr_sp
=
q_sp
.
conjugate
(
matrix
::
Vector3f
(
0.0
f
,
0.0
f
,
-
1.0
f
))
*
_throttle
;
}
...
...
@@ -108,10 +115,9 @@ void FlightTaskManualStabilized::_updateSetpoints()
_updateThrustSetpoints
();
}
/* TODO: add quadratic funciton */
float
FlightTaskManualStabilized
::
_throttleCurve
()
{
/* Scale stick z from [-1,1] to [min thr, max thr]
/* Scale stick z from [-1,1] to [min thr
ust
, max thr
ust
]
* with hover throttle at 0.5 stick */
float
throttle
=
-
((
_sticks_expo
(
2
)
-
1.0
f
)
*
0.5
f
);
...
...
This diff is collapsed.
Click to expand it.
src/lib/FlightTasks/tasks/FlightTaskManualStabilized.hpp
+
3
−
4
View file @
8bafdba4
...
...
@@ -36,7 +36,6 @@
*
* Flight task for manual controlled attitude.
* It generates thrust and yaw setpoints.
* TODO: add thrust
*/
#pragma once
...
...
@@ -64,15 +63,15 @@ protected:
private
:
float
_throttle
{};
float
_throttle
{};
/** Mapped from stick z. */
void
_updateHeadingSetpoints
();
/**< Sets yaw or yaw speed. */
void
_updateThrustSetpoints
();
/**< Sets thrust setpoint */
float
_throttleCurve
();
/**<
p
iecewise linear mapping f
o
r throttle */
float
_throttleCurve
();
/**<
P
iecewise linear mapping fr
om stick to
throttle
.
*/
control
::
BlockParamFloat
_yaw_rate_scaling
;
/**< Scaling factor from stick to yaw rate. */
control
::
BlockParamFloat
_tilt_max_man
;
/**< Maximum tilt allowed for manual flight */
control
::
BlockParamFloat
_throttle_min
;
/**< Minimum throttle that always has to be satisfied in flight*/
control
::
BlockParamFloat
_throttle_max
;
/**< Maximum throttle that always has to be satisfied in flight*/
control
::
BlockParamFloat
_throttle_hover
;
/**< Thrott
e
l value at which vehicle is at hover equilibrium */
control
::
BlockParamFloat
_throttle_hover
;
/**< Throttl
e
value at which vehicle is at hover equilibrium */
};
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