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
5ee1fcae
Commit
5ee1fcae
authored
6 years ago
by
Matthias Grob
Browse files
Options
Downloads
Patches
Plain Diff
AttitudeControl: address @dagar's review comments
parent
7e8cf87d
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/modules/mc_att_control/AttitudeControl/AttitudeControl.cpp
+5
-5
5 additions, 5 deletions
...odules/mc_att_control/AttitudeControl/AttitudeControl.cpp
src/modules/mc_att_control/AttitudeControl/CMakeLists.txt
+1
-1
1 addition, 1 deletion
src/modules/mc_att_control/AttitudeControl/CMakeLists.txt
with
6 additions
and
6 deletions
src/modules/mc_att_control/AttitudeControl/AttitudeControl.cpp
+
5
−
5
View file @
5ee1fcae
...
...
@@ -60,11 +60,11 @@ matrix::Vector3f AttitudeControl::update(matrix::Quatf q, matrix::Quatf qd, floa
qd
.
normalize
();
// calculate reduced desired attitude neglecting vehicle's yaw to prioritize roll and pitch
Vector3f
e_z
=
q
.
dcm_z
();
Vector3f
e_z_d
=
qd
.
dcm_z
();
const
Vector3f
e_z
=
q
.
dcm_z
();
const
Vector3f
e_z_d
=
qd
.
dcm_z
();
Quatf
qd_red
(
e_z
,
e_z_d
);
if
(
abs
(
qd_red
(
1
))
>
(
1.
f
-
1e-5
f
)
||
abs
(
qd_red
(
2
))
>
(
1.
f
-
1e-5
f
))
{
if
(
f
abs
f
(
qd_red
(
1
))
>
(
1.
f
-
1e-5
f
)
||
f
abs
f
(
qd_red
(
2
))
>
(
1.
f
-
1e-5
f
))
{
// In the infinitesimal corner case where the vehicle and thrust have the completely opposite direction,
// full attitude control anyways generates no yaw input and directly takes the combination of
// roll and pitch leading to the correct desired yaw. Ignoring this case would still be totally safe and stable.
...
...
@@ -84,11 +84,11 @@ matrix::Vector3f AttitudeControl::update(matrix::Quatf q, matrix::Quatf qd, floa
qd
=
qd_red
*
Quatf
(
cosf
(
_yaw_w
*
acosf
(
q_mix
(
0
))),
0
,
0
,
sinf
(
_yaw_w
*
asinf
(
q_mix
(
3
))));
// quaternion attitude control law, qe is rotation from q to qd
Quatf
qe
=
q
.
inversed
()
*
qd
;
const
Quatf
qe
=
q
.
inversed
()
*
qd
;
// using sin(alpha/2) scaled rotation axis as attitude error (see quaternion definition by axis angle)
// also taking care of the antipodal unit quaternion ambiguity
Vector3f
eq
=
2.
f
*
math
::
signNoZero
(
qe
(
0
))
*
qe
.
imag
();
const
Vector3f
eq
=
2.
f
*
math
::
signNoZero
(
qe
(
0
))
*
qe
.
imag
();
// calculate angular rates setpoint
matrix
::
Vector3f
rate_setpoint
=
eq
.
emult
(
_proportional_gain
);
...
...
This diff is collapsed.
Click to expand it.
src/modules/mc_att_control/AttitudeControl/CMakeLists.txt
+
1
−
1
View file @
5ee1fcae
...
...
@@ -35,6 +35,6 @@ px4_add_library(AttitudeControl
AttitudeControl.cpp
)
target_include_directories
(
AttitudeControl
PUBLIC
PUBLIC
${
CMAKE_CURRENT_SOURCE_DIR
}
)
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