Go to the documentation of this file.
31 #include <OgreQuaternion.h>
32 #include <OgreSceneNode.h>
33 #include <OgreSceneManager.h>
34 #include <OgreEntity.h>
48 :
MarkerBase(owner, context, parent_node), arrow_(nullptr), last_arrow_set_from_points_(false)
66 ROS_ASSERT(new_message->type == visualization_msgs::Marker::ARROW);
67 ROS_ASSERT(new_message->points.empty() || new_message->points.size() >= 2);
78 Ogre::Vector3 pos, scale;
79 Ogre::Quaternion orient;
80 if (!
transform(new_message, pos, orient, scale))
90 arrow_->
setColor(new_message->color.r, new_message->color.g, new_message->color.b,
91 new_message->color.a);
94 if (new_message->points.size() == 2)
98 Ogre::Vector3 point1(new_message->points[0].x, new_message->points[0].y, new_message->points[0].z);
99 Ogre::Vector3 point2(new_message->points[1].x, new_message->points[1].y, new_message->points[1].z);
101 Ogre::Vector3 direction = point2 - point1;
102 float distance = direction.length();
104 float head_length_proportion =
106 float head_length = head_length_proportion * distance;
107 if (new_message->scale.z != 0.0)
109 float length = new_message->scale.z;
110 head_length = std::max<double>(0.0, std::min<double>(
length, distance));
112 float shaft_length = distance - head_length;
114 arrow_->
set(shaft_length, new_message->scale.x, head_length, new_message->scale.y);
116 direction.normalise();
119 Ogre::Quaternion orient = Ogre::Vector3::NEGATIVE_UNIT_Z.getRotationTo(direction);
134 Ogre::Quaternion orient = Ogre::Vector3::NEGATIVE_UNIT_Z.getRotationTo(Ogre::Vector3(1, 0, 0));
void set(float shaft_length, float shaft_diameter, float head_length, float head_diameter)
Set the parameters for this arrow.
DisplayContext * context_
std::set< Ogre::MaterialPtr > S_MaterialPtr
Displays "markers" sent in by other ROS nodes on the "visualization_marker" topic.
virtual void setPosition(const Ogre::Vector3 &position)
An arrow consisting of a cylinder and a cone.
void setOrientation(const Ogre::Quaternion &orientation) override
Set the orientation.
Ogre::SceneNode * scene_node_
virtual void setOrientation(const Ogre::Quaternion &orientation)
boost::shared_ptr< MarkerSelectionHandler > handler_
virtual Ogre::SceneManager * getSceneManager() const =0
Returns the Ogre::SceneManager used for the main RenderPanel.
void onNewMessage(const MarkerConstPtr &old_message, const MarkerConstPtr &new_message) override
S_MaterialPtr getMaterials() override
bool transform(const MarkerConstPtr &message, Ogre::Vector3 &pos, Ogre::Quaternion &orient, Ogre::Vector3 &scale)
Ogre::Entity * getEntity()
Pure-virtual base class for objects which give Display subclasses context in which to work.
bool last_arrow_set_from_points_
virtual void setDefaultProportions()
std::pair< std::string, int32_t > MarkerID
TFSIMD_FORCE_INLINE tfScalar length(const Quaternion &q)
ArrowMarker(MarkerDisplay *owner, DisplayContext *context, Ogre::SceneNode *parent_node)
void setPosition(const Ogre::Vector3 &position) override
Set the position of the base of the arrow.
Ogre::SceneNode * getSceneNode()
Get the scene node associated with this arrow.
void extractMaterials(Ogre::Entity *entity, S_MaterialPtr &materials)
void setColor(float r, float g, float b, float a) override
Set the color of this arrow. Sets both the head and shaft color to the same value....
visualization_msgs::Marker::ConstPtr MarkerConstPtr
Ogre::SceneNode * child_scene_node_
void setScale(const Ogre::Vector3 &scale) override
Set the scale of the object. Always relative to the identity orientation of the object.
rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust, William Woodall
autogenerated on Fri Dec 13 2024 03:31:02