Skip to content

Commit

Permalink
Merge pull request #208 from Jmeyer1292/feature/seperate_joint_limit_…
Browse files Browse the repository at this point in the history
…check

Added a Separate Check For Joint Limits
  • Loading branch information
Jonathan Meyer authored Jan 3, 2018
2 parents e86f96a + 41d8e97 commit c6abb3a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,15 @@ class MoveitStateAdapter : public descartes_core::RobotModel
* called previously in order to enable collision checks, otherwise it will return false.
* @param joint_pose the joint values at which check for collisions will be made
*/
bool isInCollision(const std::vector<double> &joint_pose) const;
bool isInCollision(const std::vector<double>& joint_pose) const;

/**
* @brief Checks to see if the given joint_pose state is inside the bounds for the initialized
* robot model's active joints.
* @param joint_pose The pose to check; should be the same length as your groups active num active joints
* @return true if the @e joint_pose is in bounds, false otherwise
*/
bool isInLimits(const std::vector<double>& joint_pose) const;

/**
* Maximum joint velocities (rad/s) for each joint in the chain. Used for checking in
Expand Down
13 changes: 6 additions & 7 deletions descartes_moveit/src/moveit_state_adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ bool MoveitStateAdapter::isInCollision(const std::vector<double>& joint_pose) co
return in_collision;
}

bool MoveitStateAdapter::isInLimits(const std::vector<double> &joint_pose) const
{
return joint_group_->satisfiesPositionBounds(joint_pose.data());
}

bool MoveitStateAdapter::getFK(const std::vector<double>& joint_pose, Eigen::Affine3d& pose) const
{
bool rtn = false;
Expand Down Expand Up @@ -290,13 +295,7 @@ bool MoveitStateAdapter::isValid(const std::vector<double>& joint_pose) const
return false;
}

// Satisfies joint positional bounds?
if (!joint_group_->satisfiesPositionBounds(joint_pose.data()))
{
return false;
}
// Is in collision (if collision is active)
return !isInCollision(joint_pose);
return isInLimits(joint_pose) && !isInCollision(joint_pose);
}

bool MoveitStateAdapter::isValid(const Eigen::Affine3d& pose) const
Expand Down

0 comments on commit c6abb3a

Please sign in to comment.