|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
One servo move judged from its current. See servo_move.h for the rules. More...
Functions | |
| float | servo_move_noise_a (uint32_t n, float sum, float sum_sq) |
The standard deviation of n samples given as their sum and the sum of their squares; 0 for none. | |
| float | servo_move_threshold_a (float noise_a) |
The threshold for a noise at rest of noise_a. | |
| uint32_t | servo_move_window_ms (uint32_t lag_ms) |
SERVO_MOVE_TIMEOUT_MS plus a meter's lag of lag_ms. | |
| void | servo_move_begin (servo_move_t *m, const servo_move_cfg_t *cfg) |
| A move begins: commanded at cfg->cmd_t, from cfg->rise_a towards cfg->ref_a. settle_n below 2 is taken as 2; filter_n is held to 1 to SERVO_MOVE_FILTER_MAX. | |
| static bool | under_way (const servo_move_t *m) |
| Tell whether the move is still under way. | |
| static bool | expired (servo_move_t *m, uint32_t now) |
A move under way whose window has run out at now is over: late with movement, unseen without, ended at now. A now before the command decides nothing. Whether it ran out. | |
| static void | filter_push (servo_move_t *m, float a, servo_move_clip_t clip) |
| A sample into the filter's window of the newest filter_n. | |
| void | servo_move_prime (servo_move_t *m, float a, servo_move_clip_t clip) |
| A sample taken before the move began, into the filter only, as the newest so far: a caller that held samples before it knew the command's time hands them over oldest first. Decides nothing; nothing with filter_n 1 or once the move is over. | |
| static bool | filtered (servo_move_t *m, float a, servo_move_clip_t clip, float *out, servo_move_clip_t *out_clip) |
| The filtered sample, from the newest filter_n samples: false when the window holds clips at both ends and so no bound. | |
| static uint8_t | run_with (const servo_move_t *m, float i, float *lo, float *hi) |
The samples in a row near the level with i added: their count, or 1 when i spreads them wider than the band and starts a new run. | |
| servo_move_state_t | servo_move_sample (servo_move_t *m, uint32_t at, float a, servo_move_clip_t clip) |
A sample taken at at: a amps, or for a clip the end of the range it is at or past. | |
| servo_move_state_t | servo_move_tick (servo_move_t *m, uint32_t now) |
The time is now: a move still under way at window_t after its command is over, late or unseen, with end_t at now. A now before the command decides nothing. | |
| bool | servo_move_over (const servo_move_t *m) |
| Whether the move is over: arrived, settled, late or unseen. | |
| bool | servo_move_arrived (const servo_move_t *m) |
| Whether the move arrived: ARRIVED or SETTLED. | |
| bool | servo_move_moved (const servo_move_t *m) |
| Whether movement was seen. | |
One servo move judged from its current. See servo_move.h for the rules.
SPDX-License-Identifier: MIT
|
static |
A move under way whose window has run out at now is over: late with movement, unseen without, ended at now. A now before the command decides nothing. Whether it ran out.
| m | Move state. Updated when the window has run out. |
| now | Current time, in the caller time unit. |
|
static |
A sample into the filter's window of the newest filter_n.
| m | Move state. Updates the filter ring. |
| a | Sample, A. |
| clip | Clip state of the sample. |
|
static |
The filtered sample, from the newest filter_n samples: false when the window holds clips at both ends and so no bound.
| m | Move state. Pushes the sample into the filter. |
| a | Sample, A. |
| clip | Clip state of the sample. |
| out | Out: mean of the filter window, A. |
| out_clip | Out: clip state of the window. |
|
static |
The samples in a row near the level with i added: their count, or 1 when i spreads them wider than the band and starts a new run.
| m | Move state holding the current run. |
| i | Sample to add, A. |
| lo | Out: lowest value of the run, A. |
| hi | Out: highest value of the run, A. |
| bool servo_move_arrived | ( | const servo_move_t * | m | ) |
Whether the move arrived: ARRIVED or SETTLED.
| m | Move state. |
| void servo_move_begin | ( | servo_move_t * | m, |
| const servo_move_cfg_t * | cfg ) |
A move begins: commanded at cfg->cmd_t, from cfg->rise_a towards cfg->ref_a. settle_n below 2 is taken as 2; filter_n is held to 1 to SERVO_MOVE_FILTER_MAX.
| m | Move state to initialise. |
| cfg | Configuration of the move. |
| bool servo_move_moved | ( | const servo_move_t * | m | ) |
Whether movement was seen.
| m | Move state. |
| float servo_move_noise_a | ( | uint32_t | n, |
| float | sum, | ||
| float | sum_sq ) |
The standard deviation of n samples given as their sum and the sum of their squares; 0 for none.
| n | Number of samples. |
| sum | Sum of the samples, A. |
| sum_sq | Sum of the squares of the samples, A^2. |
| bool servo_move_over | ( | const servo_move_t * | m | ) |
Whether the move is over: arrived, settled, late or unseen.
| m | Move state. |
| void servo_move_prime | ( | servo_move_t * | m, |
| float | a, | ||
| servo_move_clip_t | clip ) |
A sample taken before the move began, into the filter only, as the newest so far: a caller that held samples before it knew the command's time hands them over oldest first. Decides nothing; nothing with filter_n 1 or once the move is over.
| m | Move state. |
| a | Sample, A. |
| clip | Clip state of the sample. |
| servo_move_state_t servo_move_sample | ( | servo_move_t * | m, |
| uint32_t | at, | ||
| float | a, | ||
| servo_move_clip_t | clip ) |
A sample taken at at: a amps, or for a clip the end of the range it is at or past.
A sample taken before the command only fills the filter; one at or past window_t after the command ends the move late or unseen, as servo_move_tick() would, and is not judged. Returns the state after it; ARRIVED and SETTLED leave end_t at the arrival. Nothing once the move is over.
| m | Move state. |
| at | Time of the sample, in the caller time unit. |
| a | Sample, A. |
| clip | SERVO_MOVE_CLIP_NONE for a sample; SERVO_MOVE_CLIP_LOW or SERVO_MOVE_CLIP_HIGH when the reading is at the end of its range. |
| float servo_move_threshold_a | ( | float | noise_a | ) |
The threshold for a noise at rest of noise_a.
| noise_a | Noise at rest, A. |
| servo_move_state_t servo_move_tick | ( | servo_move_t * | m, |
| uint32_t | now ) |
The time is now: a move still under way at window_t after its command is over, late or unseen, with end_t at now. A now before the command decides nothing.
| m | Move state. |
| now | Current time, in the caller time unit. |
| uint32_t servo_move_window_ms | ( | uint32_t | lag_ms | ) |
SERVO_MOVE_TIMEOUT_MS plus a meter's lag of lag_ms.
| lag_ms | Lag of the meter readings, ms. |
|
static |
Tell whether the move is still under way.
| m | Move state. |