Commit 54ed6b7f authored by Valenza Florian's avatar Valenza Florian
Browse files

[C++][Python] Added missing setters of Frames exposed in python, addFrame now...

[C++][Python] Added missing setters of Frames exposed in python, addFrame now returns a bool depending on the succes of the insertion of the new frame in the operational_frames vector
parent ab80f1c5
......@@ -123,8 +123,8 @@ namespace se3
const SE3 & getJointToFrameTransform( const std::string & name ) const;
const SE3 & getJointToFrameTransform( Index index ) const;
void addFrame ( const Frame & frame );
void addFrame ( const std::string & name, Index index, const SE3 & placement );
bool addFrame ( const Frame & frame );
bool addFrame ( const std::string & name, Index index, const SE3 & placement );
};
......
......@@ -223,16 +223,26 @@ namespace se3
return operational_frames[index].frame_placement;
}
inline void Model::addFrame ( const Frame & frame )
inline bool Model::addFrame ( const Frame & frame )
{
if( !existFrame(frame.name) )
operational_frames.push_back(frame);nOperationalFrames++;
{
operational_frames.push_back(frame);
nOperationalFrames++;
return true;
}
else
{
return false;
}
}
inline void Model::addFrame ( const std::string & name, Index index, const SE3 & placement)
inline bool Model::addFrame ( const std::string & name, Index index, const SE3 & placement)
{
if( !existFrame(name) )
addFrame(Frame(name, index, placement));
return addFrame(Frame(name, index, placement));
else
return false;
}
......
......@@ -49,16 +49,19 @@ namespace se3
.def(bp::init<const std::string&,Index, const SE3_fx&> ((bp::arg("name"),bp::arg("parent id"), bp::arg("placement")),
"Initialize from name, parent id and placement wrt parent joint."))
.def("name", &FramePythonVisitor::getName)
.def("parent_id", &FramePythonVisitor::getParentId)
.def("placement", &FramePythonVisitor::getPlcaementWrtParentJoint)
.add_property("name", &FramePythonVisitor::getName, &FramePythonVisitor::setName)
.add_property("parent_id", &FramePythonVisitor::getParentId, &FramePythonVisitor::setParentId)
.add_property("placement", &FramePythonVisitor::getPlacementWrtParentJoint, &FramePythonVisitor::getPlacementWrtParentJoint)
;
}
static std::string getName( const Frame & self) { return self.name; }
static void setName(Frame & self, const std::string & name) { self.name = name; }
static Index getParentId( const Frame & self) { return self.parent_id; }
static SE3_fx getPlcaementWrtParentJoint( const Frame & self) { return self.frame_placement; }
static void setParentId(Frame & self, Index & parent_id) { self.parent_id = parent_id; }
static SE3_fx getPlacementWrtParentJoint( const Frame & self) { return self.frame_placement; }
static void setPlacementWrtParentJoint(Frame & self, const SE3_fx & placement) { self.frame_placement = placement; }
static void expose()
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment