Error "Does your IK Solver support approximate IK ?" Moveit!
Hello,
I am trying to write a script using move_group in order to move a custom robot in Moveit!. Using the joints as targets works perfectly, bu I have an issue when I try to target a pose, I get this error and the robot doesn't move :
Traceback (most recent call last):
File "/home/edith/catkin_ws/src/test_moveit/scripts/test.py", line 84, in <module> move_group.set_joint_value_target(pose_goal, "link_eff",True) File "/opt/ros/melodic/lib/python2.7/dist-packages/moveit_commander/move_group.py", line 219, in set_joint_value_target raise MoveItCommanderException("Error setting joint target. Does your IK solver support approximate IK?") moveit_commander.exception.MoveItCommanderException: Error setting joint target. Does your IK solver support approximate IK?
I use ROS melodic on a virtual machine with Ubuntu 18.04. My robot is a RRR robot (3DOF) and I use an IKFast solver, with parameter "TranslationXY2D".
I follow this tutorial : https://ros-planning.github.io/moveit...
Instead of
move_group.set_pose_target(pose_goal)
I used
move_group.set_joint_value_target(pose_goal, "link_eff",True)
Because this instruction allows IK approximate solutions with the boolean "True", unlike the other one : http://docs.ros.org/jade/api/moveit_c...
I know that the pose asked is reachable by the robot arm. At this point I don't know what else I can do, so thank to those who will take some time to answer ! Please find the URDF file and the concerned code. The URDF was generated from Solidworks with the exporter SW2URDF.
Code :
import sys import copy import rospy import moveit_commander import moveit_msgs.msg import math import time import std_msgs.msg import geometry_msgs.msg import moveit_commander.conversions
moveit_commander.roscpp_initialize(sys.argv)
rospy.init_node('move_group_python_interface_tutorial', anonymous=True)
robot = moveit_commander.RobotCommander()
group_name = "Arm" move_group = moveit_commander.MoveGroupCommander(group_name)
joint_goal = move_group.get_current_joint_values()
joint_goal[0] = 0.1744 joint_goal[1] = 0 joint_goal[2] = 0.3489 move_group.go(joint_goal, wait=True) move_group.stop()
pose_goal = move_group.get_current_pose()
time.sleep(0.5) pose_goal.pose.orientation.w = 1.0 time.sleep(0.5) pose_goal.pose.position.x = 0.671 time.sleep(0.5) pose_goal.pose.position.y = -0.667
move_group.set_joint_value_target(pose_goal, "link_eff",True)*
URDF :
<robot< p="">
name="swurdf">
<link< p="">
name="base_link">
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://swurdf/meshes/base_link.STL" />
</geometry>
<material
name="">
<color
rgba="1 0 0 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://swurdf/meshes/base_link.STL" />
</geometry>
</collision>
</link>
<link< p="">
name="link_1">
<inertial>
<origin
xyz="0.19475 -1.4951E-18 6.6018E-18"
rpy="0 0 0" />
<mass
value="60" />
<inertia
ixx="0.0084601"
ixy="3.2514E-18"
ixz="5.5791E-19"
iyy="0.062842"
iyz="3.9785E-19"
izz="0.069912" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://swurdf/meshes/link_1.STL" />
</geometry>
<material
name="">
<color
rgba="0 1 0 1" />
</material>
</visual>
<collision>
<origin
xyz ...
Hello! Were you by chance able to find a solution to this?
Hello, I found out that the solvers provided by moveit are designed to work with verry common robot models. They are optimized for 6 DOF robots, for other models it is more complicated. You should use TracIK to generate a custom solver if your robot doesn't have 6 DOF. And when you manipulate it by hand in Rviz you should always check "Allow Approx IK Solutions" in MotionPlanning -> Planning. My robot is a special one, it has less than 6 DOF and it doesn't have orthogonal axes. My colleague adapted an existing solver and she is testing it.