Skip to content

Commit

Permalink
Update imu.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAditya123 authored Sep 29, 2024
1 parent 54b0736 commit 589bdd7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Sensor/IMU/imu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace sensor {

LSM6DSOX_IMU::LSM6DSOX_IMU(I2C_HandleTypeDef &hi2c)
: gyroscope_(hi2c), accelerometer_(hi2c) {
} //LSM6DSOX_IMU inherits from both Accelerometer and Gyroscope
}

void LSM6DSOX_IMU::Initialize() {
gyroscope_.SetODR(LSM6DSOX_Gyroscope::ODR::ODR104);
Expand Down Expand Up @@ -40,6 +40,7 @@ float* LSM6DSOX_IMU::RadiansPerSecond() {
void LSM6DSOX_IMU::updateSensorData() {
accelerometer_.ComputeAcceleration();
gyroscope_.GetAngularVelocity(); // Use the public wrapper method to access private method

for (int i = 0; i < 3; ++i) {
acceleration_[i] = accelerometer_.GetAcceleration()[i];
angular_velocity_[i] = gyroscope_.DegreesPerSecond()[i] * gyroscope_.GetDegreesToRadians(); // Use the public wrapper method
Expand Down

0 comments on commit 589bdd7

Please sign in to comment.