COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
microstrain_imu_simple.cpp File Reference
#include <iostream>
#include <time.h>
#include "microstrain_lib.h"
#include "timelib.h"
#include <sys/time.h>
Include dependency graph for microstrain_imu_simple.cpp:

Functions

int main ()
 

Function Documentation

int main ( )
38 {
39 
40  int iretn, handle;
41  avector euler;
42 
43  struct timeval first, last;
44  struct timezone x;
45  float timeDiff;
46  float times[100];
47  float sum;
48  float avg;
49  float stddev;
50 
51  iretn = microstrain_connect("COM1"); //"/dev/ttyOS3"
52 
53  if (iretn < 0)
54  {
55  printf("Error: microstrain_connect() %d\n",iretn);
56  exit (1);
57  }
58 
59  handle = iretn;
60 
61  iretn = microstrain_euler_angles(handle, &euler);
62  printf(" %f %f %f\n",DEGOF(euler.b),DEGOF(euler.e),DEGOF(euler.h));
63  for(int i=0;i<100;i++)
64  {
65  gettimeofday(&first, &x);
66  iretn = microstrain_euler_angles(handle, &euler);
67  gettimeofday(&last, &x);
68  printf("%f %f %f",DEGOF(euler.b),DEGOF(euler.e),DEGOF(euler.h));
69  //timeDiff=elapsed_time(first,last);
70  //times[i]=timeDiff;
71  //sum+=times[i];
72  //printf(" (%f milliseconds)\n", timeDiff);
73  }
74 
75  /*
76  avg=sum/100;
77 
78  for(int j=0;j<100;j++)
79  {
80  stddev+=(times[j]-avg)*(times[j]-avg);
81  }
82 
83  stddev=sqrt(stddev/99);
84  \
85  printf("Sum:%f ms\nAverage:%f ms\nStandard Deviation:%f ms\n", sum, avg, stddev);
86 
87  */
88  iretn = microstrain_disconnect(handle);
89  void cssl_stop();
90 
91 
92  return 0;
93 }
int i
Definition: rw_test.cpp:37
int iretn
Definition: rw_test.cpp:37
double e
Elevation.
Definition: vector.h:282
double b
Bank.
Definition: vector.h:284
3 element attitude vector.
Definition: vector.h:277
#define DEGOF(rad)
Degrees of a Radian value.
Definition: math/constants.h:33
int32_t cssl_stop()
Definition: cssl_lib.cpp:86
x
Definition: inputfile.py:6
gige_handle * handle
Definition: kpc9612p_recv.cpp:33
double h
Heading.
Definition: vector.h:280