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
106f0769
Commit
106f0769
authored
6 years ago
by
bresch
Browse files
Options
Downloads
Patches
Plain Diff
mc_pos_control - add takeoff_ramp_time zero division guard
parent
70ddb804
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_pos_control/mc_pos_control_main.cpp
+13
-8
13 additions, 8 deletions
src/modules/mc_pos_control/mc_pos_control_main.cpp
src/modules/mc_pos_control/mc_pos_control_params.c
+2
-1
2 additions, 1 deletion
src/modules/mc_pos_control/mc_pos_control_params.c
with
15 additions
and
9 deletions
src/modules/mc_pos_control/mc_pos_control_main.cpp
+
13
−
8
View file @
106f0769
...
...
@@ -1045,7 +1045,7 @@ MulticopterPositionControl::check_for_smooth_takeoff(const float &z_sp, const fl
0.2
f
;
// takeoff was initiated through velocity setpoint
_smooth_velocity_takeoff
=
PX4_ISFINITE
(
vz_sp
)
&&
vz_sp
<
math
::
min
(
-
_tko_speed
.
get
(),
-
0.6
f
)
;
_smooth_velocity_takeoff
=
PX4_ISFINITE
(
vz_sp
)
&&
vz_sp
<
-
0.1
f
;
if
((
PX4_ISFINITE
(
z_sp
)
&&
z_sp
<
_states
.
position
(
2
)
-
min_altitude
)
||
_smooth_velocity_takeoff
)
{
// There is a position setpoint above current position or velocity setpoint larger than
...
...
@@ -1076,19 +1076,24 @@ MulticopterPositionControl::update_smooth_takeoff(const float &z_sp, const float
}
// Ramp up takeoff speed.
_takeoff_speed
+=
desired_tko_speed
*
_dt
/
_takeoff_ramp_time
.
get
();
_takeoff_speed
=
math
::
min
(
_takeoff_speed
,
desired_tko_speed
);
if
(
_takeoff_ramp_time
.
get
()
>
_dt
)
{
_takeoff_speed
+=
desired_tko_speed
*
_dt
/
_takeoff_ramp_time
.
get
();
}
else
{
// No ramp, directly go to desired takeoff speed
_takeoff_speed
=
desired_tko_speed
;
}
_takeoff_speed
=
math
::
min
(
_takeoff_speed
,
_tko_speed
.
get
());
// Smooth takeoff is achieved once desired altitude/velocity setpoint is reached.
if
(
!
_smooth_velocity_takeoff
)
{
_in_smooth_takeoff
=
_states
.
position
(
2
)
-
0.2
f
>
math
::
max
(
z_sp
,
_takeoff_reference_z
-
MPC_LAND_ALT2
.
get
());
}
else
{
_in_smooth_takeoff
=
_takeoff_speed
<
-
vz_sp
;
}
else
{
// Make sure to stay in smooth takeoff if takeoff has not been detected yet by the land detector
_in_smooth_takeoff
=
(
_takeoff_speed
<
-
vz_sp
)
||
_vehicle_land_detected
.
landed
;
}
}
else
{
_in_smooth_takeoff
=
false
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/modules/mc_pos_control/mc_pos_control_params.c
+
2
−
1
View file @
106f0769
...
...
@@ -650,8 +650,9 @@ PARAM_DEFINE_FLOAT(MPC_LAND_ALT2, 5.0f);
*
* Increasing this value will make automatic and manual takeoff slower.
* If it's too slow the drone might scratch the ground and tip over.
* A time constant of 0 disables the ramp
*
* @min 0
.1
* @min 0
* @max 1
* @group Multicopter Position Control
*/
...
...
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