mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-07-27 00:39:59 +08:00
PWM: Add servo center setting & asymetric deflection (#25897)
Add PWM_*_CENTERx for each servo. Use a bilinear transform to map actuator_servos to PWM signals. This solution only works for PWM based servos. Other types of servos are not affected. * PWM: Add servo trim option * PWM: Improve documentation of PWM trim feature * PWM: cleaner clamping and docs typo * update documentation & safety * add migration formula * rename param from trim to center * docs with center instead of trim * move clamping and reorder values * improve documentation * adress failing range check * improve documentation * CA: add event for setting CENTER with TRIM Signed-off-by: Silvan <silvan@auterion.com> --------- Signed-off-by: Silvan <silvan@auterion.com> Co-authored-by: Silvan <silvan@auterion.com>
This commit is contained in:
@@ -159,7 +159,7 @@ The fields are:
|
||||
- `Yaw Torque`: Effectiveness of actuator around yaw axis (normalised: -1 to 1).
|
||||
[Generally you should use the default actuator value](#actuator-roll-pitch-and-yaw-scaling).
|
||||
- `Trim`: An offset added to the actuator so that it is centered without input.
|
||||
This might be determined by trial and error.
|
||||
This might be determined by trial and error. Prefer using the improved `PWM_CENT` instead: [PWM control surfaces](./actuators.md#pwm-control-surfaces-that-move-both-directions-about-a-neutral-point)
|
||||
- <a id="slew_rate"></a>(Advanced) `Slew Rate`: Limits the minimum time in which the motor/servo signal is allowed to pass through its full output range, in seconds.
|
||||
- The setting limits the rate of change of an actuator (if not specified then no rate limit is applied).
|
||||
It is intended for actuators that may be damaged or cause flight disturbance if they move too fast — such as the tilting actuators on a tiltrotor VTOL vehicle, or fast moving flaps, respectively.
|
||||
@@ -535,12 +535,40 @@ If you're using PWM servos, PWM50 is far more common.
|
||||
If a high rate servo is _really_ needed, DShot offers better value.
|
||||
:::
|
||||
|
||||
#### Control surfaces that move both directions about a neutral point
|
||||
##### PWM: Control surfaces that move both directions about a neutral point
|
||||
|
||||
To facilitate setting the neutral point of the servos, a bilinear curve function can be defined using the following parameters `PWM_MAIM_CENTx` / `PWM_AUX_CENTx` for each servo. This allows for unequal deflections in the positive and negative direction:
|
||||

|
||||
|
||||
To set this up:
|
||||
|
||||
1. Set all surface `Trim` to `0.00` for all surfaces:
|
||||
|
||||

|
||||
|
||||
1. Set the `PWM_MAIN_CENTx` / `PWM_AUX_CENTx` value so that the surface will stay at the neutral (aligned with airfoil) position.
|
||||
This is usually around `1500` for PWM servos (near the center of the servo range).
|
||||
|
||||

|
||||
|
||||
2. Gradualy increase the `Maximum` for each servo until the desired deflection is reached. Check the deflection with a remote manual mode while [`COM_PREARM_MODE`](../advanced_config/parameter_reference.md#COM_PREARM_MODE) is set to `Always` or use the sliders.
|
||||
3. Gradualy decrease the `Minimum` for each servo, until the desired deflection is reached.
|
||||
4. Set `Disarmed` value to the desired value. It is usually desirable to have it the same as the `Center` value.
|
||||
|
||||
::: info
|
||||
If you want to retain the linear behaviour of the servo after setting the `Center`, make sure to adjust the `Minimum` or `Maximum`, such that both invervals (`min` to `cent` & `cent` to `max`) are equally lare.
|
||||
|
||||

|
||||
:::
|
||||
|
||||
#### Non-PWM: Control surfaces that move both directions about a neutral point
|
||||
|
||||
Control surfaces that move either direction around a neutral point include: ailerons, elevons, V-tails, A-tails, and rudders.
|
||||
|
||||
To set these up:
|
||||
|
||||
0. Set all `PWM_MAIN_CENTx` and `PWM_AUX_CENTx` to default (-1), or trimming will not be possible.
|
||||
|
||||
1. Set the `Disarmed` value so that the surfaces will stay at neutral position when disarmed.
|
||||
This is usually around `1500` for PWM servos (near the centre of the servo range).
|
||||
|
||||
@@ -559,14 +587,20 @@ To set these up:
|
||||
3. Move the slider again to the middle and check if the Control Surfaces are aligned in the neutral position of the wing.
|
||||
- If it is not aligned, you can set the **Trim** value for the control surface.
|
||||
|
||||
::: info
|
||||
This is done in the `Trim` setting of the Geometry panel, usually by "trial and error".
|
||||

|
||||
:::
|
||||
::: info
|
||||
This is done in the `Trim` setting of the Geometry panel, usually by "trial and error".
|
||||

|
||||
:::
|
||||
|
||||
- After setting the trim for a control surface, move its slider away from the centre, release, and then back into disarmed (middle) position.
|
||||
Confirm that surface is in the neutral position.
|
||||
|
||||
|
||||
|
||||
::: tip
|
||||
If any servo has a `PWM_MAIN_CENTx` or `PWM_AUX_CENTx` not set to default (-1), the system will automatically remove `Trim` from all surfaces. This is done to prevent mixing of old and new trimming tools.
|
||||
:::
|
||||
|
||||
::: info
|
||||
Another way to test without using the sliders would be to set the [`COM_PREARM_MODE`](../advanced_config/parameter_reference.md#COM_PREARM_MODE) parameter to `Always`:
|
||||
|
||||
@@ -575,6 +609,8 @@ Another way to test without using the sliders would be to set the [`COM_PREARM_M
|
||||
|
||||
:::
|
||||
|
||||
|
||||
|
||||
#### Control surfaces that move from neutral to full deflection
|
||||
|
||||
Control surfaces that move only one direction from neutral include: airbrakes, spoilers, and flaps.
|
||||
@@ -585,6 +621,7 @@ For a flap, that is when the flap is fully retracted and flush with the wing.
|
||||
|
||||
One approach for setting these up is:
|
||||
|
||||
0. Set all `PWM_MAIN_CENTx` and `PWM_AUX_CENTx` to default (-1), or trimming will not be possible.
|
||||
1. Set values `Disarmed` to `1500`, `Min` to `1200`, `Max` to `1700` so that the values are around the centre of the servo range.
|
||||
2. Move the corresponding slider up and check the control moves and that it is extending (moving away from the disarmed position).
|
||||
If not, click on the `Rev Range` checkbox to reverse the range.
|
||||
@@ -594,6 +631,7 @@ One approach for setting these up is:
|
||||
- If the value was increased towards `Max`, then set `Max` to match `Disarmed`.
|
||||
4. The value that you did _not_ set to match `Disarmed` controls the maximum amount that the control surface can extend.
|
||||
Set the slider to the top of the control, then change the value (`Max` or `Min`) so that the control surface is fully extended when the slider is at top.
|
||||
5. (Only PWM servos) Set the `Center` value to the middle between `Min` and `Max`.
|
||||
|
||||
::: info Special note for flaps
|
||||
In some vehicle builds, flaps may be configured such that both flaps are controlled from a single output.
|
||||
@@ -631,6 +669,9 @@ For each of the tilt servos:
|
||||
- Standard VTOL : Motors defined as multicopter motors will be turned off
|
||||
- Tiltrotors : Motors that have no associated tilt servo will turn off
|
||||
- Tailsitters do not turn off any motors in fixed-wing flight
|
||||
- The following formula can be used to migrate from surface trim to PWM trim:
|
||||
|
||||
`PWM_MAIN_CENTx = ((PWM_MAX - PWM_MIN) / 2) * CA_SV_CSx_TRIM + PWM_MIN + ((PWM_MAX - PWM_MIN) / 2)`
|
||||
|
||||
### Reversing Motors
|
||||
|
||||
|
||||
Reference in New Issue
Block a user