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
cdb6aca6
Commit
cdb6aca6
authored
6 years ago
by
Matthias Grob
Committed by
Dennis Mannhart
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
mc_pos_control: refactor spoolup time naming
parent
43fb84a6
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
+11
-20
11 additions, 20 deletions
src/modules/mc_pos_control/mc_pos_control_main.cpp
src/modules/mc_pos_control/mc_pos_control_params.c
+11
-11
11 additions, 11 deletions
src/modules/mc_pos_control/mc_pos_control_params.c
with
22 additions
and
31 deletions
src/modules/mc_pos_control/mc_pos_control_main.cpp
+
11
−
20
View file @
cdb6aca6
...
@@ -159,7 +159,7 @@ private:
...
@@ -159,7 +159,7 @@ private:
(
ParamInt
<
px4
::
params
::
MPC_POS_MODE
>
)
MPC_POS_MODE
,
(
ParamInt
<
px4
::
params
::
MPC_POS_MODE
>
)
MPC_POS_MODE
,
(
ParamInt
<
px4
::
params
::
MPC_AUTO_MODE
>
)
MPC_AUTO_MODE
,
(
ParamInt
<
px4
::
params
::
MPC_AUTO_MODE
>
)
MPC_AUTO_MODE
,
(
ParamInt
<
px4
::
params
::
MPC_ALT_MODE
>
)
MPC_ALT_MODE
,
(
ParamInt
<
px4
::
params
::
MPC_ALT_MODE
>
)
MPC_ALT_MODE
,
(
ParamFloat
<
px4
::
params
::
MPC_
IDLE_TKO
>
)
MPC_IDLE_TKO
,
/**< time
constant f
or s
m
oo
th takeoff ramp
*/
(
ParamFloat
<
px4
::
params
::
MPC_
SPOOLUP_TIME
>
)
MPC_SPOOLUP_TIME
,
/**< time
to let mot
or
s
s
p
oo
l up after arming
*/
(
ParamInt
<
px4
::
params
::
MPC_OBS_AVOID
>
)
MPC_OBS_AVOID
,
/**< enable obstacle avoidance */
(
ParamInt
<
px4
::
params
::
MPC_OBS_AVOID
>
)
MPC_OBS_AVOID
,
/**< enable obstacle avoidance */
(
ParamFloat
<
px4
::
params
::
MPC_TILTMAX_LND
>
)
MPC_TILTMAX_LND
/**< maximum tilt for landing and smooth takeoff */
(
ParamFloat
<
px4
::
params
::
MPC_TILTMAX_LND
>
)
MPC_TILTMAX_LND
/**< maximum tilt for landing and smooth takeoff */
);
);
...
@@ -185,14 +185,7 @@ private:
...
@@ -185,14 +185,7 @@ private:
/** During smooth-takeoff, below ALTITUDE_THRESHOLD the yaw-control is turned off ant tilt is limited */
/** During smooth-takeoff, below ALTITUDE_THRESHOLD the yaw-control is turned off ant tilt is limited */
static
constexpr
float
ALTITUDE_THRESHOLD
=
0.3
f
;
static
constexpr
float
ALTITUDE_THRESHOLD
=
0.3
f
;
/**
systemlib
::
Hysteresis
_spoolup_time_hysteresis
{
false
};
/**< becomes true MPC_SPOOLUP_TIME seconds after the vehicle was armed */
* Hysteresis that turns true once vehicle is armed for MPC_IDLE_TKO seconds.
* A real vehicle requires some time to accelerates the propellers to IDLE speed. To ensure
* that the propellers reach idle speed before initiating a takeoff, a delay of MPC_IDLE_TKO
* is added.
*/
systemlib
::
Hysteresis
_arm_hysteresis
{
false
};
/**< becomes true once vehicle is armed for MPC_IDLE_TKO seconds */
systemlib
::
Hysteresis
_failsafe_land_hysteresis
{
false
};
/**< becomes true if task did not update correctly for LOITER_TIME_BEFORE_DESCEND */
systemlib
::
Hysteresis
_failsafe_land_hysteresis
{
false
};
/**< becomes true if task did not update correctly for LOITER_TIME_BEFORE_DESCEND */
WeatherVane
*
_wv_controller
{
nullptr
};
WeatherVane
*
_wv_controller
{
nullptr
};
...
@@ -411,8 +404,8 @@ MulticopterPositionControl::parameters_update(bool force)
...
@@ -411,8 +404,8 @@ MulticopterPositionControl::parameters_update(bool force)
_tko_speed
.
set
(
math
::
min
(
_tko_speed
.
get
(),
_vel_max_up
.
get
()));
_tko_speed
.
set
(
math
::
min
(
_tko_speed
.
get
(),
_vel_max_up
.
get
()));
_land_speed
.
set
(
math
::
min
(
_land_speed
.
get
(),
_vel_max_down
.
get
()));
_land_speed
.
set
(
math
::
min
(
_land_speed
.
get
(),
_vel_max_down
.
get
()));
// set trigger time for
arm hysteresis
// set trigger time for
takeoff delay
_
arm
_hysteresis
.
set_hysteresis_time_from
(
false
,
(
int
)(
MPC_
IDLE_TKO
.
get
()
*
(
float
)
1
_s
));
_
spoolup_time
_hysteresis
.
set_hysteresis_time_from
(
false
,
(
int
)(
MPC_
SPOOLUP_TIME
.
get
()
*
(
float
)
1
_s
));
if
(
_wv_controller
!=
nullptr
)
{
if
(
_wv_controller
!=
nullptr
)
{
_wv_controller
->
update_parameters
();
_wv_controller
->
update_parameters
();
...
@@ -649,16 +642,15 @@ MulticopterPositionControl::run()
...
@@ -649,16 +642,15 @@ MulticopterPositionControl::run()
_wv_controller
->
update
(
matrix
::
Quatf
(
_att_sp
.
q_d
),
_states
.
yaw
);
_wv_controller
->
update
(
matrix
::
Quatf
(
_att_sp
.
q_d
),
_states
.
yaw
);
}
}
// arm hysteresis prevents vehicle to takeoff
// start takeoff after delay to allow motors to reach idle speed
// before propeller reached idle speed.
_spoolup_time_hysteresis
.
set_state_and_update
(
_control_mode
.
flag_armed
);
_arm_hysteresis
.
set_state_and_update
(
_control_mode
.
flag_armed
);
if
(
_
arm
_hysteresis
.
get_state
())
{
if
(
_
spoolup_time
_hysteresis
.
get_state
())
{
//
as soo
n vehicle is
armed check for
flighttask
//
whe
n vehicle is
ready switch to the required
flighttask
start_flight_task
();
start_flight_task
();
}
else
{
}
else
{
//
disable
flighttask
//
stop
flighttask
while disarmed
_flight_tasks
.
switchTask
(
FlightTaskIndex
::
None
);
_flight_tasks
.
switchTask
(
FlightTaskIndex
::
None
);
}
}
...
@@ -706,9 +698,8 @@ MulticopterPositionControl::run()
...
@@ -706,9 +698,8 @@ MulticopterPositionControl::run()
// check if all local states are valid and map accordingly
// check if all local states are valid and map accordingly
set_vehicle_states
(
setpoint
.
vz
);
set_vehicle_states
(
setpoint
.
vz
);
// we can only do a smooth takeoff if a valid velocity or position is available and are
// do smooth takeoff after delay if there's a valid vertical velocity or position
// armed long enough
if
(
_spoolup_time_hysteresis
.
get_state
()
&&
PX4_ISFINITE
(
_states
.
position
(
2
))
&&
PX4_ISFINITE
(
_states
.
velocity
(
2
)))
{
if
(
_arm_hysteresis
.
get_state
()
&&
PX4_ISFINITE
(
_states
.
position
(
2
))
&&
PX4_ISFINITE
(
_states
.
velocity
(
2
)))
{
check_for_smooth_takeoff
(
setpoint
.
z
,
setpoint
.
vz
,
constraints
);
check_for_smooth_takeoff
(
setpoint
.
z
,
setpoint
.
vz
,
constraints
);
update_smooth_takeoff
(
setpoint
.
z
,
setpoint
.
vz
);
update_smooth_takeoff
(
setpoint
.
z
,
setpoint
.
vz
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/modules/mc_pos_control/mc_pos_control_params.c
+
11
−
11
View file @
cdb6aca6
...
@@ -658,7 +658,7 @@ PARAM_DEFINE_FLOAT(MPC_LAND_ALT2, 5.0f);
...
@@ -658,7 +658,7 @@ PARAM_DEFINE_FLOAT(MPC_LAND_ALT2, 5.0f);
PARAM_DEFINE_FLOAT
(
MPC_TKO_RAMP_T
,
0
.
4
f
);
PARAM_DEFINE_FLOAT
(
MPC_TKO_RAMP_T
,
0
.
4
f
);
/**
/**
* Manual-Position control sub-mode
.
* Manual-Position control sub-mode
*
*
* The supported sub-modes are:
* The supported sub-modes are:
* 0 Default position control where sticks map to position/velocity directly. Maximum speeds
* 0 Default position control where sticks map to position/velocity directly. Maximum speeds
...
@@ -679,7 +679,7 @@ PARAM_DEFINE_FLOAT(MPC_TKO_RAMP_T, 0.4f);
...
@@ -679,7 +679,7 @@ PARAM_DEFINE_FLOAT(MPC_TKO_RAMP_T, 0.4f);
PARAM_DEFINE_INT32
(
MPC_POS_MODE
,
1
);
PARAM_DEFINE_INT32
(
MPC_POS_MODE
,
1
);
/**
/**
* Auto sub-mode
.
* Auto sub-mode
*
*
* @value 0 Default line tracking
* @value 0 Default line tracking
* @value 1 Jerk-limited trajectory
* @value 1 Jerk-limited trajectory
...
@@ -688,20 +688,20 @@ PARAM_DEFINE_INT32(MPC_POS_MODE, 1);
...
@@ -688,20 +688,20 @@ PARAM_DEFINE_INT32(MPC_POS_MODE, 1);
PARAM_DEFINE_INT32
(
MPC_AUTO_MODE
,
1
);
PARAM_DEFINE_INT32
(
MPC_AUTO_MODE
,
1
);
/**
/**
*
Delay from idle state to arming state.
*
Enforced delay between arming and takeoff
*
*
* For altitude controlled modes
,
the t
ransition from
* For altitude controlled modes the t
ime from arming the motors until
*
idle to armed state is delayed by MPC_IDLE_TKO time to ensure
*
a takeoff is possible gets forced to be at least MPC_SPOOLUP_TIME seconds
* t
hat the propellers have
reach
ed
idle speed before
attempting a
* t
o ensure the motors and propellers can sppol up and
reach idle speed before
*
takeoff
. This delay is particularly useful for vehicles
with large
*
getting commanded to spin faster
. This delay is particularly useful for vehicles
* propellers.
*
with slow motor spin-up e.g. because of large
propellers.
*
*
* @min 0
* @min 0
* @max 10
* @max 10
* @unit s
ec
* @unit s
* @group Multicopter Position Control
* @group Multicopter Position Control
*/
*/
PARAM_DEFINE_FLOAT
(
MPC_
IDLE_TKO
,
0
.
0
f
);
PARAM_DEFINE_FLOAT
(
MPC_
SPOOLUP_TIME
,
0
.
0
f
);
/**
/**
* Flag to enable obstacle avoidance
* Flag to enable obstacle avoidance
...
@@ -713,7 +713,7 @@ PARAM_DEFINE_FLOAT(MPC_IDLE_TKO, 0.0f);
...
@@ -713,7 +713,7 @@ PARAM_DEFINE_FLOAT(MPC_IDLE_TKO, 0.0f);
PARAM_DEFINE_INT32
(
MPC_OBS_AVOID
,
0
);
PARAM_DEFINE_INT32
(
MPC_OBS_AVOID
,
0
);
/**
/**
* Yaw mode
.
* Yaw mode
*
*
* Specifies the heading in Auto.
* Specifies the heading in Auto.
*
*
...
...
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