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

Method setMessage

rviz_imu_plugin/src/mag_visual.cpp:94–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92}
93
94void MagVisual::setMessage(
95 const sensor_msgs::msg::MagneticField::ConstSharedPtr msg)
96{
97 if (is_2d_)
98 {
99 direction_ = Ogre::Vector3(msg->magnetic_field.x, msg->magnetic_field.y,
100 0.0); // msg->magnetic_field.z);
101 } else
102 {
103 direction_ = Ogre::Vector3(msg->magnetic_field.x, msg->magnetic_field.y,
104 msg->magnetic_field.z);
105 }
106 direction_.normalise();
107 direction_ *= arrow_length_;
108
109 if (heading_vector_)
110 {
111 heading_vector_->setDirection(direction_);
112 heading_vector_->set(arrow_length_ * scale_, arrow_radius_ * scale_,
113 head_length_ * scale_, head_radius_ * scale_);
114 }
115}
116
117void MagVisual::setScale(float scale)
118{

Callers 2

processMessageMethod · 0.45
processMessageMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected