Commit f102c6cc authored by Florent Lamiraux's avatar Florent Lamiraux
Browse files

Add link position and name in joints for compatibility with urdf format.

parent c50034b2
......@@ -243,6 +243,40 @@ namespace hpp {
void setLinkedBody (const BodyPtr_t& body);
/// \}
/// \name Compatibility with urdf
///
/// \{
/// Get urdf link position in joint frame
///
/// When parsing urdf models, joint frames are reoriented in order
/// to rotate about their x-axis. For some applications, it is necessary
/// to be able to recover the position of the urdf link attached to
/// the joint.
const Transform3f& linkInJointFrame () const
{
return linkInJointFrame_;
}
/// Set urdf link position in joint frame
void linkInJointFrame (const Transform3f& transform)
{
linkInJointFrame_ = transform;
}
/// Get link name
const std::string& linkName () const
{
return linkName_;
}
/// Set link name
void linkName (const std::string& linkName)
{
linkName_ = linkName;
}
/// \}
/// Display joint
virtual std::ostream& display (std::ostream& os) const;
protected:
......@@ -250,6 +284,7 @@ namespace hpp {
JointConfiguration* configuration_;
mutable Transform3f currentTransformation_;
Transform3f positionInParentFrame_;
Transform3f linkInJointFrame_;
mutable Transform3f T3f_;
/// Mass of this and all descendants
value_type mass_;
......@@ -289,6 +324,7 @@ namespace hpp {
DeviceWkPtr_t robot_;
BodyPtr_t body_;
std::string name_;
std::string linkName_;
std::vector <JointPtr_t> children_;
JointPtr_t parent_;
size_type rankInConfiguration_;
......
......@@ -39,10 +39,12 @@ namespace hpp {
configSize_ (configSize), numberDof_ (numberDof),
initialPosition_ (initialPosition),
robot_ (), body_ (0x0),
name_ (), children_ (), parent_ (0x0), rankInConfiguration_ (-1),
name_ (), linkName_ (), children_ (), parent_ (0x0),
rankInConfiguration_ (-1),
jacobian_ (), rankInParent_ (0)
{
positionInParentFrame_.setIdentity ();
linkInJointFrame_.setIdentity ();
T3f_.setIdentity ();
massCom_.setValue (0);
neutralConfiguration_.resize (configSize);
......@@ -52,10 +54,11 @@ namespace hpp {
Joint::Joint (const Joint& joint) :
configuration_ (joint.configuration_),
positionInParentFrame_ (joint.positionInParentFrame_),
linkInJointFrame_ (joint.linkInJointFrame_),
maximalDistanceToParent_ (joint.maximalDistanceToParent_),
configSize_ (joint.configSize_), numberDof_ (joint.numberDof_),
robot_ (), body_ (joint.body_ ? joint.body_->clone (this) : 0x0),
name_ (joint.name_),
name_ (joint.name_), linkName_ (joint.linkName_),
children_ (), parent_ (), rankInConfiguration_ (-1), rankInVelocity_ (-1),
rankInParent_ (-1)
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment