diff --git a/src/JointAxis.cc b/src/JointAxis.cc index 5f21686d5..b508ca818 100644 --- a/src/JointAxis.cc +++ b/src/JointAxis.cc @@ -107,7 +107,8 @@ Errors JointAxis::Load(ElementPtr _sdf) if (_sdf->HasElement("xyz")) { using gz::math::Vector3d; - auto errs = this->SetXyz(_sdf->Get("xyz", Vector3d::UnitZ).first); + auto errs = this->SetXyz(_sdf->Get("xyz", + this->dataPtr->xyz).first); std::copy(errs.begin(), errs.end(), std::back_inserter(errors)); auto e = _sdf->GetElement("xyz"); if (e->HasAttribute("expressed_in")) @@ -130,12 +131,14 @@ Errors JointAxis::Load(ElementPtr _sdf) { sdf::ElementPtr dynElement = _sdf->GetElement("dynamics"); - this->dataPtr->damping = dynElement->Get("damping", 0.0).first; - this->dataPtr->friction = dynElement->Get("friction", 0.0).first; - this->dataPtr->springReference = - dynElement->Get("spring_reference", 0.0).first; - this->dataPtr->springStiffness = - dynElement->Get("spring_stiffness", 0.0).first; + this->dataPtr->damping = dynElement->Get("damping", + this->dataPtr->damping).first; + this->dataPtr->friction = dynElement->Get("friction", + this->dataPtr->friction).first; + this->dataPtr->springReference = dynElement->Get("spring_reference", + this->dataPtr->springReference).first; + this->dataPtr->springStiffness = dynElement->Get("spring_stiffness", + this->dataPtr->springStiffness).first; } // Load limit values @@ -143,16 +146,18 @@ Errors JointAxis::Load(ElementPtr _sdf) { sdf::ElementPtr limitElement = _sdf->GetElement("limit"); - const double kInf = std::numeric_limits::infinity(); - this->dataPtr->lower = limitElement->Get("lower", -kInf).first; - this->dataPtr->upper = limitElement->Get("upper", kInf).first; - this->dataPtr->effort = limitElement->Get("effort", kInf).first; - this->dataPtr->maxVelocity = limitElement->Get( - "velocity", kInf).first; - this->dataPtr->stiffness = limitElement->Get( - "stiffness", 1e8).first; - this->dataPtr->dissipation = limitElement->Get( - "dissipation", 1.0).first; + this->dataPtr->lower = limitElement->Get("lower", + this->dataPtr->lower).first; + this->dataPtr->upper = limitElement->Get("upper", + this->dataPtr->upper).first; + this->dataPtr->effort = limitElement->Get("effort", + this->dataPtr->effort).first; + this->dataPtr->maxVelocity = limitElement->Get("velocity", + this->dataPtr->maxVelocity).first; + this->dataPtr->stiffness = limitElement->Get("stiffness", + this->dataPtr->stiffness).first; + this->dataPtr->dissipation = limitElement->Get("dissipation", + this->dataPtr->dissipation).first; } else {