| 93 | } |
| 94 | |
| 95 | void ImuOrientationVisual::setMessage( |
| 96 | const sensor_msgs::msg::Imu::ConstSharedPtr msg) |
| 97 | { |
| 98 | if (checkQuaternionValidity(msg)) |
| 99 | { |
| 100 | if (!quat_valid_) |
| 101 | { |
| 102 | RVIZ_COMMON_LOG_INFO_STREAM( |
| 103 | "rviz_imu_plugin got valid quaternion, " |
| 104 | "displaying true orientation"); |
| 105 | quat_valid_ = true; |
| 106 | } |
| 107 | orientation_ = Ogre::Quaternion(msg->orientation.w, msg->orientation.x, |
| 108 | msg->orientation.y, msg->orientation.z); |
| 109 | } else |
| 110 | { |
| 111 | if (quat_valid_) |
| 112 | { |
| 113 | RVIZ_COMMON_LOG_WARNING_STREAM( |
| 114 | "rviz_imu_plugin got invalid quaternion (" |
| 115 | << msg->orientation.w << "," << msg->orientation.x << "," |
| 116 | << msg->orientation.y << "," << msg->orientation.z |
| 117 | << "will display neutral orientation instead"); |
| 118 | quat_valid_ = false; |
| 119 | } |
| 120 | // if quaternion is invalid, give a unit quat to Ogre |
| 121 | orientation_ = Ogre::Quaternion(); |
| 122 | } |
| 123 | |
| 124 | if (orientation_box_) orientation_box_->setOrientation(orientation_); |
| 125 | } |
| 126 | |
| 127 | void ImuOrientationVisual::setScaleX(float x) |
| 128 | { |
nothing calls this directly
no test coverage detected