Skip to content
Snippets Groups Projects
Commit 637a115e authored by darwin's avatar darwin
Browse files

Solved a problem with the sign of the accelerometer sensor.

Chnaged the sign of the X axis of the gyroscope sensor.
parent 58aa3e4e
No related branches found
No related tags found
2 merge requests!5Dynamixel manager,!2Smart charger fw
......@@ -258,7 +258,7 @@ void imu_accel_convert_data(uint8_t *data_in,uint8_t *data_out)
for(i=0;i<3;i++)
{
accel_data[i]=(data_in[i*2]+(data_in[i*2+1]<<8));
accel_data[i]=(int16_t)(data_in[i*2]+(data_in[i*2+1]<<8));
data_out[i*2]=accel_data[i]%256;
data_out[i*2+1]=accel_data[i]/256;
}
......
......@@ -149,10 +149,10 @@ void manager_balance(void)
manager_balance_offset[R_ANKLE_PITCH]=((((int64_t)gyro_y*(int64_t)ankle_pitch_gain)/12000)>>9);
manager_balance_offset[L_KNEE]=((((int64_t)gyro_y*(int64_t)knee_gain)/12000)>>9);
manager_balance_offset[L_ANKLE_PITCH]=-((((int64_t)gyro_y*(int64_t)ankle_pitch_gain)/12000)>>9);
manager_balance_offset[R_HIP_ROLL]=-((((int64_t)gyro_x*(int64_t)hip_roll_gain)/12000)>>9);
manager_balance_offset[L_HIP_ROLL]=-((((int64_t)gyro_x*(int64_t)hip_roll_gain)/12000)>>9);
manager_balance_offset[R_ANKLE_ROLL]=((((int64_t)gyro_x*(int64_t)ankle_roll_gain)/12000)>>9);
manager_balance_offset[L_ANKLE_ROLL]=((((int64_t)gyro_x*(int64_t)ankle_roll_gain)/12000)>>9);
manager_balance_offset[R_HIP_ROLL]=((((int64_t)gyro_x*(int64_t)hip_roll_gain)/12000)>>9);
manager_balance_offset[L_HIP_ROLL]=((((int64_t)gyro_x*(int64_t)hip_roll_gain)/12000)>>9);
manager_balance_offset[R_ANKLE_ROLL]=-((((int64_t)gyro_x*(int64_t)ankle_roll_gain)/12000)>>9);
manager_balance_offset[L_ANKLE_ROLL]=-((((int64_t)gyro_x*(int64_t)ankle_roll_gain)/12000)>>9);
}
// fall detection (using accelerometer)
imu_get_accel_data(&accel_x,&accel_y,&accel_z);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment