34 #include <OgreSceneNode.h> 49 , name_( joint->name )
50 , child_link_name_( joint->child_link_name )
51 , parent_link_name_( joint->parent_link_name )
54 , has_decendent_links_with_geometry_( true )
55 , doing_set_checkbox_( false )
71 "Enable/disable showing the axes of this joint.",
79 "Position of this joint, in the current Fixed Frame. (Not editable)",
85 Ogre::Quaternion::IDENTITY,
86 "Orientation of this joint, in the current Fixed Frame. (Not editable)",
90 std::string type =
"";
91 if (joint->type == urdf::Joint::UNKNOWN)
93 else if (joint->type == urdf::Joint::REVOLUTE)
95 else if (joint->type == urdf::Joint::CONTINUOUS)
97 else if (joint->type == urdf::Joint::PRISMATIC)
99 else if (joint->type == urdf::Joint::FLOATING)
101 else if (joint->type == urdf::Joint::PLANAR)
103 else if (joint->type == urdf::Joint::FIXED)
108 QString::fromStdString(type),
109 "Type of this joint. (Not editable)",
119 joint->limits->lower,
120 "Lower limit of this joint. (Not editable)",
126 joint->limits->upper,
127 "Upper limit of this joint. (Not editable)",
132 if ((type ==
"continuous") || (type ==
"revolute") ||
133 (type ==
"prismatic") || (type ==
"planar"))
138 "Enable/disable showing the axis of this joint.",
145 Ogre::Vector3(joint->axis.x, joint->axis.y, joint->axis.z),
146 "Axis of this joint. (Not editable)",
153 const urdf::Vector3& pos = joint->parent_to_joint_origin_transform.position;
154 const urdf::Rotation& rot = joint->parent_to_joint_origin_transform.rotation;
171 int links_with_geom_checked;
172 int links_with_geom_unchecked;
173 getChildLinkState(links_with_geom, links_with_geom_checked, links_with_geom_unchecked,
true);
175 std::stringstream desc;
177 <<
"Joint <b>" <<
name_ 182 if (links_with_geom == 0)
184 desc <<
" This joint's descendents have NO geometry.";
190 desc <<
" Check/uncheck to show/hide all links descended from this joint.";
196 getChildLinkState(links_with_geom, links_with_geom_checked, links_with_geom_unchecked,
false);
197 if (links_with_geom == 0)
199 desc <<
" This joint's child link has NO geometry.";
205 desc <<
" Check/uncheck to show/hide this joint's child link.";
230 if (parent_joint_name.empty())
237 int& links_with_geom,
238 int& links_with_geom_checked,
239 int& links_with_geom_unchecked)
241 links_with_geom_checked = 0;
242 links_with_geom_unchecked = 0;
248 links_with_geom_checked += checked ? 1 : 0;
249 links_with_geom_unchecked += checked ? 0 : 1;
251 links_with_geom = links_with_geom_checked + links_with_geom_unchecked;
255 if (!links_with_geom)
265 std::vector<std::string>::const_iterator child_joint_it = link->
getChildJointNames().begin();
266 std::vector<std::string>::const_iterator child_joint_end = link->
getChildJointNames().end();
267 for ( ; child_joint_it != child_joint_end ; ++child_joint_it )
272 int child_links_with_geom;
273 int child_links_with_geom_checked;
274 int child_links_with_geom_unchecked;
276 links_with_geom_checked += child_links_with_geom_checked;
277 links_with_geom_unchecked += child_links_with_geom_unchecked;
280 links_with_geom = links_with_geom_checked + links_with_geom_unchecked;
284 if (!links_with_geom)
297 int& links_with_geom,
298 int& links_with_geom_checked,
299 int& links_with_geom_unchecked,
300 bool recursive)
const 302 links_with_geom_checked = 0;
303 links_with_geom_unchecked = 0;
309 links_with_geom_checked += checked ? 1 : 0;
310 links_with_geom_unchecked += checked ? 0 : 1;
315 std::vector<std::string>::const_iterator child_joint_it = link->
getChildJointNames().begin();
316 std::vector<std::string>::const_iterator child_joint_end = link->
getChildJointNames().end();
317 for ( ; child_joint_it != child_joint_end ; ++child_joint_it )
322 int child_links_with_geom;
323 int child_links_with_geom_checked;
324 int child_links_with_geom_unchecked;
325 child_joint->
getChildLinkState(child_links_with_geom, child_links_with_geom_checked, child_links_with_geom_unchecked, recursive);
326 links_with_geom_checked += child_links_with_geom_checked;
327 links_with_geom_unchecked += child_links_with_geom_unchecked;
332 links_with_geom = links_with_geom_checked + links_with_geom_unchecked;
368 std::vector<std::string>::const_iterator child_joint_it = link->
getChildJointNames().begin();
369 std::vector<std::string>::const_iterator child_joint_end = link->
getChildJointNames().end();
370 for ( ; child_joint_it != child_joint_end ; ++child_joint_it )
388 static int count = 0;
389 std::stringstream ss;
390 ss <<
"Axes for joint " <<
name_ << count++;
414 static int count = 0;
415 std::stringstream ss;
416 ss <<
"Axis for joint " <<
name_ << count++;
439 const Ogre::Quaternion& parent_link_orientation )
441 Ogre::Vector3 position = parent_link_position + parent_link_orientation *
joint_origin_pos_;
virtual Ogre::Quaternion getQuaternion() const
void setParentProperty(Property *new_parent)
VectorProperty * axis_property_
StringProperty * type_property_
void setJointPropertyDescription()
Ogre::Quaternion joint_origin_rot_
Property * getParent() const
Return the parent Property.
void updateChildVisibility()
virtual void expand()
Expand (show the children of) this Property.
virtual bool setVector(const Ogre::Vector3 &vector)
void useDetailProperty(bool use_detail)
void hideSubProperties(bool hide)
QuaternionProperty * orientation_property_
Ogre::SceneNode * getOtherNode()
void setDirection(const Ogre::Vector3 &direction)
Set the direction of the arrow.
virtual bool setValue(const QVariant &new_value)
Set the new value for this property. Returns true if the new value is different from the old value...
std::string parent_link_name_
A single element of a property tree, with a name, value, description, and possibly children...
Ogre::SceneManager * getSceneManager()
void calculateJointCheckboxesRecursive(int &links_with_geom, int &links_with_geom_checked, int &links_with_geom_unchecked)
Property * joint_property_
Ogre::Vector3 joint_origin_pos_
void setTransforms(const Ogre::Vector3 &parent_link_position, const Ogre::Quaternion &parent_link_orientation)
virtual void setReadOnly(bool read_only)
Overridden from Property to propagate read-only-ness to children.
Property specialized to enforce floating point max/min.
VectorProperty * position_property_
virtual void setDescription(const QString &description)
Set the description.
RobotLink * getLink(const std::string &name)
virtual int numChildren() const
Return the number of child objects (Property or otherwise).
Ogre::SceneNode * getSceneNode()
Get the scene node associated with this arrow.
virtual void setPosition(const Ogre::Vector3 &position)
Set the position of this object.
Property * takeChild(Property *child)
Remove a given child object and return a pointer to it.
Property * show_axis_property_
virtual void collapse()
Collapse (hide the children of) this Property.
const std::string & getParentJointName() const
virtual void setIcon(const QIcon &icon)
Set the icon to be displayed next to the property.
Property * axes_property_
virtual void setPosition(const Ogre::Vector3 &position)
Set the position of the base of the arrow.
RobotJoint(Robot *robot, const urdf::JointConstSharedPtr &joint)
Property * childAt(int index) const
Return the child Property with the given index, or NULL if the index is out of bounds or if the child...
bool hasDescendentLinksWithGeometry() const
virtual void setReadOnly(bool read_only)
Overridden from Property to propagate read-only-ness to children.
virtual void setColor(float r, float g, float b, float a)
Set the color of this arrow. Sets both the head and shaft color to the same value. Values are in the range [0, 1].
FloatProperty * upper_limit_property_
virtual bool setQuaternion(const Ogre::Quaternion &quaternion)
Property * getLinkProperty() const
virtual void setOrientation(const Ogre::Quaternion &orientation)
Set the orientation.
Ogre::Vector3 getPosition()
void setJointCheckbox(QVariant val)
std::string name_
Name of this joint.
Contains any data we need from a joint in the robot.
void expandDetails(bool expand)
An object that displays a set of X/Y/Z axes, with X=Red, Y=Green, Z=Blue.
Contains any data we need from a link in the robot.
FloatProperty * lower_limit_property_
virtual void setHidden(bool hidden)
Hide or show this property in any PropertyTreeWidget viewing its parent.
Property specialized for string values.
virtual Ogre::Vector3 getVector() const
std::string child_link_name_
const std::vector< std::string > & getChildJointNames() const
const Property * getJointProperty() const
virtual void addChild(Property *child, int index=-1)
Add a child property.
RobotJoint * getParentJoint()
virtual QVariant getValue() const
Return the value of this Property as a QVariant. If the value has never been set, an invalid QVariant...
void getChildLinkState(int &links_with_geom, int &links_with_geom_checked, int &links_with_geom_unchecked, bool recursive) const
An arrow consisting of a cylinder and a cone.
virtual void setOrientation(const Ogre::Quaternion &orientation)
Set the orientation of the object.
Ogre::SceneNode * getSceneNode()
Get the scene node associated with this object.
Ogre::Quaternion getOrientation()
virtual void setReadOnly(bool read_only)
Prevent or allow users to edit this property from a PropertyTreeWidget.
QPixmap loadPixmap(QString url, bool fill_cache)
bool has_decendent_links_with_geometry_
RobotJoint * getJoint(const std::string &name)