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
7455a833
Commit
7455a833
authored
9 years ago
by
Lorenz Meier
Browse files
Options
Downloads
Patches
Plain Diff
MC: Split yaw speed limiting between manual and velocity control modes
parent
56cd54ab
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/mc_att_control_main.cpp
+18
-2
18 additions, 2 deletions
src/modules/mc_att_control/mc_att_control_main.cpp
src/modules/mc_att_control/mc_att_control_params.c
+14
-2
14 additions, 2 deletions
src/modules/mc_att_control/mc_att_control_params.c
with
32 additions
and
4 deletions
src/modules/mc_att_control/mc_att_control_main.cpp
+
18
−
2
View file @
7455a833
...
...
@@ -190,6 +190,7 @@ private:
param_t
roll_rate_max
;
param_t
pitch_rate_max
;
param_t
yaw_rate_max
;
param_t
yaw_auto_max
;
param_t
acro_roll_max
;
param_t
acro_pitch_max
;
...
...
@@ -214,8 +215,9 @@ private:
float
roll_rate_max
;
float
pitch_rate_max
;
float
yaw_rate_max
;
float
yaw_auto_max
;
math
::
Vector
<
3
>
mc_rate_max
;
/**< attitude rate limits in stabilized modes */
math
::
Vector
<
3
>
auto_rate_max
;
/**< attitude rate limits in auto modes */
math
::
Vector
<
3
>
acro_rate_max
;
/**< max attitude rates in acro mode */
float
rattitude_thres
;
int
vtol_type
;
/**< 0 = Tailsitter, 1 = Tiltrotor, 2 = Standard airframe */
...
...
@@ -347,6 +349,7 @@ MulticopterAttitudeControl::MulticopterAttitudeControl() :
_params
.
pitch_rate_max
=
0.0
f
;
_params
.
yaw_rate_max
=
0.0
f
;
_params
.
mc_rate_max
.
zero
();
_params
.
auto_rate_max
.
zero
();
_params
.
acro_rate_max
.
zero
();
_params
.
rattitude_thres
=
1.0
f
;
_params
.
vtol_opt_recovery_enabled
=
false
;
...
...
@@ -379,6 +382,7 @@ MulticopterAttitudeControl::MulticopterAttitudeControl() :
_params_handles
.
roll_rate_max
=
param_find
(
"MC_ROLLRATE_MAX"
);
_params_handles
.
pitch_rate_max
=
param_find
(
"MC_PITCHRATE_MAX"
);
_params_handles
.
yaw_rate_max
=
param_find
(
"MC_YAWRATE_MAX"
);
_params_handles
.
yaw_auto_max
=
param_find
(
"MC_YAWRAUTO_MAX"
);
_params_handles
.
acro_roll_max
=
param_find
(
"MC_ACRO_R_MAX"
);
_params_handles
.
acro_pitch_max
=
param_find
(
"MC_ACRO_P_MAX"
);
_params_handles
.
acro_yaw_max
=
param_find
(
"MC_ACRO_Y_MAX"
);
...
...
@@ -482,6 +486,14 @@ MulticopterAttitudeControl::parameters_update()
param_get
(
_params_handles
.
yaw_rate_max
,
&
_params
.
yaw_rate_max
);
_params
.
mc_rate_max
(
2
)
=
math
::
radians
(
_params
.
yaw_rate_max
);
/* auto angular rate limits */
param_get
(
_params_handles
.
roll_rate_max
,
&
_params
.
roll_rate_max
);
_params
.
auto_rate_max
(
0
)
=
math
::
radians
(
_params
.
roll_rate_max
);
param_get
(
_params_handles
.
pitch_rate_max
,
&
_params
.
pitch_rate_max
);
_params
.
auto_rate_max
(
1
)
=
math
::
radians
(
_params
.
pitch_rate_max
);
param_get
(
_params_handles
.
yaw_auto_max
,
&
_params
.
yaw_auto_max
);
_params
.
auto_rate_max
(
2
)
=
math
::
radians
(
_params
.
yaw_auto_max
);
/* manual rate control scale and auto mode roll/pitch rate limits */
param_get
(
_params_handles
.
acro_roll_max
,
&
v
);
_params
.
acro_rate_max
(
0
)
=
math
::
radians
(
v
);
...
...
@@ -705,7 +717,11 @@ MulticopterAttitudeControl::control_attitude(float dt)
/* limit rates */
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
_rates_sp
(
i
)
=
math
::
constrain
(
_rates_sp
(
i
),
-
_params
.
mc_rate_max
(
i
),
_params
.
mc_rate_max
(
i
));
if
(
_v_control_mode
.
flag_control_velocity_enabled
)
{
_rates_sp
(
i
)
=
math
::
constrain
(
_rates_sp
(
i
),
-
_params
.
auto_rate_max
(
i
),
_params
.
auto_rate_max
(
i
));
}
else
{
_rates_sp
(
i
)
=
math
::
constrain
(
_rates_sp
(
i
),
-
_params
.
mc_rate_max
(
i
),
_params
.
mc_rate_max
(
i
));
}
}
/* feed forward yaw setpoint rate */
...
...
This diff is collapsed.
Click to expand it.
src/modules/mc_att_control/mc_att_control_params.c
+
14
−
2
View file @
7455a833
...
...
@@ -251,6 +251,18 @@ PARAM_DEFINE_FLOAT(MC_PITCHRATE_MAX, 220.0f);
/**
* Max yaw rate
*
* A value of significantly over 120 degrees per second can already lead to mixer saturation.
*
* @unit deg/s
* @min 0.0
* @max 360.0
* @group Multicopter Attitude Control
*/
PARAM_DEFINE_FLOAT
(
MC_YAWRATE_MAX
,
120
.
0
f
);
/**
* Max yaw rate in auto mode
*
* Limit for yaw rate, has effect for large rotations in autonomous mode,
* to avoid large control output and mixer saturation. A value of significantly
* over 60 degrees per second can already lead to mixer saturation.
...
...
@@ -258,10 +270,10 @@ PARAM_DEFINE_FLOAT(MC_PITCHRATE_MAX, 220.0f);
*
* @unit deg/s
* @min 0.0
* @max
36
0.0
* @max
12
0.0
* @group Multicopter Attitude Control
*/
PARAM_DEFINE_FLOAT
(
MC_YAWRA
TE
_MAX
,
45
.
0
f
);
PARAM_DEFINE_FLOAT
(
MC_YAWRA
UTO
_MAX
,
45
.
0
f
);
/**
* Max acro roll rate
...
...
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