URDF - IKfast joint mismatch
Hello,
I am trying to setup IKfast on my robot, it all seems to go well until attempting to run demo.launch from the moveit_config package. When moveit! loads the IKfast kinematics solver there is a fatal error:
[FATAL] Joint numbers mismatch: URDF has 7 and IKFast has 6
My URDF has a mimic joint in it, I think this is the root of the problem. I am wondering if there is a work around? I have tried several variations of including the mimic joint in the moveit! planning group or not:
Here is what my IKfast set-up was :
~/harvester_7_axis/src/harvester_description/urdf$ openrave-robot.py
name index parents
---------------------------------------
world 0
base_link 1 world
bed_link0 2 base_link
carrage_link0 3 bed_link0
gantry_link0 4 carrage_link0
gantry_link1 5 gantry_link0
arm_link0 6 gantry_link1
arm_link1 7 arm_link0
arm_link2 8 arm_link1
arm_link3 9 arm_link2
arm_link4 10 arm_link3
aa_tool_flange_link 11 arm_link4
---------------------------------------
~/harvester_7_axis/src/harvester_description/urdf$ export BASE_LINK="0"
~/harvester_7_axis/src/harvester_description/urdf$ export EEF_LINK="10"
Here is the .dae joint info incase you want it:
~/harvester_7_axis/src/harvester_description/urdf$ openrave-robot.py "$MYROBOT_NAME".dae --info joints
name joint_index dof_index parent_link child_link mimic
----------------------------------------------------------------------------------------
gantry_joint_0 0 0 carrage_link0 gantry_link0
gantry_joint_1 1 1 gantry_link0 gantry_link1
arm_joint_0 2 2 gantry_link1 arm_link0
arm_joint_2 3 3 arm_link1 arm_link2
arm_joint_3 4 4 arm_link2 arm_link3
arm_joint_4 5 5 arm_link3 arm_link4
fixed -1 -1 world base_link
bed_joint_0 -1 -1 base_link bed_link0
carrage_joint_0 -1 -1 bed_link0 carrage_link0
arm_joint_1 -1 -1 arm_link0 arm_link1 arm_joint_0
aa_tool_flange_joint -1 -1 arm_link4 aa_tool_flange_link
----------------------------------------------------------------------------------------
name joint_index dof_index parent_link child_link mimic
I used the following code to create the IKfast.cpp file:
export IKFAST_OUTPUT_PATH=`pwd`/ikfast61_"$PLANNING_GROUP".cpp
python `openrave-config --python-dir`/openravepy/_openravepy_/ikfast.py --robot="$MYROBOT_NAME".dae --iktype=transform6d --baselink="$BASE_LINK" --eelink="$EEF_LINK" --savefile="$IKFAST_OUTPUT_PATH"
Any help with how to solve my issue would be much appreciated, thanks for your help in advance.
P.S. if you need anymore information that can help just ask :D
Asked by Will_robo on 2019-01-28 03:44:29 UTC
Answers
I have actually managed to solve the problem I think:
I edited the ikfast_plugin/src/robot_name_ikfast_moveit_plugin.cpp to increase the num_joint of the ikfast so that it matches the moveit! joint number (num_joints_ + 1):
Line 384:
while (link->name != base_frame_ && joint_names_.size() <= (num_joints_+1))
Line 439:
if (joint_names_.size() != num_joints_)
{
ROS_FATAL_STREAM_NAMED(name_, "Joint numbers mismatch: URDF has " << joint_names_.size() << " and IKFast has " << (num_joints_+1));
return false;
}
Thanks for the help @gvdhoorn :D
Asked by Will_robo on 2019-01-28 06:38:23 UTC
Comments
I don't feel that's actually a solution: that check is there for a reason. Even if it's incorrectly implemented in the case of mimic
joints in the chain, the proper approach would seem to be to get MoveIt fixed. Not increase an integer, as that essentially turns it into a meaningless check.
Asked by gvdhoorn on 2019-01-28 06:44:10 UTC
Yes :S But I used moveit_commander to plan/execute to pose's in the w/s, and its working well, the solutions found in roughly 0.02s which must be ikfast, I think the check is certainly useful but may be redundant in my case. But I'll keep you updated if I find a "proper" solution :D
Asked by Will_robo on 2019-01-28 06:56:17 UTC
Comments
Just to satisfy my own curiousity: a picture of your robot :). Its name is "harvester" and from the output of
--info joints
it appears to be a regular 6 axis mounted on a gantry.What is this harvesting ? :)
Asked by gvdhoorn on 2019-01-28 03:50:49 UTC
Thanks for the fast reply, but that's not really the information I meant...
Asked by Will_robo on 2019-01-28 04:07:30 UTC
...
In any case: rdiankov/openrave#154 from 2012 appears to have not been resolved. Might want to ask what the status of mimic joints is there.
Asked by gvdhoorn on 2019-01-28 05:07:06 UTC
Probably supported, as evidenced by this github search.
Asked by gvdhoorn on 2019-01-28 05:08:00 UTC
Yes, IKfast does support mimic joints. But the problem is that moveit! thinks the URDF is 7 joints (so its including the mimic joint in its joint count) and IKfast solution is 6 joints (so does not include its mimic joint in the joint count). but im not sure how to bypass this fatal error :S
Asked by Will_robo on 2019-01-28 05:24:34 UTC