75#define SERVO_MOVE_MIN_A 0.020f
77#define SERVO_MOVE_NOISE_K 3.0f
80#define SERVO_MOVE_BAND_A 0.05f
83#define SERVO_MOVE_TIMEOUT_MS 3000u
85#define SERVO_MOVE_FILTER_MAX 8u
102 SERVO_MOVE_CLIP_NONE = 0,
125 float run_lo, run_hi;
servo_move_state_t
Where a move stands.
Definition servo_move.h:88
@ SERVO_MOVE_SETTLED
Definition servo_move.h:93
@ SERVO_MOVE_IDLE
Definition servo_move.h:89
@ SERVO_MOVE_MOVING
Definition servo_move.h:91
@ SERVO_MOVE_UNSEEN
Definition servo_move.h:96
@ SERVO_MOVE_WAITING
Definition servo_move.h:90
@ SERVO_MOVE_ARRIVED
Definition servo_move.h:92
@ SERVO_MOVE_LATE
Definition servo_move.h:95
uint32_t servo_move_window_ms(uint32_t lag_ms)
SERVO_MOVE_TIMEOUT_MS plus a meter's lag of lag_ms.
Definition servo_move.c:37
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.
Definition servo_move.c:174
bool servo_move_moved(const servo_move_t *m)
Whether movement was seen.
Definition servo_move.c:310
float servo_move_threshold_a(float noise_a)
The threshold for a noise at rest of noise_a.
Definition servo_move.c:24
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 ...
Definition servo_move.c:107
#define SERVO_MOVE_FILTER_MAX
The longest filter.
Definition servo_move.h:85
bool servo_move_arrived(const servo_move_t *m)
Whether the move arrived: ARRIVED or SETTLED.
Definition servo_move.c:305
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 take...
Definition servo_move.c:42
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.
Definition servo_move.c:14
bool servo_move_over(const servo_move_t *m)
Whether the move is over: arrived, settled, late or unseen.
Definition servo_move.c:300
servo_move_clip_t
A sample at the end of the meter's range.
Definition servo_move.h:100
@ SERVO_MOVE_CLIP_LOW
Definition servo_move.h:101
@ SERVO_MOVE_CLIP_HIGH
Definition servo_move.h:103
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,...
Definition servo_move.c:292
Definition servo_move.h:106
uint32_t window_t
Definition servo_move.h:108
float rise_a
Definition servo_move.h:109
float band_a
Definition servo_move.h:112
uint32_t cmd_t
Definition servo_move.h:107
float move_a
Definition servo_move.h:111
uint8_t settle_n
Definition servo_move.h:113
float ref_a
Definition servo_move.h:110
uint8_t filter_n
Definition servo_move.h:114
Definition servo_move.h:118
uint32_t moved_t
Definition servo_move.h:132
float sum
Definition servo_move.h:134
uint32_t end_t
Definition servo_move.h:133
uint32_t run_t
Definition servo_move.h:126
float peak
Definition servo_move.h:139
bool clipped
Definition servo_move.h:140
bool left
Definition servo_move.h:121