MCPcopy Create free account
hub / github.com/CCNYRoboticsLab/imu_tools / processMessage

Method processMessage

rviz_imu_plugin/src/imu_display.cpp:169–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167}
168
169void ImuDisplay::processMessage(const sensor_msgs::msg::Imu::ConstSharedPtr msg)
170{
171 if (!isEnabled()) return;
172
173 ++messages_received_;
174
175 std::stringstream ss;
176 ss << messages_received_ << " messages received";
177 setStatus(rviz_common::properties::StatusProperty::Ok, "Topic",
178 ss.str().c_str());
179
180 Ogre::Quaternion orientation;
181 Ogre::Vector3 position;
182 if (!context_->getFrameManager()->getTransform(
183 msg->header.frame_id, msg->header.stamp, position, orientation))
184 {
185 RVIZ_COMMON_LOG_ERROR_STREAM("Error transforming from frame '"
186 << msg->header.frame_id << "' to frame '"
187 << fixed_frame_.toStdString() << "'");
188 return;
189 }
190
191 if (fixed_frame_orientation_)
192 {
193 /* Display IMU orientation is in the world-fixed frame. */
194 Ogre::Vector3 unused;
195 if (!context_->getFrameManager()->getTransform(
196 context_->getFrameManager()->getFixedFrame(), msg->header.stamp,
197 unused, orientation))
198 {
199 RVIZ_COMMON_LOG_ERROR_STREAM("Error getting fixed frame transform");
200 return;
201 }
202 }
203
204 if (box_enabled_)
205 {
206 box_visual_->setMessage(msg);
207 box_visual_->setFramePosition(position);
208 box_visual_->setFrameOrientation(orientation);
209 box_visual_->show();
210 }
211 if (axes_enabled_)
212 {
213 axes_visual_->setMessage(msg);
214 axes_visual_->setFramePosition(position);
215 axes_visual_->setFrameOrientation(orientation);
216 axes_visual_->show();
217 }
218 if (acc_enabled_)
219 {
220 acc_visual_->setMessage(msg);
221 acc_visual_->setFramePosition(position);
222 acc_visual_->setFrameOrientation(orientation);
223 acc_visual_->show();
224 }
225}
226

Callers

nothing calls this directly

Calls 4

setMessageMethod · 0.45
setFramePositionMethod · 0.45
setFrameOrientationMethod · 0.45
showMethod · 0.45

Tested by

no test coverage detected