Skip to content

Commit

Permalink
Log a lot of values, makes the FW crash
Browse files Browse the repository at this point in the history
  • Loading branch information
lukash committed Jul 5, 2024
1 parent 4821da1 commit 928ca61
Showing 1 changed file with 111 additions and 0 deletions.
111 changes: 111 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,117 @@ static void reset_vars(data *d) {
atr_reset(&d->atr);
torque_tilt_reset(&d->torque_tilt);

VESC_IF->printf("ahrs_mode: %u", VESC_IF->get_cfg_int(CFG_PARAM_IMU_ahrs_mode));
VESC_IF->printf("sample_rate: %u", VESC_IF->get_cfg_int(CFG_PARAM_IMU_sample_rate));

VESC_IF->printf(
"accel_offset_x: %u",
(uint32_t) (VESC_IF->get_cfg_float(CFG_PARAM_IMU_accel_offset_x) * 1000)
);
VESC_IF->printf(
"accel_offset_y: %u",
(uint32_t) (VESC_IF->get_cfg_float(CFG_PARAM_IMU_accel_offset_y) * 1000)
);
VESC_IF->printf(
"accel_offset_z: %u",
(uint32_t) (VESC_IF->get_cfg_float(CFG_PARAM_IMU_accel_offset_z) * 1000)
);
VESC_IF->printf(
"gyro_offset_x: %u", (uint32_t) (VESC_IF->get_cfg_float(CFG_PARAM_IMU_gyro_offset_x) * 1000)
);
VESC_IF->printf(
"gyro_offset_y: %d", (int32_t) (VESC_IF->get_cfg_float(CFG_PARAM_IMU_gyro_offset_y) * 1000)
);
VESC_IF->printf(
"gyro_offset_z: %u", (uint32_t) (VESC_IF->get_cfg_float(CFG_PARAM_IMU_gyro_offset_z) * 1000)
);

VESC_IF->printf("app_shutdown_mode: %u", VESC_IF->get_cfg_int(CFG_PARAM_app_shutdown_mode));

VESC_IF->printf(
"si_gear_ratio: %u", (uint32_t) (VESC_IF->get_cfg_float(CFG_PARAM_si_gear_ratio) * 1000)
);
VESC_IF->printf(
"si_wheel_diameter: %u",
(uint32_t) (VESC_IF->get_cfg_float(CFG_PARAM_si_wheel_diameter) * 1000)
);
VESC_IF->printf(
"si_battery_ah: %u", (uint32_t) (VESC_IF->get_cfg_float(CFG_PARAM_si_battery_ah) * 1000)
);
VESC_IF->printf(
"si_motor_nl_current: %u",
(uint32_t) (VESC_IF->get_cfg_float(CFG_PARAM_si_motor_nl_current) * 1000)
);

VESC_IF->printf("si_motor_poles: %u", VESC_IF->get_cfg_int(CFG_PARAM_si_motor_poles));
VESC_IF->printf("si_battery_type: %u", VESC_IF->get_cfg_int(CFG_PARAM_si_battery_type));
VESC_IF->printf("si_battery_cells: %u", VESC_IF->get_cfg_int(CFG_PARAM_si_battery_cells));

VESC_IF->set_cfg_int(CFG_PARAM_IMU_ahrs_mode, 2);
VESC_IF->set_cfg_int(CFG_PARAM_IMU_sample_rate, 931);
VESC_IF->set_cfg_float(CFG_PARAM_IMU_accel_offset_x, 0.11);
VESC_IF->set_cfg_float(CFG_PARAM_IMU_accel_offset_y, 0.01);
VESC_IF->set_cfg_float(CFG_PARAM_IMU_accel_offset_z, 0.001);
VESC_IF->set_cfg_float(CFG_PARAM_IMU_gyro_offset_x, -0.2);
VESC_IF->set_cfg_float(CFG_PARAM_IMU_gyro_offset_y, 0.02);
VESC_IF->set_cfg_float(CFG_PARAM_IMU_gyro_offset_z, 0.21);

VESC_IF->set_cfg_int(CFG_PARAM_app_shutdown_mode, 6);

VESC_IF->set_cfg_int(CFG_PARAM_si_motor_poles, 31);
VESC_IF->set_cfg_float(CFG_PARAM_si_gear_ratio, 1.01);
VESC_IF->set_cfg_float(CFG_PARAM_si_wheel_diameter, 244);
VESC_IF->set_cfg_int(CFG_PARAM_si_battery_type, 1);
VESC_IF->set_cfg_int(CFG_PARAM_si_battery_cells, 32);
VESC_IF->set_cfg_float(CFG_PARAM_si_battery_ah, 1234);
VESC_IF->set_cfg_float(CFG_PARAM_si_motor_nl_current, 3);

VESC_IF->printf("ahrs_mode: %u", VESC_IF->get_cfg_int(CFG_PARAM_IMU_ahrs_mode));
VESC_IF->printf("sample_rate: %u", VESC_IF->get_cfg_int(CFG_PARAM_IMU_sample_rate));

VESC_IF->printf(
"accel_offset_x: %u",
(uint32_t) (VESC_IF->get_cfg_float(CFG_PARAM_IMU_accel_offset_x) * 1000)
);
VESC_IF->printf(
"accel_offset_y: %u",
(uint32_t) (VESC_IF->get_cfg_float(CFG_PARAM_IMU_accel_offset_y) * 1000)
);
VESC_IF->printf(
"accel_offset_z: %u",
(uint32_t) (VESC_IF->get_cfg_float(CFG_PARAM_IMU_accel_offset_z) * 1000)
);
VESC_IF->printf(
"gyro_offset_x: %d", (int32_t) (VESC_IF->get_cfg_float(CFG_PARAM_IMU_gyro_offset_x) * 1000)
);
VESC_IF->printf(
"gyro_offset_y: %u", (uint32_t) (VESC_IF->get_cfg_float(CFG_PARAM_IMU_gyro_offset_y) * 1000)
);
VESC_IF->printf(
"gyro_offset_z: %u", (uint32_t) (VESC_IF->get_cfg_float(CFG_PARAM_IMU_gyro_offset_z) * 1000)
);

VESC_IF->printf("app_shutdown_mode: %u", VESC_IF->get_cfg_int(CFG_PARAM_app_shutdown_mode));

VESC_IF->printf(
"si_gear_ratio: %u", (uint32_t) (VESC_IF->get_cfg_float(CFG_PARAM_si_gear_ratio) * 1000)
);
VESC_IF->printf(
"si_wheel_diameter: %u",
(uint32_t) (VESC_IF->get_cfg_float(CFG_PARAM_si_wheel_diameter) * 1000)
);
VESC_IF->printf(
"si_battery_ah: %u", (uint32_t) (VESC_IF->get_cfg_float(CFG_PARAM_si_battery_ah) * 1000)
);
VESC_IF->printf(
"si_motor_nl_current: %u",
(uint32_t) (VESC_IF->get_cfg_float(CFG_PARAM_si_motor_nl_current) * 1000)
);

VESC_IF->printf("si_motor_poles: %u", VESC_IF->get_cfg_int(CFG_PARAM_si_motor_poles));
VESC_IF->printf("si_battery_type: %u", VESC_IF->get_cfg_int(CFG_PARAM_si_battery_type));
VESC_IF->printf("si_battery_cells: %u", VESC_IF->get_cfg_int(CFG_PARAM_si_battery_cells));

// Set values for startup
d->setpoint = d->balance_pitch;
d->setpoint_target_interpolated = d->balance_pitch;
Expand Down

0 comments on commit 928ca61

Please sign in to comment.