Skip to content

Funny error with UR5 arm #4

Open
@neildhir

Description

Hi Travis,

Excellent blog as always.

I was playing around with your ur5_ctrl.py example and I am running into this funny error where I can run the code from outside an IDE like so:

[90] → python ur5_ctrl.py
Connected to remote API server
Generating transform function for EE
connection closed...
Traceback (most recent call last):
  File "ur5_ctrl.py", line 364, in <module>
    ax.plot([track_hand[0, 0]],
IndexError: too many indices for array

If I then run it inside and IDE like sublime or a notebook, I get the same error above once, but then if I try to run it again I get this rather worrying chunk of stuff:

Connected to remote API server
Generating transform function for EE
connection closed...
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-d8786628c253> in <module>()
    149             # calculate position of the end-effector
    150             # derived in the ur5 calc_TnJ class
--> 151             xyz = robot_config.Tx('EE', q)
    152 
    153             # calculate the Jacobian for the end effector

/Users/nd/cloud/control/src/vrep/ur5.pyc in Tx(self, name, q, x)
    213             # both have their own transform calculated with this check
    214             self._Tx[name] = self._calc_Tx(
--> 215                 name, x=x)
    216         parameters = tuple(q) + tuple(x)
    217         return self._Tx[name](*parameters)[:-1].flatten()

/Users/nd/cloud/control/src/vrep/ur5.pyc in _calc_Tx(self, name, x, lambdify)
    384         if (os.path.isfile('%s/%s.T' % (self.config_folder, name))):
    385             Tx = cloudpickle.load(open('%s/%s.T' %
--> 386                                        (self.config_folder, name), 'rb'))
    387         else:
    388             T = self._calc_T(name=name)

/Users/nd/anaconda2/lib/python2.7/pickle.pyc in load(file)
   1382 
   1383 def load(file):
-> 1384     return Unpickler(file).load()
   1385 
   1386 def loads(str):

/Users/nd/anaconda2/lib/python2.7/pickle.pyc in load(self)
    862             while 1:
    863                 key = read(1)
--> 864                 dispatch[key](self)
    865         except _Stop, stopinst:
    866             return stopinst.value

/Users/nd/anaconda2/lib/python2.7/pickle.pyc in load_reduce(self)
   1137         args = stack.pop()
   1138         func = stack[-1]
-> 1139         value = func(*args)
   1140         stack[-1] = value
   1141     dispatch[REDUCE] = load_reduce

/Users/nd/anaconda2/lib/python2.7/site-packages/sympy/core/numbers.pyc in __new__(cls, num, prec)
    823                 else:
    824                     _mpf_ = mpmath.mpf(
--> 825                         S.NegativeOne**num[0]*num[1]*2**num[2])._mpf_
    826         elif isinstance(num, Float):
    827             _mpf_ = num._mpf_

TypeError: can't multiply sequence by non-int of type 'float'

Do you know why it might be doing that?

EDIT:

The issue seems to be with cloudpickle

If I do

Tx = cloudpickle.load((open('%s/%s.T' % ('ur5_config', 'EE'), 'rb')))

I get

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-5-d19e02c244b8> in <module>()
----> 1 Tx = cloudpickle.load((open('%s/%s.T' % ('ur5_config', 'EE'), 'rb')))

/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.pyc in load(file)
   1382 
   1383 def load(file):
-> 1384     return Unpickler(file).load()
   1385 
   1386 def loads(str):

/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.pyc in load(self)
    862             while 1:
    863                 key = read(1)
--> 864                 dispatch[key](self)
    865         except _Stop, stopinst:
    866             return stopinst.value

/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.pyc in load_reduce(self)
   1137         args = stack.pop()
   1138         func = stack[-1]
-> 1139         value = func(*args)
   1140         stack[-1] = value
   1141     dispatch[REDUCE] = load_reduce

/usr/local/lib/python2.7/site-packages/sympy/core/numbers.pyc in __new__(cls, num, prec)
    823                 else:
    824                     _mpf_ = mpmath.mpf(
--> 825                         S.NegativeOne**num[0]*num[1]*2**num[2])._mpf_
    826         elif isinstance(num, Float):
    827             _mpf_ = num._mpf_

TypeError: can't multiply sequence by non-int of type 'float'

I think, possibly, maybe, there is an issue with the files in ur5_config/ - surely I should be able to use the ones on this repo and not process them myself (it takes a few hours as you have noted :)

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions