roboticsleeds / ur5controller

OpenRAVE Controller Plugin for UR5 (Universal Robots UR5) Robot
GNU General Public License v3.0
34 stars 8 forks source link

mpmath.libmp.libhyper.NoConvergence: Didn't converge in maxsteps=50 steps. #7

Closed lakshmip001 closed 5 years ago

lakshmip001 commented 5 years ago

when running control_ur5.py


  Traceback (most recent call last):
  File "/home/lakshmi/catkin_ws/src/ur5controller/scripts/control_ur5.py", line 158, in <module>
    demo = Demo()
  File "/home/lakshmi/catkin_ws/src/ur5controller/scripts/control_ur5.py", line 47, in __init__
    is_simulation=True)
  File "/home/lakshmi/catkin_ws/src/ur5controller/pythonsrc/ur5_robot/ur5_factory.py", line 136, in create_ur5_and_env
    self.robot.__init__(is_simulation)
  File "/home/lakshmi/catkin_ws/src/ur5controller/pythonsrc/ur5_robot/ur5_robot.py", line 62, in __init__
    self.ikmodel.autogenerate()
  File "/usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_/databases/inversekinematics.py", line 658, in autogenerate
    self.generate(iktype=iktype,freejoints=freejoints,precision=precision,forceikbuild=forceikbuild,outputlang=outputlang,ipython=ipython,ikfastmaxcasedepth=ikfastmaxcasedepth)
  File "/usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_/databases/inversekinematics.py", line 889, in generate
    chaintree = solver.generateIkSolver(baselink=baselink,eelink=eelink,freeindices=self.freeindices,solvefn=solvefn)
  File "/usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_/ikfast.py", line 2295, in generateIkSolver
    chaintree = solvefn(self, LinksRaw, jointvars, isolvejointvars)
  File "/usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_/databases/inversekinematics.py", line 751, in solveFullIK_6D
    return self.ikfast.IKFastSolver.solveFullIK_6D(*args,**kwargs)
  File "/usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_/ikfast.py", line 2950, in solveFullIK_6D
    tree = self.solveFullIK_6DGeneral(T0links, T1links, solvejointvars, endbranchtree, usesolvers=1)
  File "/usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_/ikfast.py", line 3285, in solveFullIK_6DGeneral
    leftovertree = self.SolveAllEquations(AllEquationsExtra,curvars=curvars,othersolvedvars = self.freejointvars+usedvars,solsubs = solsubs,endbranchtree=origendbranchtree)
  File "/usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_/ikfast.py", line 6872, in SolveAllEquations
    return self.AddSolution(solutions,AllEquations,curvars,othersolvedvars,solsubs,endbranchtree,currentcases=currentcases, currentcasesubs=currentcasesubs, unknownvars=unknownvars)
  File "/usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_/ikfast.py", line 7238, in AddSolution
    nextsolutions[var] = self.SolveAllEquations(AllEquations,curvars=newvars,othersolvedvars=othersolvedvars+[var],solsubs=solsubs+self.Variable(var).subs,endbranchtree=endbranchtree,currentcases=currentcases, currentcasesubs=currentcasesubs, unknownvars=unknownvars)
  File "/usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_/ikfast.py", line 6732, in SolveAllEquations
    return self.AddSolution(solutions,AllEquations,curvars,othersolvedvars,solsubs,endbranchtree,currentcases=currentcases, currentcasesubs=currentcasesubs, unknownvars=unknownvars)
  File "/usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_/ikfast.py", line 7238, in AddSolution
    nextsolutions[var] = self.SolveAllEquations(AllEquations,curvars=newvars,othersolvedvars=othersolvedvars+[var],solsubs=solsubs+self.Variable(var).subs,endbranchtree=endbranchtree,currentcases=currentcases, currentcasesubs=currentcasesubs, unknownvars=unknownvars)
  File "/usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_/ikfast.py", line 6732, in SolveAllEquations
    return self.AddSolution(solutions,AllEquations,curvars,othersolvedvars,solsubs,endbranchtree,currentcases=currentcases, currentcasesubs=currentcasesubs, unknownvars=unknownvars)
  File "/usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_/ikfast.py", line 7536, in AddSolution
    newtree = self.SolveAllEquations(NewEquationsClean,curvars,othersolvedvars,solsubs,endbranchtree,currentcases=newcases, currentcasesubs=newcasesubs, unknownvars=unknownvars)
  File "/usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_/ikfast.py", line 6732, in SolveAllEquations
    return self.AddSolution(solutions,AllEquations,curvars,othersolvedvars,solsubs,endbranchtree,currentcases=currentcases, currentcasesubs=currentcasesubs, unknownvars=unknownvars)
  File "/usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_/ikfast.py", line 7536, in AddSolution
    newtree = self.SolveAllEquations(NewEquationsClean,curvars,othersolvedvars,solsubs,endbranchtree,currentcases=newcases, currentcasesubs=newcasesubs, unknownvars=unknownvars)
  File "/usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_/ikfast.py", line 6732, in SolveAllEquations
    return self.AddSolution(solutions,AllEquations,curvars,othersolvedvars,solsubs,endbranchtree,currentcases=currentcases, currentcasesubs=currentcasesubs, unknownvars=unknownvars)
  File "/usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_/ikfast.py", line 7094, in AddSolution
    ss += self.solveSingleVariable([checksimplezeroexpr.subs([(sothervar,sin(othervar)),(cothervar,cos(othervar))])],othervar,othersolvedvars)
  File "/usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_/ikfast.py", line 8553, in solveSingleVariable
    return [self.solveHighDegreeEquationsHalfAngle(eqns,varsym)]
  File "/usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_/ikfast.py", line 8124, in solveHighDegreeEquationsHalfAngle
    pfinal = self.checkFinalEquation(pfinal,subs)
  File "/usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_/ikfast.py", line 8181, in checkFinalEquation
    roots = mpmath.polyroots(numpy.array(numpy.array(coeffs),numpy.float64))
  File "/usr/lib/python2.7/dist-packages/mpmath/calculus/polynomials.py", line 189, in polyroots
    % maxsteps)
mpmath.libmp.libhyper.NoConvergence: Didn't converge in maxsteps=50 steps.
kindly please help me how to solve this error
rpapallas commented 5 years ago

Hi there,

This looks like a problem with OpenRAVE. When you initially "create" a new robot OpenRAVE tries to generate the inverse kinematics and store them on your computer. It looks like OpenRAVE is failing to do this.

Are you using the singularity container we recommended?

lakshmip001 commented 5 years ago

Hi ,

I am new to openrave , didnt know if I should use and I see two links given for singularity container. Do you recommend to use singularity container?

rpapallas commented 5 years ago

It's not essential, but to make sure you are on the same page. How did you installed OpenRAVE? Are you using the latest version?

lakshmip001 commented 5 years ago

I am using openrave0.9, sympy 0.7.1, I installed it from source later build it.

rpapallas commented 5 years ago

So you are using the latest version (you haven't for example checked out an older commit and build from there?)?

lakshmip001 commented 5 years ago

no I directly git cloned latest openrave repository and then build it.

rpapallas commented 5 years ago

Can you try to go to the OpenRAVE repo you cloned and run git reset --hard 81ec501 and then follow the same process to build it?

lakshmip001 commented 5 years ago

Thanks I will build and do it again.

rpapallas commented 5 years ago

Note that I pushed a minor change for the control_ur5.py file. Make sure to pull from within ur5controller package before trying again.

rpapallas commented 5 years ago

Did it worked?

lakshmip001 commented 5 years ago

I need to test . I will update tomorrow .

On Sat 16 Mar, 2019, 12:24 AM Rafael Papallas, notifications@github.com wrote:

Did it worked?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/roboticsleeds/ur5controller/issues/7#issuecomment-473352042, or mute the thread https://github.com/notifications/unsubscribe-auth/ActIxsQcSyS55IHVW8tLuLOCZ9wx3V2dks5vW8klgaJpZM4b2EyG .

lakshmip001 commented 5 years ago

Sorry for late reply . I still get same error may be I will try once with singularity .

rpapallas commented 5 years ago

What's the exact error?

lakshmip001 commented 5 years ago

Actually I get same error as the one I posted at the first .

https://github.com/roboticsleeds/ur5controller/issues/7#issue-421433116

lakshmip001 commented 5 years ago

I was able to solve but now i get a different error Traceback (most recent call last):

File "./control_ur5.py", line 158, in <module>
    demo = Demo()
  File "./control_ur5.py", line 49, in __init__
    self.move_robot_to_start_transform()
  File "./control_ur5.py", line 61, in move_robot_to_start_transform
    self.robot.base_manipulation.MoveManipulator(goal=ik_solution)
  File "/usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_/interfaces/BaseManipulation.py", line 121, in MoveManipulator
    return self._MoveJoints('MoveManipulator',goal=goal,steplength=steplength,maxiter=maxiter,maxtries=maxtries,execute=execute,outputtraj=outputtraj,goals=goals,outputtrajobj=outputtrajobj,jitter=jitter,releasegil=releasegil)
  File "/usr/local/lib/python2.7/dist-packages/openravepy/_openravepy_/interfaces/BaseManipulation.py", line 166, in _MoveJoints
    raise PlanningError('MoveActiveJoints')
openravepy._openravepy_.openravepy_ext.PlanningError: Planning Error
MoveActiveJoints
QtDBus: cannot relay signals from parent QObject(0x7f1548273be0 "") unless they are emitted in the object's thread QThread(0x7f154800e590 ""). Current thread is QThread(0x5115870 "").
QtDBus: cannot relay signals from parent QObject(0x7f1548273be0 "") unless they are emitted in the object's thread QThread(0x7f154800e590 ""). Current thread is QThread(0x5115870 "").
2019-03-18 12:49:42,923 openrave [WARN] [qtcoinrave.cpp:80 DestroyPlugin] SoQt releasing all memory
Coin debug: socontexthandler_cleanup(): 123 context-bound resources not free'd before exit.
rpapallas commented 5 years ago

That is probably not a problem. Try to rerun it. Or if you are using the singularity containtainer, there is a directory ur5_demo in your home folder. Try to run this demo. Once the viewer is loaded, hit ESC and then simultaneously press CTRL and the mouse click over one of the UR5 joints this will give you the ability to move the robot, if you are successful then this means everything is set.

lakshmip001 commented 5 years ago

Ok. Can I set Cartesian Velocity with which I want to move or how can I get the joint velocities and joint accelerations?

rpapallas commented 5 years ago

The ur5controller is a plugin on top of OpenRAVE. It is designed to accept a trajectory of joint values and execute the trajectory in simulation or on the real robot. The underlying planning is handled by OpenRAVE.

Your question about using velocities to control the robot, unfortunately, is beyond the scope of this project. However, you might find useful this discussion: http://openrave-users-list.185357.n3.nabble.com/How-to-set-velocities-td197177.html

rpapallas commented 5 years ago

As the controller looks like is working on your end, I am closing this issue. Feel free to reopen it if you are facing any difficulties getting the controller working, or open a new issue.

lakshmip001 commented 5 years ago

That is probably not a problem. Try to rerun it. Or if you are using the singularity containtainer, there is a directory ur5_demo in your home folder. Try to run this demo. Once the viewer is loaded, hit ESC and then simultaneously press CTRL and the mouse click over one of the UR5 joints this will give you the ability to move the robot, if you are successful then this means everything is set.

I still face same problem when I rerun. Can I solve this someway without singularity? I installed singularity & I dont know if it would be fine, but I am new to singularity . Singularity works like a docker i think (with ros indigo), so I can relate this one with my catkin workspace(which is ros Kinetic), openrave and real robot. Correct me if I am wrong?

rpapallas commented 5 years ago

Yes, singularity is a container software as like Docker. You can have your catkin workspace (ROS Indigo though) and OpenRAVE to talk with the outside world (i.e., real robot).

I am not sure what you are working with. Are you using ROS Kinetic? This package is only officially supported for ROS Indigo, we have not tested it with Kinetic.

The error you are getting looks like a planning error (which does not necessarily means that there is a problem with the controller). Again, can you please check that the controller is working properly?

To check this, run the following code:

import IPython
from ur5_factory import UR5_Factory
ur5_factory = UR5_Factory()

# If you want to specify all the configuration settings (is_simulation, has_ridgeback etc)
env, robot = ur5_factory.create_ur5_and_env(is_simulation=True,
                                            has_ridgeback=True,
                                            gripper_name="robotiq_two_finger",
                                            has_force_torque_sensor=False,
                                            env_path="test_env.xml",
                                            viewer_name="qtcoin",
                                            urdf_path="package://ur5controller/ur5_description/urdf/",
                                            srdf_path="package://ur5controller/ur5_description/srdf/")

IPython.embed()

Make sure to have the test_env.xml in your working directory:

<Environment>
  <KinBody name="table">
    <Translation>1.02727556229 0.0665829107165 0.719971299171</Translation>
    <RotationMat>0.0110235936463 0.999939238346 1.19202053067e-07 -0.999939238346 0.0110235936463 -1.17895167838e-07 -1.19202039327e-07 -1.1789518173e-07 1.0</RotationMat>
    <Body name="table" type="dynamic">
      <Geom type="box">
         <extents>.5 0.4 0.02</extents>
         <diffuseColor>0.9 0.9 0.9</diffuseColor>
      </Geom>
      <Geom type="cylinder">
        <translation>0.45 0.35 -0.365</translation>
        <rotationaxis>1 0 0 -90</rotationaxis>
        <radius>0.02</radius>
        <height>0.7</height>
        <diffuseColor>0.9 0.9 0.9</diffuseColor>
      </Geom>
      <Geom type="cylinder">
        <translation>-0.45 0.35 -0.365</translation>
        <rotationaxis>1 0 0 -90</rotationaxis>
        <radius>0.02</radius>
        <height>0.7</height>
        <diffuseColor>0.9 0.9 0.9</diffuseColor>
      </Geom>
      <Geom type="cylinder">
        <translation>0.45 -0.35 -0.365</translation>
        <rotationaxis>1 0 0 -90</rotationaxis>
        <radius>0.02</radius>
        <height>0.7</height>
        <diffuseColor>0.9 0.9 0.9</diffuseColor>
      </Geom>
      <Geom type="cylinder">
        <translation>-0.45 -0.35 -0.365</translation>
        <rotationaxis>1 0 0 -90</rotationaxis>
        <radius>0.02</radius>
        <height>0.7</height>
        <diffuseColor>0.9 0.9 0.9</diffuseColor>
      </Geom>
    </Body>
  </KinBody>
</Environment>

Once you run this code you should see an OpenRAVE window with a table and the UR5 robot. Now zoom in using your mouse to have the UR5 clearly in the view. Hit ESC and you should be in select mode. Simultaneously press CTRL and with your mouse left-click on one of the UR5 joints (this is quite tricky to get it right, you need to click exactly over a joint). You should see a ring now. Stop pressing the CTRL and with your mouse intract with the ring to change the configuration of hte robot. You should see the robot changing configuration, in which case OpenRAVE loaded the inverse kinematis of UR5 successfully.

lakshmip001 commented 5 years ago

I ran the ur5_demo.py but still i am unable to load the robot and come across following error.

lakshmi@lakshmi-Nitro-AN515-51:~/ur5_demo$ python ur5_demo.py 
2019-03-19 01:30:09,582 openrave [WARN] [fclspace.h:248 FCLSpace::KinBodyInfoPtr fclrave::FCLSpace::InitKinBody] Initializing link ur5/ridgeback_base_link with 0 geometries (env 1) (userdatakey fclcollision0x1d081a0)
2019-03-19 01:30:09,582 openrave [WARN] [fclspace.h:248 FCLSpace::KinBodyInfoPtr fclrave::FCLSpace::InitKinBody] Initializing link ur5/base with 0 geometries (env 1) (userdatakey fclcollision0x1d081a0)
2019-03-19 01:30:09,585 openrave [WARN] [fclspace.h:248 FCLSpace::KinBodyInfoPtr fclrave::FCLSpace::InitKinBody] Initializing link ur5/imu_link with 0 geometries (env 1) (userdatakey fclcollision0x1d081a0)
2019-03-19 01:30:09,585 openrave [WARN] [fclspace.h:248 FCLSpace::KinBodyInfoPtr fclrave::FCLSpace::InitKinBody] Initializing link ur5/mid_mount with 0 geometries (env 1) (userdatakey fclcollision0x1d081a0)
2019-03-19 01:30:09,587 openrave [WARN] [fclspace.h:248 FCLSpace::KinBodyInfoPtr fclrave::FCLSpace::InitKinBody] Initializing link ur5/tool0 with 0 geometries (env 1) (userdatakey fclcollision0x1d081a0)
2019-03-19 01:30:09,592 openrave [WARN] [fclspace.h:248 FCLSpace::KinBodyInfoPtr fclrave::FCLSpace::InitKinBody] Initializing link ur5/ridgeback_base_link with 0 geometries (env 1) (userdatakey fclcollision0x1d081a0)
2019-03-19 01:30:09,593 openrave [WARN] [fclspace.h:248 FCLSpace::KinBodyInfoPtr fclrave::FCLSpace::InitKinBody] Initializing link ur5/base with 0 geometries (env 1) (userdatakey fclcollision0x1d081a0)
2019-03-19 01:30:09,596 openrave [WARN] [fclspace.h:248 FCLSpace::KinBodyInfoPtr fclrave::FCLSpace::InitKinBody] Initializing link ur5/imu_link with 0 geometries (env 1) (userdatakey fclcollision0x1d081a0)
2019-03-19 01:30:09,596 openrave [WARN] [fclspace.h:248 FCLSpace::KinBodyInfoPtr fclrave::FCLSpace::InitKinBody] Initializing link ur5/mid_mount with 0 geometries (env 1) (userdatakey fclcollision0x1d081a0)
2019-03-19 01:30:09,598 openrave [WARN] [fclspace.h:248 FCLSpace::KinBodyInfoPtr fclrave::FCLSpace::InitKinBody] Initializing link ur5/tool0 with 0 geometries (env 1) (userdatakey fclcollision0x1d081a0)
Traceback (most recent call last):
  File "ur5_demo.py", line 13, in <module>
    srdf_path="package://ur5controller/ur5_description/srdf/")
  File "/home/lakshmi/catkin_ws/src/ur5controller/pythonsrc/ur5_robot/ur5_factory.py", line 131, in create_ur5_and_env
    if not self._a_ros_topic_exist_with_the_name("joint_states"):
  File "/home/lakshmi/catkin_ws/src/ur5controller/pythonsrc/ur5_robot/ur5_factory.py", line 185, in _a_ros_topic_exist_with_the_name
    topics = rospy.get_published_topics()
  File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/client.py", line 376, in get_published_topics
    code, msg, val = get_master().getPublishedTopics(namespace)
  File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/msproxy.py", line 106, in wrappedF
    return f(*args, **kwds)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1233, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1587, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.7/xmlrpclib.py", line 1273, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1301, in single_request
    self.send_content(h, request_body)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1448, in send_content
    connection.endheaders(request_body)
  File "/usr/lib/python2.7/httplib.py", line 1013, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 864, in _send_output
    self.send(msg)
  File "/usr/lib/python2.7/httplib.py", line 826, in send
    self.connect()
  File "/usr/lib/python2.7/httplib.py", line 807, in connect
    self.timeout, self.source_address)
  File "/usr/lib/python2.7/socket.py", line 571, in create_connection
    raise err
socket.error: [Errno 111] Connection refused
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::lock_error> >'
  what():  boost: mutex lock failed in pthread_mutex_lock: Invalid argument
Aborted (core dumped)

Please help how I can solve this error.

lakshmip001 commented 5 years ago

I was able to successfully run it without singularity container.

rpapallas commented 5 years ago

What was the problem?

lakshmip001 commented 5 years ago

I think its because python-sympy which installs (0.7.6.1 version) . I uninstalled it ..

This solved inverse kinematics error.

While planning error was because my ur5 arm position (tcp) was under the table and was unable to load and plan.

I tried removing test.env.xml . So, that doesnt load the table and just load the URDF alone. But I came across error. Do I need include some kind of world or something in the .env.xml. And would like to know, if planning is with respect to world frame or base link of UR5