ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
1) In the ik_request(), I can understand this function's main function was calling the IK server to calculate the rest of the joints angle after that return back. But what is the purpose in line 100 (What is doing in here?)
resp_seeds = struct.unpack('<%dB' % len(resp.result_type), resp.result_type)
if (resp_seeds[0] != resp.RESULT_INVALID):
This line is figuring out if the result coming back from the Inverse Kinematic Service is valid or not by parsing the response message.
line 102-107(What is the purpose for the seed_str{},it's necessary to have this?) and line 108-113( the if statement was determined the same condition, but here had to do two times?).
Nope, these lines are not necessary. This code is there just to provide some debugging information about what kind of Joint Seed was ultimately used so solve the Inverse Kinematics problem. A "Joint Seed" is the initial condition used to begin an Inverse Kinematics solver. Users can specify a seeding strategy for the Inverse Kinematics solver, or they can specify "Auto", which means the solver runs though each seeding strategy one after another. This debugging information is only useful in the "Auto" case when you want to find out which seed the solver ultimately used to solve the IK request, giving you the returned Joint Angles.
2) what is the useful of the current_pose = self._limb.endpoint_pose() and ik_pose = Pose().
Here, in the _retract()
, I want the robot to move its end effector in the positive Z direction with respect to the robot's base. In order to do that, I am copying the current pose of the end effector (through current_pose = self._limb.endpoint_pose()
), because I want to maintain the X and Y translation, as well as the current orientation.
The ik_pose = Pose()
is just creating an new instance of a Pose
object to send in to the IK solver. Then I copy all the fields from the current pose, but add a hover_distance
to the Z component. Then I send it into the IK solver to give me the joint angles that I would need to accomplish the move to this end effector position.
Hope this helps!