From 4cf848c0d7c077c5a1c4b161f6ca43536b666cf1 Mon Sep 17 00:00:00 2001
From: Sergi Hernandez Juan <shernand@iri.upc.edu>
Date: Mon, 3 Feb 2020 23:31:08 +0100
Subject: [PATCH] Updated the IMU example to show both gyro and accel data.

---
 src/examples/darwin_imu_test.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/examples/darwin_imu_test.cpp b/src/examples/darwin_imu_test.cpp
index 6d2185b..c516a48 100644
--- a/src/examples/darwin_imu_test.cpp
+++ b/src/examples/darwin_imu_test.cpp
@@ -11,6 +11,7 @@ int main(int argc, char *argv[])
 {
   int i=0;
   double gyro_x,gyro_y,gyro_z;
+  double accel_x,accel_y,accel_z;
 
   try{
     CDarwinRobot darwin("Darwin",robot_device,1000000,0x01,true);
@@ -20,7 +21,8 @@ int main(int argc, char *argv[])
     for(i=0;i<50;i++)
     {
       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);
     }
     darwin.imu_stop();
-- 
GitLab