34 #include <OgreSceneNode.h> 49 , parent_link_name_(joint->parent_link_name)
50 , child_link_name_(joint->child_link_name)
51 , has_decendent_links_with_geometry_(true)
52 , doing_set_checkbox_(false)
66 "Position of this joint, in the current Fixed Frame. (Not editable)",
72 "Orientation of this joint, in the current Fixed Frame. (Not editable)",
76 std::string type =
"";
77 if (joint->type == urdf::Joint::UNKNOWN)
79 else if (joint->type == urdf::Joint::REVOLUTE)
81 else if (joint->type == urdf::Joint::CONTINUOUS)
83 else if (joint->type == urdf::Joint::PRISMATIC)
85 else if (joint->type == urdf::Joint::FLOATING)
87 else if (joint->type == urdf::Joint::PLANAR)
89 else if (joint->type == urdf::Joint::FIXED)
111 if ((type ==
"continuous") || (type ==
"revolute") || (type ==
"prismatic") || (type ==
"planar"))
114 new Property(
"Show Joint Axis",
false,
"Enable/disable showing the axis of this joint.",
118 new VectorProperty(
"Joint Axis", Ogre::Vector3(joint->axis.x, joint->axis.y, joint->axis.z),
125 const urdf::Vector3& pos = joint->parent_to_joint_origin_transform.position;
126 const urdf::Rotation& rot = joint->parent_to_joint_origin_transform.rotation;
143 int links_with_geom_checked;
144 int links_with_geom_unchecked;
145 getChildLinkState(links_with_geom, links_with_geom_checked, links_with_geom_unchecked,
true);
147 std::stringstream desc;
151 if (links_with_geom == 0)
153 desc <<
" This joint's descendents have NO geometry.";
159 desc <<
" Check/uncheck to show/hide all links descended from this joint.";
165 getChildLinkState(links_with_geom, links_with_geom_checked, links_with_geom_unchecked,
false);
166 if (links_with_geom == 0)
168 desc <<
" This joint's child link has NO geometry.";
174 desc <<
" Check/uncheck to show/hide this joint's child link.";
199 if (parent_joint_name.empty())
206 int& links_with_geom_checked,
207 int& links_with_geom_unchecked)
209 links_with_geom_checked = 0;
210 links_with_geom_unchecked = 0;
216 links_with_geom_checked += checked ? 1 : 0;
217 links_with_geom_unchecked += checked ? 0 : 1;
219 links_with_geom = links_with_geom_checked + links_with_geom_unchecked;
223 if (!links_with_geom)
233 std::vector<std::string>::const_iterator child_joint_it = link->
getChildJointNames().begin();
234 std::vector<std::string>::const_iterator child_joint_end = link->
getChildJointNames().end();
235 for (; child_joint_it != child_joint_end; ++child_joint_it)
240 int child_links_with_geom;
241 int child_links_with_geom_checked;
242 int child_links_with_geom_unchecked;
244 child_links_with_geom, child_links_with_geom_checked, child_links_with_geom_unchecked);
245 links_with_geom_checked += child_links_with_geom_checked;
246 links_with_geom_unchecked += child_links_with_geom_unchecked;
249 links_with_geom = links_with_geom_checked + links_with_geom_unchecked;
253 if (!links_with_geom)
266 int& links_with_geom_checked,
267 int& links_with_geom_unchecked,
268 bool recursive)
const 270 links_with_geom_checked = 0;
271 links_with_geom_unchecked = 0;
277 links_with_geom_checked += checked ? 1 : 0;
278 links_with_geom_unchecked += checked ? 0 : 1;
283 std::vector<std::string>::const_iterator child_joint_it = link->
getChildJointNames().begin();
284 std::vector<std::string>::const_iterator child_joint_end = link->
getChildJointNames().end();
285 for (; child_joint_it != child_joint_end; ++child_joint_it)
290 int child_links_with_geom;
291 int child_links_with_geom_checked;
292 int child_links_with_geom_unchecked;
293 child_joint->
getChildLinkState(child_links_with_geom, child_links_with_geom_checked,
294 child_links_with_geom_unchecked, recursive);
295 links_with_geom_checked += child_links_with_geom_checked;
296 links_with_geom_unchecked += child_links_with_geom_unchecked;
301 links_with_geom = links_with_geom_checked + links_with_geom_unchecked;
337 std::vector<std::string>::const_iterator child_joint_it = link->
getChildJointNames().begin();
338 std::vector<std::string>::const_iterator child_joint_end = link->
getChildJointNames().end();
339 for (; child_joint_it != child_joint_end; ++child_joint_it)
357 static int count = 0;
358 std::stringstream ss;
359 ss <<
"Axes for joint " <<
name_ << count++;
383 static int count = 0;
384 std::stringstream ss;
385 ss <<
"Axis for joint " <<
name_ << count++;
407 const Ogre::Quaternion& parent_link_orientation)
409 Ogre::Vector3 position = parent_link_position + parent_link_orientation *
joint_origin_pos_;
void setParentProperty(Property *new_parent)
VectorProperty * axis_property_
const Property * getJointProperty() const
void setOrientation(const Ogre::Quaternion &orientation) override
Set the orientation of the object.
StringProperty * type_property_
void setJointPropertyDescription()
Ogre::Quaternion joint_origin_rot_
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()
Property * getParent() const
Return the parent Property.
void setDirection(const Ogre::Vector3 &direction)
Set the direction of the arrow.
void setPosition(const Ogre::Vector3 &position) override
Set the position of the base 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()
bool hasDescendentLinksWithGeometry() const
void calculateJointCheckboxesRecursive(int &links_with_geom, int &links_with_geom_checked, int &links_with_geom_unchecked)
void setReadOnly(bool read_only) override
Overridden from Property to propagate read-only-ness to children.
Property * joint_property_
virtual Ogre::Vector3 getVector() const
Ogre::Vector3 joint_origin_pos_
void setTransforms(const Ogre::Vector3 &parent_link_position, const Ogre::Quaternion &parent_link_orientation)
Property specialized to enforce floating point max/min.
VectorProperty * position_property_
void setReadOnly(bool read_only) override
Overridden from Property to propagate read-only-ness to children.
virtual void setDescription(const QString &description)
Set the description.
RobotLink * getLink(const std::string &name)
Ogre::SceneNode * getSceneNode()
Get the scene node associated with this arrow.
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.
virtual void setIcon(const QIcon &icon)
Set the icon to be displayed next to the property.
Property * axes_property_
RobotJoint(Robot *robot, const urdf::JointConstSharedPtr &joint)
const std::string & getParentJointName() const
const std::vector< std::string > & getChildJointNames() const
FloatProperty * upper_limit_property_
virtual bool setQuaternion(const Ogre::Quaternion &quaternion)
Ogre::Vector3 getPosition()
void setJointCheckbox(QVariant val)
Property * getLinkProperty() const
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.
void setPosition(const Ogre::Vector3 &position) override
Set the position of this object.
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 int numChildren() const
Return the number of child objects (Property or otherwise).
std::string child_link_name_
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...
virtual void addChild(Property *child, int index=-1)
Add a child property.
RobotJoint * getParentJoint()
An arrow consisting of a cylinder and a cone.
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. Values are in the range [0, 1].
virtual QVariant getValue() const
Return the value of this Property as a QVariant. If the value has never been set, an invalid QVariant...
Ogre::SceneNode * getSceneNode()
Get the scene node associated with this object.
Ogre::Quaternion getOrientation()
void getChildLinkState(int &links_with_geom, int &links_with_geom_checked, int &links_with_geom_unchecked, bool recursive) const
virtual void setReadOnly(bool read_only)
Prevent or allow users to edit this property from a PropertyTreeWidget.
QPixmap loadPixmap(QString url, bool fill_cache)
virtual Ogre::Quaternion getQuaternion() const
bool has_decendent_links_with_geometry_
RobotJoint * getJoint(const std::string &name)