diff --git a/GraspPlanning/ApproachMovementGenerator.cpp b/GraspPlanning/ApproachMovementGenerator.cpp index 4949963730cd0221172af53f97e440ba2856c7d9..0d85c3551a04637fffc51cf210e07595114ad86c 100644 --- a/GraspPlanning/ApproachMovementGenerator.cpp +++ b/GraspPlanning/ApproachMovementGenerator.cpp @@ -13,6 +13,10 @@ using namespace std; namespace GraspStudio { + void ApproachMovementGenerator::setVerbose(bool v) + { + verbose = v; + } ApproachMovementGenerator::ApproachMovementGenerator(VirtualRobot::SceneObjectPtr object, VirtualRobot::EndEffectorPtr eef, const std::string& graspPreshape) : object(object), eef(eef), graspPreshape(graspPreshape) diff --git a/GraspPlanning/ApproachMovementGenerator.h b/GraspPlanning/ApproachMovementGenerator.h index 48b6416e3cadf2cecb148ecbc5854773507e33c1..b96e98fc3548ec613a5835b1d9baf2b4acccb463 100644 --- a/GraspPlanning/ApproachMovementGenerator.h +++ b/GraspPlanning/ApproachMovementGenerator.h @@ -89,6 +89,8 @@ namespace GraspStudio // opens hand by setting the preshape (if defined) or just opening the actors in case no preshape has been defined virtual void openHand(); + void setVerbose(bool v); + protected: @@ -104,6 +106,8 @@ namespace GraspStudio std::string name; std::string graspPreshape; + + bool verbose = false; }; } diff --git a/GraspPlanning/ApproachMovementSurfaceNormal.cpp b/GraspPlanning/ApproachMovementSurfaceNormal.cpp index aa428a57e9163b8eeb2e9673ae85e23763910f0c..a596fe387cf5ea3ed2202a253255c3121f9e7ca9 100644 --- a/GraspPlanning/ApproachMovementSurfaceNormal.cpp +++ b/GraspPlanning/ApproachMovementSurfaceNormal.cpp @@ -62,7 +62,10 @@ namespace GraspStudio storeApproachDir = (objectModel->faces[faceIndex]).normal; if (std::abs(storeApproachDir.squaredNorm() - 1) > 1e-6f) { - std::cout << "Normal in trimesh not normalized! (normalizing it now)\n"; + if (verbose) + { + std::cout << "Normal in trimesh not normalized! (normalizing it now)\n"; + } storeApproachDir.normalize(); } diff --git a/GraspPlanning/GraspPlanner/GenericGraspPlanner.cpp b/GraspPlanning/GraspPlanner/GenericGraspPlanner.cpp index 606c4e81cca13c1ad5907e634f2eec249cd58582..1cb1f8178e55beb38f88d0c02eb9c439e0b9c898 100644 --- a/GraspPlanning/GraspPlanner/GenericGraspPlanner.cpp +++ b/GraspPlanning/GraspPlanner/GenericGraspPlanner.cpp @@ -164,7 +164,10 @@ namespace GraspStudio // low number of contacts: check if it helps to move away (small object) if (retreatOnLowContacts && contacts.size() < 2) { - VR_INFO << "Low number of contacts, retreating hand (might be useful for a small object)" << endl; + if (verbose) + { + VR_INFO << "Low number of contacts, retreating hand (might be useful for a small object)" << endl; + } if (moveEEFAway(approach->getApproachDirGlobal(), 5.0f, 10)) { contacts = eef->closeActors(object); diff --git a/GraspPlanning/MeshConverter.cpp b/GraspPlanning/MeshConverter.cpp index 913b504c6d80cb477c92e516d2e24acef1da1dfc..865047b661ad8db20dde7a4b56ae6a429adcc5b2 100644 --- a/GraspPlanning/MeshConverter.cpp +++ b/GraspPlanning/MeshConverter.cpp @@ -114,7 +114,7 @@ namespace GraspStudio return -1; } - VirtualRobot::ObstaclePtr MeshConverter::RefineObjectSurface(VirtualRobot::ObstaclePtr object, float maxDist) + VirtualRobot::ObstaclePtr MeshConverter::RefineObjectSurface(VirtualRobot::ObstaclePtr object, float maxDist, bool verbose) { VirtualRobot::ObstaclePtr res; @@ -130,7 +130,10 @@ namespace GraspStudio return res; } - VR_INFO << "Processing object with " << tm->faces.size() << " triangles" << endl; + if (verbose) + { + VR_INFO << "Processing object with " << tm->faces.size() << " triangles" << endl; + } // first create new object TriMeshModelPtr triMesh2(new TriMeshModel()); diff --git a/GraspPlanning/MeshConverter.h b/GraspPlanning/MeshConverter.h index c29bc391eb2732447643763cadee4d7dcc991ea5..4f7f1156c934d93c4c84748cdb71e7cab908221d 100644 --- a/GraspPlanning/MeshConverter.h +++ b/GraspPlanning/MeshConverter.h @@ -40,7 +40,7 @@ namespace GraspStudio */ static VirtualRobot::ManipulationObjectPtr CreateManipulationObject(const std::string& name, VirtualRobot::MathTools::ConvexHull3DPtr hull); static VirtualRobot::TriMeshModelPtr CreateTriMeshModel(VirtualRobot::MathTools::ConvexHull3DPtr hull); - static VirtualRobot::ObstaclePtr RefineObjectSurface(VirtualRobot::ObstaclePtr object, float maxDist); + static VirtualRobot::ObstaclePtr RefineObjectSurface(VirtualRobot::ObstaclePtr object, float maxDist, bool verbose = true); //! Returns -1 if obj is not part of vectList, otherwise the index of vectList is returned. static int hasVertex(std::vector< Eigen::Vector3f>& vectList, Eigen::Vector3f& obj);