23 if (!compass.
init()) {
39 static const uint8_t compass_count = compass.
get_count();
51 for (uint8_t i = 0; i < compass_count; i++) {
69 min[i][0] =
MIN(mag.
x, min[i][0]);
70 min[i][1] =
MIN(mag.
y, min[i][1]);
71 min[i][2] =
MIN(mag.
z, min[i][2]);
74 max[i][0] =
MAX(mag.
x, max[i][0]);
75 max[i][1] =
MAX(mag.
y, max[i][1]);
76 max[i][2] =
MAX(mag.
z, max[i][2]);
79 offset[i][0] = -(max[i][0] + min[i][0]) / 2;
80 offset[i][1] = -(max[i][1] + min[i][1]) / 2;
81 offset[i][2] = -(max[i][2] + min[i][2]) / 2;
85 (
double)
ToDeg(heading),
94 (
double)offset[i][2]);
AP_HAL::UARTDriver * console
static int max(int a, int b)
void set_and_save_offsets(uint8_t i, const Vector3f &offsets)
void from_euler(float roll, float pitch, float yaw)
static auto MAX(const A &one, const B &two) -> decltype(one > two ? one :two)
float calculate_heading(const Matrix3f &dcm_matrix) const
const Vector3f & get_field(uint8_t i) const
Return the current field as a Vector3f in milligauss.
virtual void delay(uint16_t ms)=0
virtual void printf(const char *,...) FMT_PRINTF(2
bool healthy[COMPASS_MAX_INSTANCES]
uint8_t get_count(void) const
void set_declination(float radians, bool save_to_eeprom=true)
#define COMPASS_MAX_INSTANCES
void panic(const char *errormsg,...) FMT_PRINTF(1
static AP_BoardConfig board_config
const AP_HAL::HAL & hal
-*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
AP_HAL::Scheduler * scheduler