该代码用于IMU 数据存储
int imu_fd;
char imu_csv_path[200]={0};
char imu_data[1024]={0};
sprintf(imu_csv_path,"/home/ubuntu/imuData.csv");
imu_fd=open(imu_csv_path,O_RDWR|O_CREAT|O_TRUNC,0777);
int len;
while(1){
imu_adis16505.update();
// printf("%ld %lf %lf %lf %lf %lf %lf %lf\n",imu_adis16505.raw_time,imu_adis16505.gyro[0],imu_adis16505.gyro[1],imu_adis16505.gyro[2],imu_adis16505.accel[0],imu_adis16505.accel[1],imu_adis16505.accel[2],imu_adis16505.temp);
sprintf(imu_data,"%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf\n",imu_adis16505.raw_time/1e9,imu_adis16505.gyro[0],imu_adis16505.gyro[1],imu_adis16505.gyro[2],imu_adis16505.accel[0],imu_adis16505.accel[1],imu_adis16505.accel[2],imu_adis16505.temp);
len = write(imu_fd,imu_data,strlen(imu_data));
if(len != strlen(imu_data)){
perror("write");
}
finish = clock();
double timettt=(double(finish-start)/CLOCKS_PER_SEC) ;
std::cout<<"use time:"<<timettt<<std::endl;
if(timettt>= 30){ //10min
break;
}
}
close(imu_fd);