PX4 Firmware
PX4 Autopilot Software http://px4.io
tests_common.h File Reference
Include dependency graph for tests_common.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void insert_values_around_mean (DataValidator *validator, const float mean, uint32_t count, float *rms_err, uint64_t *timestamp_io)
 Insert a series of samples around a mean value. More...
 
void dump_validator_state (DataValidator *validator)
 Print out the state of a DataValidator. More...
 
void fill_validator_with_samples (DataValidator *validator, const float incr_value, float *value_io, uint64_t *timestamp_io)
 Insert a time series of samples into the validator. More...
 

Function Documentation

◆ dump_validator_state()

void dump_validator_state ( DataValidator validator)

Print out the state of a DataValidator.

Parameters
validator

Definition at line 64 of file tests_common.cpp.

References DataValidator::ERROR_FLAG_NO_DATA, DataValidator::ERROR_FLAG_STALE_DATA, DataValidator::ERROR_FLAG_TIMEOUT, DataValidator::print(), state, and DataValidator::state().

Referenced by test_error_tracking(), test_put(), and test_stale_detector().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fill_validator_with_samples()

void fill_validator_with_samples ( DataValidator validator,
const float  incr_value,
float *  value_io,
uint64_t *  timestamp_io 
)

Insert a time series of samples into the validator.

Parameters
validator
incr_valueThe amount to increment the value by on each iteration
value_io(in/out) in: initial value, out: final value
timestamp_io(in/out) in: initial timestamp, out: final timestamp

Definition at line 77 of file tests_common.cpp.

References equal_value_count, DataValidator::put(), DataValidator::set_equal_value_threshold(), and DataValidator::set_timeout().

Referenced by test_put(), test_sensor_failure(), and test_stale_detector().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ insert_values_around_mean()

void insert_values_around_mean ( DataValidator validator,
const float  mean,
uint32_t  count,
float *  rms_err,
uint64_t *  timestamp_io 
)

Insert a series of samples around a mean value.

Parameters
validatorThe validator under test
meanThe mean value
countThe number of samples to insert in the validator
rms_err(out) calculated rms error of the inserted samples
timestamp_io(in/out) in: start timestamp, out: last timestamp

Definition at line 38 of file tests_common.cpp.

References f(), DataValidator::put(), and matrix::sqrt().

Referenced by test_rms_calculation(), and test_vibration().

Here is the call graph for this function:
Here is the caller graph for this function: