5#define LOG_LOCAL_LEVEL ESP_LOG_INFO
9static const char* TAG =
"orientation_sensor.cpp";
28 uint8_t accel_mag_i2c_addr,
29 uint8_t gyro_i2c_addr) {
38 SensorType::kMagnetometer) &&
40 SensorType::kAccelerometer) &&
44 SensorType::kThermometer) &&
49 ESP_LOGE(TAG,
"Trouble installing sensors.");
53 ESP_LOGI(TAG,
"Sensors connected & Fusion ready");
94static const char SCHEMA[] PROGMEM = R
"###({
98 "title": "Report Interval",
100 "description": "Milliseconds between outputs of this parameter"
103 "title": "Save Magnetic Cal",
105 "description": "Set to 1 to save current magnetic calibration"
112 OrientationValType val_type)
139 if( (throttlePrint_ % 50) == 0 )
140 { ESP_LOGI(TAG,
"Yaw: %f", output);
OrientationSensor represents a 9-Degrees-of-Freedom sensor (magnetometer, accelerometer,...
int GetFusionRateHz(void)
Return how fast we read the physical sensor and run the fusion algorithm.
SensorFusion * sensor_interface_
sensor's Fusion Library interface
void ReadAndProcessSensors(void)
reads sensor hardware and runs fusion algorithm
OrientationSensor(uint8_t pin_i2c_sda, uint8_t pin_i2c_scl, uint8_t accel_mag_i2c_addr, uint8_t gyro_i2c_addr)
Constructor sets up the I2C communications to the sensor and initializes the sensor fusion library.
@ kMagCalFitInUse
fit of currently-used calibration. <3.5 is good.
@ kRateOfTurn
rate of change of compass heading
@ kMagFieldMagnitudeTrial
geomagnetic magnitude based on current readings
@ kCompassHeading
compass heading, also called yaw
@ kYaw
rotation about the vertical axis
@ kMagCalAlgorithmSolver
cal algorithm order used. [0,4,7,10] 10 is best
@ kAccelerationX
acceleration in the stern-to-bow axis
@ kRateOfRoll
rate of change of roll
@ kMagCalFitTrial
fit of candidate calibration. <3.5 is good.
@ kAccelerationZ
acceleration in the down-to-up axis
@ kRateOfPitch
rate of change of pitch
@ kMagNoiseCovariance
deviation of current reading from calibrated geomag sphere
@ kPitch
rotation about the transverse axis
@ kMagFieldMagnitude
geomagnetic magnitude of current calibration
@ kAccelerationY
acceleration in the starboard-to-port axis
@ kRoll
rotation about the longitudinal axis
@ kTemperature
temperature as reported by sensor IC
@ kMagInclination
geomagnetic inclination based on current readings
OrientationValType value_type_
Particular type of orientation parameter supplied.
float ReportValue(void)
fetches current orientation parameter
OrientationSensor * orientation_sensor_
Pointer to the orientation sensor.
int8_t save_mag_cal_
Flag for saving current magnetic calibration.
Orientation sensor interface to SensESP.