| 104 | } |
| 105 | |
| 106 | void MagDisplay::processMessage( |
| 107 | const sensor_msgs::msg::MagneticField::ConstSharedPtr msg) |
| 108 | { |
| 109 | if (!isEnabled()) return; |
| 110 | |
| 111 | ++messages_received_; |
| 112 | |
| 113 | std::stringstream ss; |
| 114 | ss << messages_received_ << " messages received"; |
| 115 | setStatus(rviz_common::properties::StatusProperty::Ok, "Topic", |
| 116 | ss.str().c_str()); |
| 117 | |
| 118 | Ogre::Quaternion orientation; |
| 119 | Ogre::Vector3 position; |
| 120 | if (!context_->getFrameManager()->getTransform( |
| 121 | msg->header.frame_id, msg->header.stamp, position, orientation)) |
| 122 | { |
| 123 | RVIZ_COMMON_LOG_ERROR_STREAM("Error transforming from frame '" |
| 124 | << msg->header.frame_id << "' to frame '" |
| 125 | << fixed_frame_.toStdString() << "'"); |
| 126 | return; |
| 127 | } |
| 128 | |
| 129 | mag_visual_->setMessage(msg); |
| 130 | mag_visual_->setFramePosition(position); |
| 131 | mag_visual_->setFrameOrientation(orientation); |
| 132 | mag_visual_->show(); |
| 133 | } |
| 134 | |
| 135 | void MagDisplay::createProperties() |
| 136 | { |
nothing calls this directly
no test coverage detected