30 #include <OgreSceneNode.h> 31 #include <OgreSceneManager.h> 49 const std::string& link_name,
50 const std::string& text,
53 display->
setStatus(level, QString::fromStdString(link_name), QString::fromStdString(text));
57 :
Display(), has_new_transforms_(false), time_since_last_transform_(0.0
f)
60 new Property(
"Visual Enabled",
true,
"Whether to display the visual representation of the robot.",
64 new Property(
"Collision Enabled",
false,
65 "Whether to display the collision representation of the robot.",
this,
69 "Interval at which to update the links, in seconds. " 70 "0 means to update every update cycle.",
81 "Name of the parameter to search for to load the robot description.",
this,
86 "Robot Model normally assumes the link name is the same as the tf frame name. " 87 " This option allows you to set a prefix. Mainly useful for multi-robot situations.",
155 QString(
"Parameter [%1] does not exist, and was not found by searchParam()")
167 QString(
"Invalid parameter name: %1.\n%2")
196 std::stringstream ss;
199 const std::string& err = name_link_pair.second->getGeometryErrors();
201 ss <<
"\n• for link '" << name_link_pair.first <<
"':\n" << err;
205 QString(
"Errors loading geometries:").append(ss.str().c_str()));
virtual void update(const LinkUpdater &updater)
virtual void clear()
Clears all data loaded from a URDF.
void onDisable() override
Derived classes override this to do the actual work of disabling themselves.
const M_NameToLink & getLinks() const
URDF_EXPORT bool initString(const std::string &xmlstring)
Property * collision_enabled_property_
DisplayContext * context_
This DisplayContext pointer is the main connection a Display has into the rest of rviz...
FloatProperty * alpha_property_
ros::NodeHandle update_nh_
A NodeHandle whose CallbackQueue is run from the main GUI thread (the "update" thread).
Property specialized to enforce floating point max/min.
std::string robot_description_
Ogre::SceneNode * scene_node_
The Ogre::SceneNode to hold all 3D scene elements shown by this Display.
Property * visual_enabled_property_
std::string getStdString()
virtual void load(const urdf::ModelInterface &urdf, bool visual=true, bool collision=true)
Loads meshes/primitives from a robot description. Calls clear() before loading.
void fixedFrameChanged() override
Called by setFixedFrame(). Override to respond to changes to fixed_frame_.
void onInitialize() override
Override this function to do subclass-specific initialization.
void reset() override
Called to tell the display to clear its state.
virtual void clearStatuses()
Delete all status children. This is thread-safe.
void setCollisionVisible(bool visible)
Set whether the collision meshes/primitives of the robot should be visible.
virtual void reset()
Called to tell the display to clear its state.
bool getParam(const std::string &key, std::string &s) const
~RobotModelDisplay() override
virtual QString getName() const
Return the name of this Property as a QString.
virtual FrameManager * getFrameManager() const =0
Return the FrameManager instance.
void updateRobotDescription()
void updateVisualVisible()
Property(const QString &name=QString(), const QVariant default_value=QVariant(), const QString &description=QString(), Property *parent=nullptr, const char *changed_slot=nullptr, QObject *receiver=nullptr)
Constructor.
Robot * robot_
Handles actually drawing the robot.
void onEnable() override
Derived classes override this to do the actual work of enabling themselves.
bool searchParam(const std::string &key, std::string &result) const
FloatProperty * update_rate_property_
void linkUpdaterStatusFunction(StatusProperty::Level level, const std::string &link_name, const std::string &text, RobotModelDisplay *display)
Property specialized for string values.
virtual void queueRender()=0
Queues a render. Multiple calls before a render happens will only cause a single render.
bool isEnabled() const
Return true if this Display is enabled, false if not.
virtual float getFloat() const
void setVisualVisible(bool visible)
Set whether the visual meshes of the robot should be visible.
void update(float wall_dt, float ros_dt) override
Called periodically by the visualization manager.
Uses a robot xml description to display the pieces of a robot at the transforms broadcast by rosTF...
virtual QVariant getValue() const
Return the value of this Property as a QVariant. If the value has never been set, an invalid QVariant...
bool initialized() const
Returns true if the display has been initialized.
virtual void load()
Loads a URDF from the ros-param named by our "Robot Description" property, iterates through the links...
virtual void setVisible(bool visible)
Set the robot as a whole to be visible or not.
StringProperty * tf_prefix_property_
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
StringProperty * robot_description_property_
virtual void setStatus(StatusProperty::Level level, const QString &name, const QString &text)
Show status level and text. This is thread-safe.
void updateCollisionVisible()
float time_since_last_transform_