-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inverse Kinematics Service update #18
Conversation
656aea7
to
00e835c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks mostly there.
@@ -0,0 +1,12 @@ | |||
robot_config: | |||
joint_config: | |||
joint_acceleration_limit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there anyway of specifying units here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep! Comments are supported. Will do
std::unique_ptr<KDL::ChainIdSolver_RNE> gravity_solver; | ||
std::unique_ptr<sns_ik::SNS_IK> ik_solver; | ||
/*std::unique_ptr<KDL::ChainFDSolverTau> fk_eff_solver; TODO(imcmahon) | ||
std::unique_ptr<KDL::ChainIkSolverVel_pinv> ik_solver_vel; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A velocity IK solver should be simple to add via SNS, or did you want to save this for future work.
std::unique_ptr<sns_ik::SNS_IK> ik_solver; | ||
/*std::unique_ptr<KDL::ChainFDSolverTau> fk_eff_solver; TODO(imcmahon) | ||
std::unique_ptr<KDL::ChainIkSolverVel_pinv> ik_solver_vel; | ||
std::unique_ptr<KDL::ChainIkSolverPos_NR_JL> ik_solver_pos;*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SHS IK solver replaces this.
@@ -122,6 +128,11 @@ bool servicePositionIK(intera_core_msgs::SolvePositionIK::Request& req, | |||
*/ | |||
bool computePositionFK(const Kinematics& kin, const KDL::JntArray& jnt_pos, geometry_msgs::Pose& result); | |||
|
|||
bool computePositionIK(const Kinematics& kin, const geometry_msgs::Pose& cart_pose, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There function parameters need to be documented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -20,13 +20,16 @@ | |||
to launching sawyer_world --> | |||
<arg name="load_robot_description" default="true"/> | |||
<param if="$(arg load_robot_description)" name="robot_description" | |||
command="$(find xacro)/xacro --inorder $(find sawyer_description)/urdf/sawyer.urdf.xacro gazebo:=true"/> | |||
command="$(find xacro)/xacro --inorder $(find sawyer_description)/urdf/sawyer.urdf.xacro gazebo:=true electric_gripper:=$(arg electric_gripper)"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check line length.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed.
{ | ||
seed_modes.push_back(req.seed_mode); | ||
} | ||
for(size_t j=0; j<seed_modes.size(); j++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creating a vector for seed_modes is really confusing. There are only two options here, with SEED_AUTO trying both. I feel like there is a better way of structuring this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Restructured the flow on this to be more intuitive, though it will function the same.
else // (req.seed_mode == req.SEED_CURRENT) | ||
{ | ||
std::shared_ptr<const sensor_msgs::JointState> joint_state; | ||
joint_state_buffer_.get(joint_state); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this measured or reference joint states?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are only measured joint states in sim. Though I could consider adding reference.
} | ||
} | ||
|
||
if (!computePositionIK(kinematic_chain_map_[req.tip_names[i]], req.pose_stamp[i].pose, jnt_nullspace_bias, jnt_seed, jnt_result)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check line length
/* if (jointsInCollision(kinematic_chain_map_[req.tip_names[i]], jnt_result)) | ||
{ | ||
res.result_type[i] = res.IK_IN_COLLISION; | ||
} TODO(imcmahon) Utilize FCL for collision checking |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a issue filed for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed: #19
req.seed_angles[i].name.size() == req.seed_angles[i].position.size()) | ||
{ | ||
|
||
jointStatePositionToKDL(req.seed_angles[i], kinematic_chain_map_[req.tip_names[i]], jnt_seed); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only search kinematic_chain_map_ once for req.tip_names[i].
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, this isn't actually a search, but directly accessing the hash of a mapped variable. I can't easily copy this to a variable as most of the contents are stored in a unique_ptr
variable, which cannot be copied without transferring ownership.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Under the hood, getting any element from a map requires a search based on the hash. You might also want to be caution that the [] will create a new element if one doesn't already exist for the desired key.
http://www.cplusplus.com/reference/map/map/operator[]/
You could also store the map iterator if your worried about copying objects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way the code is currently structured, no element is accessed without already existing. It is possible that the code could be misused in the future though. The unique_ptr
s cannot be copied. I'm not particularly inclined to optimize around the hash lookup costs, but I think your iterator idea is an excellent one. I'll explore that thought.
(res.result_type[i] == res.IK_FAILED || res.result_type[i] == res.IK_IN_COLLISION) | ||
) | ||
) | ||
{ | ||
std::shared_ptr<const sensor_msgs::JointState> joint_state; | ||
joint_state_buffer_.get(joint_state); | ||
if (joint_state.get()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Print warning if joint_state doesn't exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
seed_modes.push_back(req.SEED_CURRENT); | ||
} | ||
else | ||
if (req.seed_mode == req.SEED_USER || req.seed_mode == req.SEED_AUTO) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks much cleaner.
This update adds the SNS IK solver as the backbone of the IK service inside the Kinematics class. Updates include: - Added sns_ik_lib as a dependency - Acceleration Limits to be added to the parameter server - Distinguishes between the endpoint tips and gravity compensation tips (to properly account for gravity) - Adds the servicePositionIK ROS Service
c7bb488
to
26b4fa3
Compare
This update adds the SNS IK solver as the backbone of the IK service inside the
Kinematics
class. Updates include:sns_ik_lib
as a dependencyservicePositionIK
ROS Service