diff --git a/include/openrave/robot.h b/include/openrave/robot.h index 54f4f6c801..37f7991f20 100644 --- a/include/openrave/robot.h +++ b/include/openrave/robot.h @@ -59,6 +59,7 @@ class OPENRAVE_API RobotBase : public KinBody std::string _sBaseLinkName, _sIkChainEndLinkName, _sEffectorLinkName; ///< name of the base and effector links of the robot used to determine the chain Transform _tLocalTool; std::vector _vChuckingDirection; ///< the normal direction to move joints for the hand to grasp something + std::vector _vChuckingDirectionLegacy; ///< _vChuckingDirection comes from the legacy file, e.g. collada. This is only used to keep the value from the legacy file format and to expose this to json for further post processing. Vector _vdirection = Vector(0,0,1); std::string _sIkSolverXMLId; ///< xml id of the IkSolver interface to attach std::vector _vGripperJointNames; ///< names of the gripper joints diff --git a/src/libopenrave-core/colladaparser/colladareader.cpp b/src/libopenrave-core/colladaparser/colladareader.cpp index f150486781..991f24bf25 100644 --- a/src/libopenrave-core/colladaparser/colladareader.cpp +++ b/src/libopenrave-core/colladaparser/colladareader.cpp @@ -3526,6 +3526,7 @@ class ColladaReader : public daeErrorHandler } } manipinfo._vChuckingDirection.push_back((dReal)chucking_direction); + manipinfo._vChuckingDirectionLegacy.push_back((dReal)chucking_direction); } } continue; diff --git a/src/libopenrave/robotmanipulator.cpp b/src/libopenrave/robotmanipulator.cpp index b0ab62274c..ce2c003dc7 100644 --- a/src/libopenrave/robotmanipulator.cpp +++ b/src/libopenrave/robotmanipulator.cpp @@ -29,6 +29,7 @@ void RobotBase::ManipulatorInfo::Reset() _vdirection = Vector(0,0,1); _sIkSolverXMLId.clear(); _vGripperJointNames.clear(); + _vChuckingDirectionLegacy.clear(); _grippername.clear(); _toolChangerConnectedBodyToolName.clear(); _toolChangerLinkName.clear(); @@ -46,6 +47,9 @@ void RobotBase::ManipulatorInfo::SerializeJSON(rapidjson::Value& value, rapidjso orjson::SetJsonValueByKey(value, "effectorLinkName", _sEffectorLinkName, allocator); orjson::SetJsonValueByKey(value, "ikSolverType", _sIkSolverXMLId, allocator); orjson::SetJsonValueByKey(value, "gripperJointNames", _vGripperJointNames, allocator); + if( _vChuckingDirectionLegacy.size() > 0 ) { + orjson::SetJsonValueByKey(value, "chuckingDirections", _vChuckingDirectionLegacy, allocator); + } orjson::SetJsonValueByKey(value, "grippername", _grippername, allocator); orjson::SetJsonValueByKey(value, "toolChangerConnectedBodyToolName", _toolChangerConnectedBodyToolName, allocator); orjson::SetJsonValueByKey(value, "toolChangerLinkName", _toolChangerLinkName, allocator);