Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions mote-firmware/src/tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ assign_resources! {
usb: USB
},
left_encoder: LeftEncoderResources{
phase_a: PIN_6,
phase_b: PIN_7,
},
right_encoder: RightEncoderResources{
phase_a: PIN_8,
phase_b: PIN_9,
},
right_encoder: RightEncoderResources{
phase_a: PIN_6,
phase_b: PIN_7,
},
encoder_driver: EncoderDriverResources{
pio: PIO1,
},
drv8833_resources: DRV8833Resources{
left_pwm: PWM_SLICE5,
left_a: PIN_10,
left_b: PIN_11,
right_pwm: PWM_SLICE6,
right_a: PIN_12,
right_b: PIN_13,
left_pwm: PWM_SLICE6,
left_a: PIN_12,
left_b: PIN_13,
right_pwm: PWM_SLICE5,
right_a: PIN_10,
right_b: PIN_11,
sleep: PIN_18,
},
imu: ImuResources{
Expand Down
7 changes: 4 additions & 3 deletions mote-firmware/src/tasks/drive_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ impl<'d, T: SetDutyCycle, P: Instance, const SM: usize> Motor<'d, T, P, SM> {
}

// Update the joint state
self.joint_state.postition_rad = encoder_pulses_to_rad(self.encoder_value);
self.joint_state.velocity_rad_per_s = measurement / dt;
self.joint_state.effort_percent = deadband_adjusted_output;
// Negated to convert rotation direction to right hand coordinate system
self.joint_state.postition_rad = -(encoder_pulses_to_rad(self.encoder_value));
self.joint_state.velocity_rad_per_s = -(measurement / dt);
self.joint_state.effort_percent = -deadband_adjusted_output;
}
}

Expand Down
2 changes: 1 addition & 1 deletion mote-firmware/src/tasks/imu/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const CHIP_ID: u8 = 0x69; // FOR LSM6DS33
const CHIP_ID_TRC: u8 = 0x6A; // FOR LSM6DS3-TRC, DIFFERENT FROM LSM6DS33 WHOAMI

// Earth gravity constant for acceleration conversion
const EARTH_GRAVITY: f32 = -9.80665;
const EARTH_GRAVITY: f32 = 9.80665;

/// 6-DoF IMU accelerometer + gyro
pub struct Lsm6ds3TRC<I2C> {
Expand Down
Loading