diff --git a/SimDynamics/DynamicsWorld.cpp b/SimDynamics/DynamicsWorld.cpp index 16ca3e20d5bae8396bc24ae6d4d63bce4cfdbf1a..ee67afd882860a72c1c94fca73b90aade02c20bf 100644 --- a/SimDynamics/DynamicsWorld.cpp +++ b/SimDynamics/DynamicsWorld.cpp @@ -104,9 +104,9 @@ namespace SimDynamics return factory->createObject(o); } - void DynamicsWorld::createFloorPlane(const Eigen::Vector3f& pos /*= Eigen::Vector3f(0,0,0)*/, const Eigen::Vector3f& up /*= Eigen::Vector3f(0,0,1.0f)*/) + void DynamicsWorld::createFloorPlane(const Eigen::Vector3f& pos /*= Eigen::Vector3f(0,0,0)*/, const Eigen::Vector3f& up /*= Eigen::Vector3f(0,0,1.0f)*/, float friction) { - engine->createFloorPlane(pos, up); + engine->createFloorPlane(pos, up, friction); } bool DynamicsWorld::addRobot(DynamicsRobotPtr r) diff --git a/SimDynamics/DynamicsWorld.h b/SimDynamics/DynamicsWorld.h index b247cd1fe53a192e15667962e34845b63bc558c4..1b6b8f4ab51cac2310b2a458ebabf47c503fe4f6 100644 --- a/SimDynamics/DynamicsWorld.h +++ b/SimDynamics/DynamicsWorld.h @@ -94,7 +94,7 @@ namespace SimDynamics \param pos The displacement \param up The up vector. Currently supported: (+/-1,0,0), (0,+/-1,0) or (0,0,+/-1). */ - void createFloorPlane(const Eigen::Vector3f& pos = Eigen::Vector3f(0, 0, 0), const Eigen::Vector3f& up = Eigen::Vector3f(0, 0, 1.0f)); + void createFloorPlane(const Eigen::Vector3f& pos = Eigen::Vector3f(0, 0, 0), const Eigen::Vector3f& up = Eigen::Vector3f(0, 0, 1.0f), float friction = -1); /*! Since VirtualRobot usually uses MM and most physics engines like M, the models are automatically converted if this bool is set. diff --git a/VirtualRobot/IK/ConstrainedHierarchicalIK.cpp b/VirtualRobot/IK/ConstrainedHierarchicalIK.cpp index 7dbfeda6eb230a58c851f124bd9c930f51af8e27..02b44dc9eb9a89b3884d82d09991c46b0f6f1827 100644 --- a/VirtualRobot/IK/ConstrainedHierarchicalIK.cpp +++ b/VirtualRobot/IK/ConstrainedHierarchicalIK.cpp @@ -41,10 +41,17 @@ bool ConstrainedHierarchicalIK::solveStep() // Check if any of the hard constraints has increased error for (auto & constraint : constraints) { - if (hardConstraints[constraint] && (constraint->getErrorDifference() < -raiseEpsilon)) + if (hardConstraints[constraint]) { - VR_INFO << "Constrained IK failed due to error raise for hard constraint " << std::endl; - return false; + auto diff = constraint->getErrorDifference(); + if (diff < -raiseEpsilon) + { + VR_INFO << "Constrained IK failed due to error raise for hard constraint. " + << "hardConstraints[constraint]" << hardConstraints[constraint] + << " getErrorDifference()=" << diff + << " raiseEpsilon=" << raiseEpsilon << std::endl; + return false; + } } } diff --git a/VirtualRobot/IK/ConstrainedIK.cpp b/VirtualRobot/IK/ConstrainedIK.cpp index 5dea2473803001f5c3087ca836a1220cfb09c141..0613fd9be8c1f57438e9e8dc0a8ab153b3789595 100644 --- a/VirtualRobot/IK/ConstrainedIK.cpp +++ b/VirtualRobot/IK/ConstrainedIK.cpp @@ -116,6 +116,7 @@ bool ConstrainedIK::solve(bool stepwise) if (hardConstraints[constraint] && !constraint->checkTolerances()) { goalReached = false; + break; } } @@ -134,6 +135,7 @@ bool ConstrainedIK::solve(bool stepwise) } } + VR_INFO << "A hard contraints failed to me the tolerance criterion after the maximum number of iterations" << std::endl; running = false; return false; } diff --git a/VirtualRobot/RobotNodeSet.cpp b/VirtualRobot/RobotNodeSet.cpp index f59d3ccad3acc3d4102bc41fd8d243c744a980d4..76896d7f574be99c541631b3d94edca044599710 100644 --- a/VirtualRobot/RobotNodeSet.cpp +++ b/VirtualRobot/RobotNodeSet.cpp @@ -30,8 +30,10 @@ namespace VirtualRobot if (!isKinematicRoot(this->kinematicRoot)) { - VR_WARNING << "RobotNodeSet " << name << " initialized with invalid kinematic root '" << kinematicRoot->getName() << "': Falling back to robot root node" << endl; this->kinematicRoot = rob->getRootNode(); + VR_WARNING << "RobotNodeSet " << name << " initialized with invalid kinematic root '" + << kinematicRoot->getName() << "': Falling back to robot root node '" + << this->kinematicRoot->getName() << "'" << endl; } if (!tcp && robotNodes.size() > 0)