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

Updated the IMU example to show both gyro and accel data.

parent 65a05c0c
No related branches found
No related tags found
No related merge requests found
...@@ -11,6 +11,7 @@ int main(int argc, char *argv[]) ...@@ -11,6 +11,7 @@ int main(int argc, char *argv[])
{ {
int i=0; int i=0;
double gyro_x,gyro_y,gyro_z; double gyro_x,gyro_y,gyro_z;
double accel_x,accel_y,accel_z;
try{ try{
CDarwinRobot darwin("Darwin",robot_device,1000000,0x01,true); CDarwinRobot darwin("Darwin",robot_device,1000000,0x01,true);
...@@ -20,7 +21,8 @@ int main(int argc, char *argv[]) ...@@ -20,7 +21,8 @@ int main(int argc, char *argv[])
for(i=0;i<50;i++) for(i=0;i<50;i++)
{ {
darwin.imu_get_gyro_data(&gyro_x,&gyro_y,&gyro_z); darwin.imu_get_gyro_data(&gyro_x,&gyro_y,&gyro_z);
std::cout << "Gyro: x:" << gyro_x << ", y: " << gyro_y << ", z: " << gyro_z << std::endl; darwin.imu_get_accel_data(&accel_x,&accel_y,&accel_z);
std::cout << "Gyro: x:" << gyro_x << ", y: " << gyro_y << ", z: " << gyro_z << " Accel: x: " << accel_x << ", y: " << accel_y << " , z: " << accel_z << std::endl;
usleep(100000); usleep(100000);
} }
darwin.imu_stop(); darwin.imu_stop();
......
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