Skip to content
Snippets Groups Projects
Commit 07cf9be0 authored by Joseph Mirabel's avatar Joseph Mirabel Committed by Joseph Mirabel
Browse files

Device stores the joint list of each objects

parent 2e599238
No related branches found
No related tags found
No related merge requests found
...@@ -37,7 +37,8 @@ namespace hpp { ...@@ -37,7 +37,8 @@ namespace hpp {
class HPP_MANIPULATION_DLLAPI Device : public model::HumanoidRobot, class HPP_MANIPULATION_DLLAPI Device : public model::HumanoidRobot,
public core::Container <HandlePtr_t>, public core::Container <HandlePtr_t>,
public core::Container <model::GripperPtr_t>, public core::Container <model::GripperPtr_t>,
public core::Container <JointAndShapes_t> public core::Container <JointAndShapes_t>,
public core::Container <model::JointVector_t>
{ {
public: public:
typedef model::HumanoidRobot Parent_t; typedef model::HumanoidRobot Parent_t;
...@@ -112,7 +113,7 @@ namespace hpp { ...@@ -112,7 +113,7 @@ namespace hpp {
/// add the current Robot. /// add the current Robot.
/// When creating a robot from several URDF files, this enables /// When creating a robot from several URDF files, this enables
/// collisions between joints from different files. /// collisions between joints from different files.
void didInsertRobot (); void didInsertRobot (const std::string& name);
/// \} /// \}
......
...@@ -171,7 +171,6 @@ namespace hpp { ...@@ -171,7 +171,6 @@ namespace hpp {
struct ObjectDef_t { struct ObjectDef_t {
std::string name; std::string name;
JointPtr_t lastJoint;
StringList_t handles, shapes; StringList_t handles, shapes;
}; };
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
namespace hpp { namespace hpp {
namespace manipulation { namespace manipulation {
void Device::didInsertRobot () void Device::didInsertRobot (const std::string& name)
{ {
if (!didPrepare_) { if (!didPrepare_) {
hppDout (error, "You must call prepareInsertRobot before."); hppDout (error, "You must call prepareInsertRobot before.");
...@@ -34,6 +34,7 @@ namespace hpp { ...@@ -34,6 +34,7 @@ namespace hpp {
/// Build list of new joints /// Build list of new joints
const model::JointVector_t jv = getJointVector (); const model::JointVector_t jv = getJointVector ();
model::JointVector_t newj; model::JointVector_t newj;
newj.reserve (jv.size () - jointCache_.size ());
model::JointVector_t::const_iterator retFind, it1, it2; model::JointVector_t::const_iterator retFind, it1, it2;
for (it1 = jv.begin (); it1 != jv.end (); ++it1) { for (it1 = jv.begin (); it1 != jv.end (); ++it1) {
retFind = find (jointCache_.begin (), jointCache_.end (), *it1); retFind = find (jointCache_.begin (), jointCache_.end (), *it1);
...@@ -50,6 +51,7 @@ namespace hpp { ...@@ -50,6 +51,7 @@ namespace hpp {
} }
} }
jointCache_.clear (); jointCache_.clear ();
add (name, newj);
} }
std::ostream& Device::print (std::ostream& os) const std::ostream& Device::print (std::ostream& os) const
{ {
......
...@@ -871,8 +871,9 @@ namespace hpp { ...@@ -871,8 +871,9 @@ namespace hpp {
} }
} }
// Create object lock // Create object lock
for (JointPtr_t oj = od.lastJoint; using model::JointVector_t;
oj != NULL; oj = oj->parentJoint ()) { assert (robot.has <JointVector_t> (od.name));
BOOST_FOREACH (const JointPtr_t& oj, robot.get<JointVector_t> (od.name)) {
LockedJointPtr_t lj = core::LockedJoint::create (oj, LockedJointPtr_t lj = core::LockedJoint::create (oj,
robot.currentConfiguration() robot.currentConfiguration()
.segment (oj->rankInConfiguration (), oj->configSize ())); .segment (oj->rankInConfiguration (), oj->configSize ()));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment