From 83c68fc388e4893737a5d15a8c449e61691a9fa5 Mon Sep 17 00:00:00 2001 From: jgvictores Date: Sat, 9 Sep 2023 18:26:00 +0200 Subject: [PATCH] access obj pos --- .../OpenraveYarpIroning.cpp | 73 ++++--------------- 1 file changed, 13 insertions(+), 60 deletions(-) diff --git a/libraries/OpenravePlugins/OpenraveYarpIroning/OpenraveYarpIroning.cpp b/libraries/OpenravePlugins/OpenraveYarpIroning/OpenraveYarpIroning.cpp index fbd1e9a7..63d4a3ff 100644 --- a/libraries/OpenravePlugins/OpenraveYarpIroning/OpenraveYarpIroning.cpp +++ b/libraries/OpenravePlugins/OpenraveYarpIroning/OpenraveYarpIroning.cpp @@ -197,64 +197,20 @@ class OpenraveYarpIroning : public OpenRAVE::ModuleBase, tool.rot = ee.rot; OpenRAVE::Transform tcp = ee * tool; //Transform tcp = ee; - yCInfo(ORYPS) << "TCP at" << tcp.trans.x << tcp.trans.y << tcp.trans.z; + //yCInfo(ORYPS) << "TCP at" << tcp.trans.x << tcp.trans.y << tcp.trans.z; - // Get new object (pen) position - /*T_base_object = _objPtr->GetTransform(); - double T_base_object_x = T_base_object.trans.x; - double T_base_object_y = T_base_object.trans.y; - double T_base_object_z = T_base_object.trans.z;*/ - - // Create new object in the scene "palete" to change brush colours. - - /*OpenRAVE::Transform pos_palete_magenta = _palete_magenta->GetLink("palete-magenta")->GetGeometry(0)->GetTransform(); - OpenRAVE::Transform pos_palete_yellow = _palete_yellow->GetLink("palete-yellow")->GetGeometry(0)->GetTransform(); - OpenRAVE::Transform pos_palete_cyan = _palete_cyan->GetLink("palete-cyan")->GetGeometry(0)->GetTransform();*/ - - // std::cout<<"Base x obj : "<GetName(); + //yCInfo(ORYPS) << _objKinBodyPtrs[objKinBodyIdx]->GetLinks().size(); // 1 + OpenRAVE::KinBody::LinkPtr objLinkPtr = _objKinBodyPtrs[objKinBodyIdx]->GetLinks()[0]; + OpenRAVE::Transform t = objLinkPtr->GetGeometry(0)->GetTransform(); + yCInfo(ORYPS) << t.trans.x << t.trans.y << t.trans.z << "| TCP" << tcp.trans.x << tcp.trans.y << tcp.trans.z; + //double dist = std::sqrt(std::pow(T_base_object.trans.x - tcp.trans.x, 2) + std::pow(T_base_object.trans.y - tcp.trans.y, 2) + std::pow(T_base_object.trans.z - tcp.trans.z, 2)); + + //if(objKinBodyIdx == 0) + // yCInfo(ORYPS) << T_base_object.trans.x << T_base_object.trans.y << T_base_object.trans.z << "| TCP" << tcp.trans.x << tcp.trans.y << tcp.trans.z; + } // Update psqpainted to the new values /*for (int i = 0; i < (sqPainted.size()); i++) @@ -323,9 +279,6 @@ class OpenraveYarpIroning : public OpenRAVE::ModuleBase, std::vector _objKinBodyPtrs; OpenRAVE::RobotBase::ManipulatorPtr _pRobotManip; - OpenRAVE::Transform T_base_object; - OpenRAVE::KinBodyPtr _objPtr; - OpenRAVE::KinBodyPtr _wall; }; #if OPENRAVE_VERSION >= OPENRAVE_VERSION_COMBINED(0, 105, 0)