Soletta™ Framework
|
#include <limits.h>
#include <errno.h>
#include <sol-iio.h>
#include <sol-log.h>
#include <sol-mainloop.h>
#include <sol-mqtt.h>
#include <math.h>
Data Structures | |
struct | filter_median |
struct | gyro_cal |
struct | iio_gyroscope_data |
Macros | |
#define | DENOISE_MEDIAN |
#define | GYRO_CALIBRATE |
#define | GYRO_DENOISE_MAX_SAMPLES 5 |
#define | GYRO_DENOISE_NUM_FIELDS 3 |
#define | GYRO_DROP_SAMPLES 5 /* Drop first few gyro samples for noisy sensor */ |
#define | GYRO_DS_SIZE 100 |
#define | GYRO_MAX_ERR 0.05 |
Functions | |
static void | clamp_gyro_readings_to_zero (struct gyro_cal *cal_data, double *x, double *y, double *z) |
static void | denoise_median (struct filter_median *filter_data, double *x, double *y, double *z) |
static bool | gyro_collect (struct gyro_cal *cal_data, double x, double y, double z) |
static void | iio_gyroscope_reader_cb (void *data, struct sol_iio_device *device) |
int | main (int argc, char *argv[]) |
static double | median (double *queue, unsigned int size) |
static void | on_connect (void *data, struct sol_mqtt *mqtt) |
static void | on_disconnect (void *data, struct sol_mqtt *mqtt) |
static unsigned int | partition (double *list, unsigned int left, unsigned int right, unsigned int pivot_index) |
static void | reset_calibrate (struct gyro_cal *cal_data) |
static bool | try_reconnect (void *data) |
Variables | |
static struct sol_timeout * | timeout |
#define DENOISE_MEDIAN |
#define GYRO_CALIBRATE |
#define GYRO_DENOISE_MAX_SAMPLES 5 |
Referenced by main().
#define GYRO_DENOISE_NUM_FIELDS 3 |
Referenced by main().
#define GYRO_DROP_SAMPLES 5 /* Drop first few gyro samples for noisy sensor */ |
Referenced by iio_gyroscope_reader_cb().
#define GYRO_DS_SIZE 100 |
Referenced by gyro_collect().
#define GYRO_MAX_ERR 0.05 |
Referenced by gyro_collect().
|
static |
References gyro_cal::calibrated.
Referenced by iio_gyroscope_reader_cb().
|
static |
References filter_median::buff, filter_median::count, filter_median::idx, median(), and filter_median::sample_size.
Referenced by iio_gyroscope_reader_cb().
|
static |
References gyro_cal::bias_x, gyro_cal::bias_y, gyro_cal::bias_z, gyro_cal::count, GYRO_DS_SIZE, GYRO_MAX_ERR, gyro_cal::max_x, gyro_cal::max_y, gyro_cal::max_z, gyro_cal::min_x, gyro_cal::min_y, gyro_cal::min_z, and reset_calibrate().
Referenced by iio_gyroscope_reader_cb().
|
static |
References sol_mqtt_message::api_version, gyro_cal::bias_x, gyro_cal::bias_y, gyro_cal::bias_z, iio_gyroscope_data::cal_data, gyro_cal::calibrated, iio_gyroscope_data::channel_x, iio_gyroscope_data::channel_y, iio_gyroscope_data::channel_z, clamp_gyro_readings_to_zero(), denoise_median(), iio_gyroscope_data::drop_samples_count, iio_gyroscope_data::filter_data, gyro_collect(), GYRO_DROP_SAMPLES, iio_gyroscope_data::mqtt, iio_gyroscope_data::mqtt_topic, sol_mqtt_message::payload, SOL_BUFFER_INIT_CONST, sol_iio_mount_calibration(), sol_iio_read_channel_value(), SOL_INT_CHECK_GOTO, SOL_MQTT_CONNECTED, sol_mqtt_get_connection_status(), SOL_MQTT_MESSAGE_API_VERSION, sol_mqtt_publish(), SOL_MQTT_QOS_EXACTLY_ONCE, SOL_SET_API_VERSION, SOL_WRN, sol_direction_vector::x, sol_direction_vector::y, and sol_direction_vector::z.
Referenced by main().
int main | ( | int | argc, |
char * | argv[] | ||
) |
References sol_iio_config::api_version, sol_mqtt_config::api_version, filter_median::buff, sol_iio_config::buffer_size, iio_gyroscope_data::cal_data, iio_gyroscope_data::channel_x, iio_gyroscope_data::channel_y, iio_gyroscope_data::channel_z, filter_median::count, sol_iio_config::data, iio_gyroscope_data::drop_samples_count, iio_gyroscope_data::filter_data, GYRO_DENOISE_MAX_SAMPLES, GYRO_DENOISE_NUM_FIELDS, sol_mqtt_config::host, filter_median::idx, iio_gyroscope_reader_cb(), iio_gyroscope_data::mqtt, iio_gyroscope_data::mqtt_topic, sol_iio_channel_config::offset, on_connect(), on_disconnect(), sol_mqtt_config::port, reset_calibrate(), filter_median::sample_size, sol_iio_config::sampling_frequency, sol_iio_channel_config::scale, sol_iio_add_channel(), sol_iio_address_device(), SOL_IIO_CHANNEL_CONFIG_INIT, sol_iio_close(), SOL_IIO_CONFIG_API_VERSION, sol_iio_device_start_buffer(), sol_iio_open(), sol_iio_config::sol_iio_reader_cb, sol_init(), SOL_INT_CHECK_GOTO, SOL_MQTT_CONFIG_API_VERSION, sol_mqtt_connect(), sol_mqtt_disconnect(), SOL_MQTT_HANDLERS_API_VERSION, SOL_NULL_CHECK_GOTO, sol_run(), SOL_SET_API_VERSION, sol_shutdown(), sol_timeout_del(), timeout, sol_iio_config::trigger_name, and sol_iio_channel_config::use_custom_offset.
|
static |
References partition().
Referenced by denoise_median().
|
static |
References SOL_INF, SOL_MQTT_CONNECTED, sol_mqtt_get_connection_status(), sol_timeout_add(), SOL_WRN, timeout, and try_reconnect().
Referenced by main().
|
static |
References SOL_INF, sol_timeout_add(), and try_reconnect().
Referenced by main().
|
static |
Referenced by median().
|
static |
References gyro_cal::bias_x, gyro_cal::bias_y, gyro_cal::bias_z, gyro_cal::calibrated, gyro_cal::count, gyro_cal::max_x, gyro_cal::max_y, gyro_cal::max_z, gyro_cal::min_x, gyro_cal::min_y, and gyro_cal::min_z.
Referenced by gyro_collect(), and main().
|
static |
References SOL_INF, and sol_mqtt_reconnect().
Referenced by on_connect(), and on_disconnect().
|
static |
Referenced by main(), and on_connect().