Skip to content

Commit

Permalink
Updated to new id assignments
Browse files Browse the repository at this point in the history
  • Loading branch information
tustvold committed Apr 7, 2017
1 parent 0bdb3f6 commit 213c269
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion external/cusf-messaging
3 changes: 1 addition & 2 deletions gui/Source/Rendering/StateDetailView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ static bool getPacket(const telemetry_t* packet, message_metadata_t metadata) {
mpu9250_update_count++;
}
else if (packet->header.id == ts_ms5611_data) {
FTAssert(packet->header.length == sizeof(ms5611data_t), "Incorrect Packet Size");
auto data = (ms5611data_t*)packet->payload;
auto data = telemetry_get_payload<ms5611data_t>(packet);

values[0] = (float)data->pressure;
values[1] = ms5611_get_altitude(data);
Expand Down
2 changes: 1 addition & 1 deletion shared/src/state/kalman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ void kalman_get_state(state_estimate_t *state) {
state->orientation_q[3] = prior_attitude.w();
}

static_assert(KALMAN_NUM_STATES == (sizeof(((state_estimate_debug_t *)0)->P) / sizeof(float)));
static_assert(KALMAN_NUM_STATES == (sizeof(((state_estimate_debug_t *)0)->P) / sizeof(float)), "KALMAN_NUM_STATES incorrect");

void kalman_get_state_debug(state_estimate_debug_t *state) {
for (int i = 0; i < 3; i++) {
Expand Down
7 changes: 1 addition & 6 deletions shared/src/state/state_estimate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static uint32_t data_timestamp = 0;

MESSAGING_PRODUCER(messaging_producer, ts_state_estimate_data, sizeof(state_estimate_t), 20)
MESSAGING_PRODUCER(messaging_producer_debug, ts_state_estimate_debug, sizeof(state_estimate_debug_t), 20)
MESSAGING_CONSUMER(messaging_consumer, ts_m3imu, ts_m3imu_mask, 0, 0, getPacket, 1024);
MESSAGING_CONSUMER(messaging_consumer, ts_raw_data, ts_raw_data, 0, 0, getPacket, 1024);

void state_estimate_init() {
state_estimate_phase = StateEstimatePhase::Calibration;
Expand Down Expand Up @@ -92,11 +92,6 @@ static bool getPacket(const telemetry_t *packet, message_metadata_t metadata) {
magno_calibration /= (float) NUM_CALIBRATION_SAMPLES;
gyro_calibration /= (float) NUM_CALIBRATION_SAMPLES;

// We correct for the angle disparity between the accelerometer and magnetometer references
float desired_angle = std::acos(accel_reference.dot(magno_reference));
Vector3f rotation_vector = accel_reference.cross(magno_reference);
Vector3f modified_magno_reference = AngleAxisf(desired_angle, rotation_vector) * accel_reference;

const float quest_reference_vectors[2][3] = {
{accel_reference.x(), accel_reference.y(), accel_reference.z()},
{magno_reference.x(), magno_reference.y(), magno_reference.z()}
Expand Down

0 comments on commit 213c269

Please sign in to comment.