Skip to content

Commit

Permalink
Merge pull request #152 from ipab-slmc/wxm-fix-setmodelstate
Browse files Browse the repository at this point in the history
KinematicTree: Fix setModelState (broken in the last ~3 weeks?)
  • Loading branch information
wxmerkt committed Oct 17, 2017
2 parents 11dddcb + c6d1115 commit 262ba43
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion exotica/include/exotica/KinematicTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class KinematicTree : public Uncopyable
void BuildTree(const KDL::Tree& RobotKinematics);
void AddElement(KDL::SegmentMap::const_iterator segment, std::shared_ptr<KinematicElement> parent);
int IsControlled(std::shared_ptr<KinematicElement> Joint);
void UpdateTree(Eigen::VectorXdRefConst x);
void UpdateTree();
void UpdateFK();
void UpdateJ();
void ComputeJ(const KinematicFrame& frame, KDL::Jacobian& J);
Expand Down
16 changes: 8 additions & 8 deletions exotica/src/KinematicTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,18 +447,18 @@ std::shared_ptr<KinematicResponse> KinematicTree::RequestFrames(const Kinematics
void KinematicTree::Update(Eigen::VectorXdRefConst x)
{
if (x.rows() != StateSize) throw_pretty("Wrong state vector size! Got " << x.rows() << " expected " << StateSize);
UpdateTree(x);

for (int i = 0; i < ControlledJoints.size(); i++)
TreeState(ControlledJoints[i]->Id) = x(i);

UpdateTree();
UpdateFK();
if (Flags & KIN_J) UpdateJ();
if (Debug) publishFrames();
}

void KinematicTree::UpdateTree(Eigen::VectorXdRefConst x)
void KinematicTree::UpdateTree()
{
for (int i = 0; i < ControlledJoints.size(); i++)
{
TreeState(ControlledJoints[i]->Id) = x(i);
}
for (std::shared_ptr<KinematicElement> element : Tree)
{
KDL::Frame ParentFrame;
Expand Down Expand Up @@ -744,7 +744,7 @@ void KinematicTree::setModelState(Eigen::VectorXdRefConst x)
{
TreeState(ModelJointsMap.at(ModelJointsNames[i])->Id) = x(i);
}

UpdateTree();
UpdateFK();
if (Flags & KIN_J) UpdateJ();
if (Debug) publishFrames();
Expand All @@ -763,7 +763,7 @@ void KinematicTree::setModelState(std::map<std::string, double> x)
throw_pretty("Robot model does not contain joint '" << joint.first << "'");
}
}

UpdateTree();
UpdateFK();
if (Flags & KIN_J) UpdateJ();
if (Debug) publishFrames();
Expand Down

0 comments on commit 262ba43

Please sign in to comment.