http://answers.gazebosim.org/question/20276/read-imu-sensor-from-a-plugin/



sensors
::SensorManager *pMgr = sensors::SensorManager::Instance() ; if(pMgr == nullptr) { /*ERROR*/ } else { sensors::SensorPtr pSensor = pMgr->GetSensor("imu_sensor"); if(pSensor == nullptr) { /*ERROR*/ } else { sensors::ImuSensorPtr pImuSensor = dynamic_pointer_cast<sensors::ImuSensor, sensors::Sensor>(pSensor); if(pImuSensor == nullptr) { /*ERROR*/ } else { /*Do something ... for example to read the linear accel from the IMU:*/ ignition::math::Vector3d linearAcceleration = m_pImuSensor->LinearAcceleration(); } } }

+ Recent posts