45 rvector magfield, magref, magdiff, stablemagfield;
47 float magdiffX,magdiffY,magdiffZ;
48 float stablemagfieldX,stablemagfieldY,stablemagfieldZ;
49 float roll, pitch, yaw;
62 ofstream imu_lastdatapoint;
67 imu_logfile.open (
"imu_log.dat", fstream::in | fstream::out |
fstream::app);
72 iretn = microstrain_connect(
"/dev/ttyOS3");
76 printf(
"Error: microstrain_connect() %d\n",iretn);
82 iretn_mag = microstrain_magfield(handle, &magref);
86 imu_lastdatapoint.open (
"imu_lastdatapoint.dat",ios::trunc);
88 iretn = microstrain_euler_angles(handle, &euler);
92 magX = magfield.
col[0];
93 magY = magfield.
col[1];
94 magZ = magfield.
col[2];
97 iretn_mag = microstrain_magfield(handle, &magfield);
98 iretn_mag = microstrain_stab_accel_rate_magfield(handle,&accel,&rate,&stablemagfield);
101 stablemagfieldX = stablemagfield.
col[0];
102 stablemagfieldY = stablemagfield.
col[1];
103 stablemagfieldZ = stablemagfield.
col[2];
105 magdiff =
rv_sub(magref,magfield);
107 magdiffX = magdiff.
col[0];
108 magdiffY = magdiff.
col[1];
109 magdiffZ = magdiff.
col[2];
112 printf(
"%d: %' '3.2f %' '3.2f %' '3.2f | ",i, roll,pitch,yaw);
113 printf(
"%' '3.5f %' '3.5f %' '3.5f | ", magX,magY,magZ);
115 printf(
"%' '3.2f %' '3.2f %' '3.2f | %f \n", stablemagfieldX,stablemagfieldY,stablemagfieldZ,
length_rv(stablemagfield));
119 imu_lastdatapoint << i <<
"," << roll <<
"," << pitch <<
"," << yaw <<
"\n";
121 imu_lastdatapoint.close();
130 iretn = microstrain_disconnect(handle);
3 element generic row vector
Definition: vector.h:53
int i
Definition: rw_test.cpp:37
double length_rv(rvector v)
Length of row vector.
Definition: vector.cpp:748
int iretn
Definition: rw_test.cpp:37
app
Definition: imu_stream_plot.py:339
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
gige_handle * handle
Definition: kpc9612p_recv.cpp:33
double col[3]
Definition: vector.h:55
double h
Heading.
Definition: vector.h:280
rvector rv_sub(rvector a, rvector b)
Subtract two vectors.
Definition: vector.cpp:315