Skip to content
Snippets Groups Projects
Commit 7aecfa29 authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Solved a bug in the function to check if the calibration of the IMU is done:...

Solved a bug in the function to check if the calibration of the IMU is done: it returned the inverse value.
Completed the IMU example.
parent 4cf848c0
No related branches found
No related tags found
No related merge requests found
......@@ -353,10 +353,11 @@ bool CDarwinRobot::imu_is_gyro_cal_done(void)
if(this->robot_device==NULL)
throw CDarwinRobotException(_HERE_,"Invalid robot device");
this->robot_device->read_byte_register(IMU_CONTROL_OFFSET,&status);
std::cout << std::hex << (int)status << std::endl;
if(status&IMU_CALIBRATING)
return true;
else
return false;
else
return true;
}
bool CDarwinRobot::imu_is_accel_detected(void)
......
......@@ -18,6 +18,14 @@ int main(int argc, char *argv[])
std::cout << "found darwin controller" << std::endl;
std::cout << "Number of calibration samples: " << darwin.imu_get_cal_samples() << std::endl;
darwin.imu_start();
std::cout << "Gyroscope detected: " << darwin.imu_is_gyro_detected() << std::endl;
std::cout << "Accelerometer detected: " << darwin.imu_is_accel_detected() << std::endl;
darwin.imu_start_gyro_cal();
while(!darwin.imu_is_gyro_cal_done())
{
std::cout << "calibrating gyro ..." << std::endl;
usleep(100000);
}
for(i=0;i<50;i++)
{
darwin.imu_get_gyro_data(&gyro_x,&gyro_y,&gyro_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