MoveIt - Python interface - TRAC-IK -How to request closest IK solution to current joint configuration?
Hi!
I am trying to use MoveIt's python interface to plan cartesian trajectories with a UR3e robot using ROS-Melodic. I have set up everything and it works fine. I am using it with the TRAC-IK
solver.
The problem is that when I get a solution from the planner, the solution can change very drastically from a small motion to an unnecessarily long trajectory. The main difference between trajectories is the goal joint configuration from the goal pose. So my question is, how to request the closes IK solution to the current joint configuration?
I can do that manually by computing the IK solutions using TRAK-IK
, computing the closes solution to my current configuration, and then requesting MoveIt
to plan using the joint configuration that I choose rather than using a goal pose. When I do that, the resulting trajectory is always similar. However, isn't there a way to request MoveIt
to use a specific IK solution over another?
Edit: Video for clarity. From the same initial position, and to the same target pose (Cartesian goal), different IK solutions. https://youtu.be/7GiPZUdlPNA
I'm not sure I understand what you're asking. When you say "cartesian trajectories", do you mean one calculated by the cartesian path planning function? Because for 6-DOF robots this should not depend on the IK solution at the goal pose. Also, do you mean "How to request closest IK solution to a given joint configuration?"
Is TracIK configured to use its
Distance
solve type, instead of the defaultSpeed
?@fvd Sorry, about "cartesian trajectories" I meant that I am using the
move_group.set_pose_target()
method, which offers no option to specify which of the possible IK solutions to use.And, yes, I also mean to ask "how to request the closest IK solution to a given joint configuration?", it just that I want to get the closest to the current joint configuration of the robot.
I included a video in the question for clarity
@gvdhoorn no, how do I configure TRACK-IK to do that? I checked the code and the logs and it is expecting a rosparam move_group(leftarm in my case)/solve_type, but even if I specify "Distance" it still doesn't seem to recognize it :/
Looking in common namespaces for param name: leftarm/solve_type
Using solve type Speed
Can you add how you define the parameter your question?
In the
kinematics.yaml
of your MoveIt cfg package, like so (manipulator
is the group name here, change to whatever you have of course):@gvdhoorn thank you! Silly me, I was publishing a rosparam with that "manipulator/solve_type" but that way didn't work. I wonder why...
Anyways, I just tried using the
kinematics.yaml
and it worked. TRAC-IK recognizes the solver type and it does seem to work as I wished, the IK solution seems to be the same every time.@fvd sorry, I don't understand your question. Do you mean the TRAC-IK parameter?
if that's the case I defined the parameter
<param name="leftarm/solve_type" type="str" value="Distance" />
, I defined the parameter before calling the move_group definition, and I checked that the parameter existed in the parameter server but still for whatever reason TRAC-IK was not able to read from it or something.it needs to be in a specific namespace. If it's not there, TracIK will not find it and default to
Speed
.