40 usingTopic(getProperty<std::string>(
"IMUTopicName").getValue());
47 if (getProperty<bool>(
"EnableVisualization").getValue())
49 offeringTopic(getProperty<std::string>(
"DebugDrawerTopic").getValue());
55 if (getProperty<bool>(
"EnableVisualization").getValue())
57 debugDrawerPrx = getTopic<DebugDrawerInterfacePrx>(getProperty<std::string>(
"DebugDrawerTopic").getValue());
63 if (getProperty<bool>(
"EnableVisualization").getValue())
65 debugDrawerPrx->removePoseVisu(
"IMU",
"orientation");
66 debugDrawerPrx->removeLineVisu(
"IMU",
"acceleration");
71 const std::string& device,
const std::string& name,
const IMUData&
values,
72 const TimestampBasePtr& timestamp,
const Ice::Current&)
74 std::unique_lock lock(dataMutex);
87 if (
values.acceleration.size() > 0)
91 offerValue(device,
"acceleration", acceleration);
93 if (
values.gyroscopeRotation.size() > 0)
97 offerValue(device,
"gyroscopeRotation", gyroscopeRotation);
99 if (
values.magneticRotation.size() > 0)
103 offerValue(device,
"magneticRotation", magneticRotation);
105 if (
values.orientationQuaternion.size() > 0)
108 orientationQuaternion =
new Quaternion(
values.orientationQuaternion.at(0),
values.orientationQuaternion.at(1),
values.orientationQuaternion.at(2),
values.orientationQuaternion.at(3));
109 offerOrUpdateDataField(device,
"orientationQuaternion", orientationQuaternion,
"orientation quaternion values");
117 if (orientationQuaternion && acceleration && getProperty<bool>(
"EnableVisualization").getValue())
119 Eigen::Vector3f zero;
128 Eigen::Vector3f ac = acceleration->toEigen();
131 debugDrawerPrx->setLineVisu(
"IMU",
"acceleration",
new Vector3(),
new Vector3(ac), 2.0f, color);
133 PosePtr posePtr =
new Pose(orientationQuaternion->toEigen(), zero);
134 debugDrawerPrx->setPoseVisu(
"IMU",
"orientation", posePtr);
139 void InertialMeasurementUnitObserver::offerValue(
const std::string& device,
const std::string& fieldName,
const Vector3Ptr& vec)