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
0ca6f46e
Commit
0ca6f46e
authored
9 years ago
by
Lorenz Meier
Browse files
Options
Downloads
Patches
Plain Diff
IO: Allow to pre-arm the non-throttle channels with the safety switch
parent
8bb9707f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/modules/px4iofirmware/mixer.cpp
+18
-8
18 additions, 8 deletions
src/modules/px4iofirmware/mixer.cpp
with
18 additions
and
8 deletions
src/modules/px4iofirmware/mixer.cpp
+
18
−
8
View file @
0ca6f46e
...
...
@@ -62,6 +62,7 @@ extern "C" {
* Maximum interval in us before FMU signal is considered lost
*/
#define FMU_INPUT_DROP_LIMIT_US 500000
#define NAN_VALUE (0.0f/0.0f)
/* current servo arm/disarm state */
static
bool
mixer_servos_armed
=
false
;
...
...
@@ -243,12 +244,12 @@ mixer_tick(void)
in_mixer
=
false
;
/* the pwm limit call takes care of out of band errors */
pwm_limit_calc
(
should_arm
,
mixed
,
r_setup_pwm_reverse
,
r_page_servo_disarmed
,
r_page_servo_control_min
,
r_page_servo_control_max
,
outputs
,
r_page_servos
,
&
pwm_limit
);
pwm_limit_calc
(
should_arm
,
should_arm_nothrottle
,
mixed
,
r_setup_pwm_reverse
,
r_page_servo_disarmed
,
r_page_servo_control_min
,
r_page_servo_control_max
,
outputs
,
r_page_servos
,
&
pwm_limit
);
/* clamp unused outputs to zero */
for
(
unsigned
i
=
mixed
;
i
<
PX4IO_SERVO_COUNT
;
i
++
)
{
r_page_servos
[
i
]
=
0
;
outputs
[
i
]
=
0
;
outputs
[
i
]
=
0
.0
f
;
}
/* store normalized outputs */
...
...
@@ -369,7 +370,14 @@ mixer_callback(uintptr_t handle,
}
}
/* motor spinup phase or only safety off, but not armed - lock throttle to zero */
/* limit output */
if
(
control
>
1.0
f
)
{
control
=
1.0
f
;
}
else
if
(
control
<
-
1.0
f
)
{
control
=
-
1.0
f
;
}
/* motor spinup phase - lock throttle to zero */
if
((
pwm_limit
.
state
==
PWM_LIMIT_STATE_RAMP
)
||
(
should_arm_nothrottle
&&
!
should_arm
))
{
if
(
control_group
==
actuator_controls_s
::
GROUP_INDEX_ATTITUDE
&&
control_index
==
actuator_controls_s
::
INDEX_THROTTLE
)
{
...
...
@@ -380,11 +388,13 @@ mixer_callback(uintptr_t handle,
}
}
/* limit output */
if
(
control
>
1.0
f
)
{
control
=
1.0
f
;
}
else
if
(
control
<
-
1.0
f
)
{
control
=
-
1.0
f
;
/* only safety off, but not armed - set throttle as invalid */
if
(
should_arm_nothrottle
&&
!
should_arm
)
{
if
(
control_group
==
actuator_controls_s
::
GROUP_INDEX_ATTITUDE
&&
control_index
==
actuator_controls_s
::
INDEX_THROTTLE
)
{
/* mark the throttle as invalid */
control
=
NAN_VALUE
;
}
}
return
0
;
...
...
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