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

Method setMessage

rviz_imu_plugin/src/imu_orientation_visual.cpp:95–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93}
94
95void 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
127void ImuOrientationVisual::setScaleX(float x)
128{

Callers

nothing calls this directly

Calls 1

setOrientationMethod · 0.45

Tested by

no test coverage detected