22 #if MRPT_HAS_INTERSENSE 23 #include "isense/isense.h" 27 #define isense_handles (static_cast<ISD_TRACKER_HANDLE*>(m_handles_ptr)) 31 #if MRPT_HAS_INTERSENSE 35 #pragma comment(lib, "isense.dll") 38 #endif // MRPT_HAS_INTERSENSE 43 CIMUIntersense::CIMUIntersense()
45 m_sensorLabel =
"isenseIMU";
47 #if MRPT_HAS_INTERSENSE 49 new ISD_TRACKER_HANDLE[ISD_MAX_TRACKERS]();
52 "MRPT has been compiled with 'BUILD_INTERSENSE'=OFF, so this class " 60 CIMUIntersense::~CIMUIntersense()
62 #if MRPT_HAS_INTERSENSE 65 m_handles_ptr =
nullptr;
72 void CIMUIntersense::doProcess()
74 #if MRPT_HAS_INTERSENSE 75 if (m_state == ssError)
77 std::this_thread::sleep_for(200ms);
81 if (m_state == ssError)
return;
85 for (
int i = 0; i < m_nSensors; ++i)
89 ISD_TRACKING_DATA_TYPE
data;
92 if (!res_ok)
continue;
97 float nowUI =
data.Station[0].TimeStamp;
103 obs->dataIsPresent[
IMU_YAW] =
true;
107 obs->dataIsPresent[
IMU_ROLL] =
true;
111 data.Station[0].AngularVelBodyFrame[0];
114 data.Station[0].AngularVelBodyFrame[1];
117 data.Station[0].AngularVelBodyFrame[2];
122 data.Station[0].AngularVelNavFrame[0];
125 data.Station[0].AngularVelNavFrame[1];
128 data.Station[0].AngularVelNavFrame[2];
133 data.Station[0].VelocityNavFrame[0];
136 data.Station[0].VelocityNavFrame[1];
139 data.Station[0].VelocityNavFrame[2];
144 data.Station[0].AccelNavFrame[0];
147 data.Station[0].AccelNavFrame[1];
150 data.Station[0].AccelNavFrame[2];
154 obs->rawMeasurements[
IMU_X_ACC] =
data.Station[0].AccelBodyFrame[0];
156 obs->rawMeasurements[
IMU_Y_ACC] =
data.Station[0].AccelBodyFrame[1];
158 obs->rawMeasurements[
IMU_Z_ACC] =
data.Station[0].AccelBodyFrame[2];
175 if (m_timeStartUI == 0)
177 m_timeStartUI = nowUI;
181 AtUI = nowUI - m_timeStartUI;
184 obs->timestamp = m_timeStartTT + std::chrono::microseconds(AtUI * 1e+6);
187 obs->sensorPose = m_sensorPose;
191 appendObservation(obs);
199 if (m_toutCounter > 3)
208 "MRPT has been compiled with 'BUILD_INTERSENSE'=OFF, so this class " 216 void CIMUIntersense::initialize()
218 #if MRPT_HAS_INTERSENSE 220 DWORD openSuccess =
FALSE;
221 cout <<
"Opening trackers... ";
225 cout <<
"ERROR" << endl;
228 cout <<
"DONE" << endl;
230 WORD numOpenTrackers = 0;
231 ISD_NumOpenTrackers(&numOpenTrackers);
232 cout <<
"Number of opened trackers: " << numOpenTrackers << endl;
233 vector<ISD_STATION_INFO_TYPE> station_info(numOpenTrackers);
234 for (
int i = 0; i < ISD_MAX_TRACKERS; ++i)
238 cout <<
"Retrieving configuration from sensor " << i <<
"...";
241 Bool res_ok = ISD_GetStationConfig(
248 cout <<
" ERROR" << endl;
249 cout <<
"Sensor " << i
250 <<
" is working with default configuration!" << endl;
254 cout <<
" DONE" << endl;
262 station_info[i].Sensitivity = m_sensitivity;
263 station_info[i].Enhancement = m_enhancement;
264 station_info[i].Prediction = m_prediction;
265 station_info[i].TimeStamped =
268 cout <<
"Setting configuration to sensor " << i <<
"...";
270 res_ok = ISD_SetStationConfig(
275 res_ok ? cout <<
" DONE" << endl : cout <<
" ERROR" << endl;
277 #if 0 // set ring buffer to avoid data loss and start it: 279 if( station_info[i].State == 1 )
281 if(
false && m_useBuffer )
289 std::this_thread::sleep_for(500ms);
295 cout <<
"Found (and opened) " << m_nSensors <<
" sensors." << endl;
296 m_state = ssInitializing;
300 "MRPT has been compiled with 'BUILD_INTERSENSE'=OFF, so this class " 308 void CIMUIntersense::loadConfig_sensorSpecific(
312 m_sensorPose.setFromValues(
313 configSource.
read_float(iniSection,
"pose_x", 0,
false),
314 configSource.
read_float(iniSection,
"pose_y", 0,
false),
315 configSource.
read_float(iniSection,
"pose_z", 0,
false),
321 configSource.
read_int(iniSection,
"sensitivity", m_sensitivity,
false);
323 configSource.
read_int(iniSection,
"enhancement", m_enhancement,
false);
325 configSource.
read_int(iniSection,
"prediction", m_prediction,
false);
327 configSource.
read_bool(iniSection,
"useBuffer", m_useBuffer,
false);
330 cout <<
"---------------------------" << endl;
331 cout <<
"Intersense IMU parameters: " << endl;
332 cout <<
"---------------------------" << endl;
333 cout <<
"Sensitivity: " << m_sensitivity << endl;
334 cout <<
"Enhancement: " << m_enhancement << endl;
335 cout <<
"Prediction: " << m_prediction << endl;
336 cout <<
"Use buffer: " << m_useBuffer << endl;
337 cout << m_sensorPose << endl;
338 cout <<
"---------------------------" << endl << endl;
x-axis acceleration (global/navigation frame) (m/sec2)
z-axis acceleration (global/navigation frame) (m/sec2)
yaw angular velocity (global/navigation frame) (rad/sec)
#define THROW_EXCEPTION(msg)
double DEG2RAD(const double x)
Degrees to radians.
orientation pitch absolute value (global/navigation frame) (rad)
A class for interfacing Intersense Inertial Measuring Units (IMUs).
mrpt::system::TTimeStamp now()
A shortcut for system::getCurrentTime.
Contains classes for various device interfaces.
float read_float(const std::string §ion, const std::string &name, float defaultValue, bool failIfNotFound=false) const
y-axis acceleration (local/vehicle frame) (m/sec2)
z-axis acceleration (local/vehicle frame) (m/sec2)
x-axis velocity (global/navigation frame) (m/sec)
int read_int(const std::string §ion, const std::string &name, int defaultValue, bool failIfNotFound=false) const
roll angular velocity (global/navigation frame) (rad/sec)
#define ASSERT_(f)
Defines an assertion mechanism.
pitch angular velocity (local/vehicle frame) (rad/sec)
This class allows loading and storing values and vectors of different types from a configuration text...
This namespace contains representation of robot actions and observations.
pitch angular velocity (global/navigation frame) (rad/sec)
GLsizei const GLchar ** string
#define IMPLEMENTS_GENERIC_SENSOR(class_name, NameSpace)
This must be inserted in all CGenericSensor classes implementation files:
bool read_bool(const std::string §ion, const std::string &name, bool defaultValue, bool failIfNotFound=false) const
y-axis acceleration (global/navigation frame) (m/sec2)
std::string std::string to_string(T v)
Just like std::to_string(), but with an overloaded version for std::string arguments.
orientation yaw absolute value (global/navigation frame) (rad)
y-axis velocity (global/navigation frame) (m/sec)
orientation roll absolute value (global/navigation frame) (rad)
yaw angular velocity (local/vehicle frame) (rad/sec)
roll angular velocity (local/vehicle frame) (rad/sec)
GLsizei GLsizei GLenum GLenum const GLvoid * data
x-axis acceleration (local/vehicle frame) (m/sec2)
z-axis velocity (global/navigation frame) (m/sec)