| 167 | } |
| 168 | |
| 169 | void 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 |
nothing calls this directly
no test coverage detected