diff --git a/src/darwin_robot.cpp b/src/darwin_robot.cpp index 428377fc3716a12d1379672f8720979978fc691c..a86060775a42b79987643f3c9124c621f97cc825 100644 --- a/src/darwin_robot.cpp +++ b/src/darwin_robot.cpp @@ -404,9 +404,9 @@ void CDarwinRobot::imu_get_gyro_data(double *x,double *y,double *z) if(this->robot_device==NULL) throw CDarwinRobotException(_HERE_,"Invalid robot device"); this->robot_device->read_registers(IMU_GYRO_X_OFFSET,data,6); - *x=((double)(data[0]+(data[1]<<8)))/1000.0; - *y=((double)(data[2]+(data[3]<<8)))/1000.0; - *z=((double)(data[4]+(data[5]<<8)))/1000.0; + *x=((double)((signed short int)(data[0]+(data[1]<<8))))/1000.0; + *y=((double)((signed short int)(data[2]+(data[3]<<8))))/1000.0; + *z=((double)((signed short int)(data[4]+(data[5]<<8))))/1000.0; } // motion manager interface