Go to the documentation of this file. 1 #include <OgreSceneNode.h>
2 #include <OgreSceneManager.h>
65 M_JointInfo::iterator it =
joints_.find(joint);
77 joints_.insert(std::make_pair(joint, info));
93 new rviz::IntProperty(
"History Length", 1,
"Number of prior measurements to display.",
this,
100 "Name of the parameter to search for to load the robot "
106 "Robot Model normally assumes the link name is the same as the tf frame name. "
107 "This option allows you to set a prefix. Mainly useful for multi-robot situations.",
155 for (
size_t i = 0; i <
visuals_.size(); i++)
192 QString(
"Parameter [%1] does not exist, and was not found by searchParam()")
204 QString(
"Invalid parameter name: %1.\n%2")
226 ROS_ERROR(
"Unable to parse URDF description!");
231 for (std::map<std::string, urdf::JointSharedPtr>::iterator it =
robot_model_->joints_.begin();
234 urdf::JointSharedPtr joint = it->second;
235 if (joint->type == urdf::Joint::REVOLUTE)
237 std::string joint_name = it->first;
238 urdf::JointLimitsSharedPtr
limit = joint->limits;
278 size_t joint_num = msg->name.size();
279 if (joint_num != msg->effort.size())
282 "Received a joint state msg with different joint names and efforts size!");
285 for (
size_t i = 0; i < joint_num; ++i)
287 const std::string& joint_name = msg->name[i];
296 const urdf::Joint* joint =
robot_model_->getJoint(joint_name).get();
297 int joint_type = joint->type;
298 if (joint_type == urdf::Joint::REVOLUTE)
301 Ogre::Quaternion orientation;
302 Ogre::Vector3 position;
308 QString(
"Error transforming from frame '%1' to frame '%2'")
312 tf2::Vector3 axis_joint(joint->axis.x, joint->axis.y, joint->axis.z);
313 tf2::Vector3 axis_z(0, 0, 1);
314 tf2::Quaternion axis_rotation(axis_joint.cross(axis_z), axis_joint.angle(axis_z));
315 if (std::isnan(axis_rotation.x()) || std::isnan(axis_rotation.y()) || std::isnan(axis_rotation.z()))
318 tf2::Quaternion axis_orientation(orientation.x, orientation.y, orientation.z, orientation.w);
320 Ogre::Quaternion joint_orientation(Ogre::Real(axis_rot.w()), Ogre::Real(axis_rot.x()),
321 Ogre::Real(axis_rot.y()), Ogre::Real(axis_rot.z()));
322 visual->setFramePosition(joint_name, position);
323 visual->setFrameOrientation(joint_name, joint_orientation);
324 visual->setFrameEnabled(joint_name, joint_info->
getEnabled());
329 QString(
"Invalid effort: %1").arg(joint_info->
getEffort()));
330 visual->setFrameEnabled(joint_name,
false);
bool isEnabled() const
Return true if this Display is enabled, false if not.
boost::shared_ptr< urdf::Model > robot_model_
std::string concat(const std::string &prefix, const std::string &frame)
static const Quaternion & getIdentity()
virtual void queueRender()=0
Queues a render. Multiple calls before a render happens will only cause a single render.
std::string robot_description_
void incomingMessage(const typename sensor_msgs::JointState ::ConstPtr &msg)
Incoming message callback. Checks if the message pointer is valid, increments messages_received_,...
bool getParam(const std::string &key, bool &b) const
virtual void clearStatuses()
Delete all status children. This is thread-safe.
rviz::IntProperty * history_length_property_
bool validateFloats(const sensor_msgs::CameraInfo &msg)
QString fixed_frame_
A convenience variable equal to context_->getFixedFrame().
virtual QVariant getValue() const
Return the value of this Property as a QVariant. If the value has never been set, an invalid QVariant...
JointInfo(const std::string &name, rviz::Property *parent_category)
virtual Ogre::SceneManager * getSceneManager() const =0
Returns the Ogre::SceneManager used for the main RenderPanel.
Property specialized to enforce floating point max/min.
A single element of a property tree, with a name, value, description, and possibly children.
boost::circular_buffer< boost::shared_ptr< EffortVisual > > visuals_
virtual void setStatus(StatusProperty::Level level, const QString &name, const QString &text)
Show status level and text. This is thread-safe.
std::vector< std::string > V_string
~EffortDisplay() override
void setMaxEffort(double m)
rviz::FloatProperty * max_effort_property_
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
virtual float getFloat() const
rviz::FloatProperty * scale_property_
void reset() override
Called to tell the display to clear its state.
Ogre::SceneNode * scene_node_
The Ogre::SceneNode to hold all 3D scene elements shown by this Display.
Property specialized for string values.
std::string getStdString()
void updateColorAndAlpha()
bool searchParam(const std::string &key, std::string &result) const
rviz::StringProperty * robot_description_property_
void onDisable() override
Derived classes override this to do the actual work of disabling themselves.
Connection registerCallback(const boost::function< void(P)> &callback)
rviz::StringProperty * tf_prefix_property_
virtual FrameManager * getFrameManager() const =0
Return the FrameManager instance.
rviz::Property * joints_category_
rviz::FloatProperty * alpha_property_
void onInitialize() override
bool getTransform(const Header &header, Ogre::Vector3 &position, Ogre::Quaternion &orientation)
Return the pose for a header, relative to the fixed frame, in Ogre classes.
DisplayContext * context_
This DisplayContext pointer is the main connection a Display has into the rest of rviz....
bool setFloat(float new_value)
Float-typed "SLOT" version of setValue().
virtual void setReadOnly(bool read_only)
Prevent or allow users to edit this property from a PropertyTreeWidget.
void processMessage(const sensor_msgs::JointState::ConstPtr &msg) override
tf2_ros::MessageFilter< sensor_msgs::JointState > * tf_filter_
JointInfo * createJoint(const std::string &joint)
void onInitialize() override
Override this function to do subclass-specific initialization.
virtual int getInt() const
Return the internal property value as an integer.
JointInfo * getJointInfo(const std::string &joint)
rviz::FloatProperty * width_property_
rviz::FloatProperty * effort_property_
rviz::Property * category_
void updateHistoryLength()
void onEnable() override
Derived classes override this to do the actual work of enabling themselves.
std::shared_ptr< tf2_ros::Buffer > getTF2BufferPtr() const
Convenience function: returns getFrameManager()->getTF2BufferPtr().
void updateRobotDescription()
ros::NodeHandle update_nh_
A NodeHandle whose CallbackQueue is run from the main GUI thread (the "update" thread).
Property specialized to provide max/min enforcement for integers.
message_filters::Subscriber< sensor_msgs::JointState > sub_
rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust, William Woodall
autogenerated on Fri Dec 13 2024 03:31:02