|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
Single-servo and two-servo models of a control surface. More...
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. | |
| static float | noise (servo_sim_t *s) |
| Deterministic, so a failing case reproduces. | |
| 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_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. | |
| static bool | approach (float *pos, float target, float reach) |
Move pos toward target by at most reach; true if it arrived. | |
| 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. | |
Single-servo and two-servo models of a control surface.
SPDX-License-Identifier: MIT
|
static |
Move pos toward target by at most reach; true if it arrived.
| pos | Position to move, us. Updated in place. |
| target | Target position, us. |
| reach | Largest move allowed, us. |
|
static |
Deterministic, so a failing case reproduces.
| s | Model state. Advances the noise generator. |
| 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. |