|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
A servo on a control surface, modelled for the limit search. More...
#include <stdbool.h>#include <stdint.h>Go to the source code of this file.
Data Structures | |
| struct | servo_sim_cfg_t |
| struct | servo_sim_t |
| struct | servo_pair_cfg_t |
| A pair, coupled through the surface they both drive. More... | |
| struct | servo_pair_t |
Functions | |
| void | servo_sim_defaults (servo_sim_cfg_t *cfg) |
| A standard servo on a well-set-up surface, binding at 1150 and 1880 us. | |
| void | servo_sim_init (servo_sim_t *s, const servo_sim_cfg_t *cfg) |
| Start the single-servo model at the middle of its stops. | |
| float | servo_sim_step (servo_sim_t *s, uint16_t cmd_us, uint32_t now_ms) |
Advance the model to now_ms with the servo commanded to cmd_us, and return the current its sensor would report. | |
| void | servo_pair_defaults (servo_pair_cfg_t *cfg, uint16_t centre_us) |
| Defaults for two servos on one surface. | |
| void | servo_pair_init (servo_pair_t *p, const servo_pair_cfg_t *cfg) |
| Start the two-servo model with both servos at the centre. | |
| float | servo_pair_step (servo_pair_t *p, uint16_t cmd_a_us, uint16_t cmd_b_us, uint32_t now_ms) |
Advance both servos to now_ms with the commands given, and return the total current the pair draws. | |
| float | servo_pair_disagreement (const servo_pair_t *p, uint16_t cmd_a_us, uint16_t cmd_b_us) |
| How far apart the two hold the surface, in microseconds. Hardware cannot report this; the search is blind to it and a test may read it. | |
A servo on a control surface, modelled for the limit search.
Not a general servo model. What the limit finder needs is the shape of current against commanded position as the linkage goes from free to bound. The rest exists so the search cannot succeed for the wrong reason: travel takes time, readings are noisy, and a preloaded surface does not draw zero at rest.
As with telemetry_sim: a bench with no hardware fitted runs its procedures end to end, and everything the model produces is marked as simulated. Nothing here decides anything on real hardware.
SPDX-License-Identifier: MIT
| void servo_pair_defaults | ( | servo_pair_cfg_t * | cfg, |
| uint16_t | centre_us ) |
Defaults for two servos on one surface.
| cfg | Configuration to fill. |
| centre_us | Centre pulse width, us. |
| float servo_pair_disagreement | ( | const servo_pair_t * | p, |
| uint16_t | cmd_a_us, | ||
| uint16_t | cmd_b_us ) |
How far apart the two hold the surface, in microseconds. Hardware cannot report this; the search is blind to it and a test may read it.
| p | Model state. |
| cmd_a_us | Commanded pulse width of servo A, us. |
| cmd_b_us | Commanded pulse width of servo B, us. |
| void servo_pair_init | ( | servo_pair_t * | p, |
| const servo_pair_cfg_t * | cfg ) |
Start the two-servo model with both servos at the centre.
| p | Model state to initialise. |
| cfg | Configuration to copy. |
| float servo_pair_step | ( | servo_pair_t * | p, |
| uint16_t | cmd_a_us, | ||
| uint16_t | cmd_b_us, | ||
| uint32_t | now_ms ) |
Advance both servos to now_ms with the commands given, and return the total current the pair draws.
Both servos take time to arrive, which is why this takes a clock: a reading taken before they have arrived is a reading of two servos in transit, not of two servos disagreeing. The settle time separates the two.
| p | Model state. |
| cmd_a_us | Commanded pulse width of servo A, us. |
| cmd_b_us | Commanded pulse width of servo B, us. |
| now_ms | Current time, ms. |
| void servo_sim_defaults | ( | servo_sim_cfg_t * | cfg | ) |
A standard servo on a well-set-up surface, binding at 1150 and 1880 us.
| cfg | Configuration to fill. Does nothing when NULL. |
| void servo_sim_init | ( | servo_sim_t * | s, |
| const servo_sim_cfg_t * | cfg ) |
Start the single-servo model at the middle of its stops.
| s | Model state to initialise. Does nothing when NULL. |
| cfg | Configuration to copy. Does nothing when NULL. |
| float servo_sim_step | ( | servo_sim_t * | s, |
| uint16_t | cmd_us, | ||
| uint32_t | now_ms ) |
Advance the model to now_ms with the servo commanded to cmd_us, and return the current its sensor would report.
| s | Model state. |
| cmd_us | Commanded pulse width, us. |
| now_ms | Current time, ms. |