kjyv / FloBaRoID

Framework for dynamical system identification of floating-base rigid body tree structures
GNU Lesser General Public License v3.0
61 stars 26 forks source link

Identification & Excitation Issues #5

Open mouhyemen opened 6 years ago

mouhyemen commented 6 years ago

I am using the measurements.regressor.npz file generated from excite.py script into the identify.py script and this is the error I am getting with identify.py

mouhyemen@khan-msi:~/desktop/research/FloBaRoID$ ./identify.py --config configs/testing.yaml --model model/kuka_lwr4.urdf --measurements test_new_measurement.npz --output model/example_identified.urdf
loaded model model/kuka_lwr4.urdf
# DOFs: 7
Joints: ['lwr_0_joint', 'lwr_1_joint', 'lwr_2_joint', 'lwr_3_joint', 'lwr_4_joint', 'lwr_5_joint', 'lwr_6_joint']
# regressor outputs: 7
# links: 8 (+ 0 fake)
{0: 'lwr_base_link', 1: 'lwr_1_link', 2: 'lwr_2_link', 3: 'lwr_3_link', 4: 'lwr_4_link', 5: 'lwr_5_link', 6: 'lwr_6_link', 7: 'lwr_7_link'}
# params: 80 (94 will be identified)
loaded random structural regressor from model/kuka_lwr4.urdf.regressor.npz
loaded 709 measurement samples (using 709)
computing standard regressor matrix for data samples
100%|███████████████████████████████████████████████████████████████████████████████| 709/709 [00:00<00:00, 3018.16it/s]
estimating parameters using regressor
./identify.py:590: FutureWarning: `rcond` parameter will change to the default of machine precision times ``max(M, N)`` where M and N are the input matrix dimensions.
To use the future default and silence this warning we advise to pass `rcond=None`, to keep using the old, explicitly pass `rcond=-1`.
  self.model.xBase = la.lstsq(YBase, tau)[0]
/usr/local/lib/python2.7/dist-packages/numpy/linalg/linalg.py:2054: RuntimeWarning: overflow encountered in square
  resids = sum(r_parts**2, axis=-2)
/usr/local/lib/python2.7/dist-packages/numpy/linalg/linalg.py:2286: RuntimeWarning: overflow encountered in multiply
  s = (x.conj() * x).real
Initializing LMIs...
Traceback (most recent call last):
  File "./identify.py", line 1096, in <module>
    main()
  File "./identify.py", line 1074, in main
    idf.estimateParameters()
  File "./identify.py", line 762, in estimateParameters
    self.sdp.initSDP_LMIs(self)
  File "/home/mouhyemen/desktop/research/FloBaRoID/identification/sdp.py", line 306, in initSDP_LMIs
    self.LMIs = list(map(LMI_PD, self.D_blocks))
  File "/home/mouhyemen/desktop/research/FloBaRoID/identification/sdp_helpers.py", line 28, in LMI_PD
    lmi = lhs > sympify(rhs)
  File "/usr/local/lib/python2.7/dist-packages/sympy/core/numbers.py", line 2133, in __lt__
    return Rational.__lt__(self, other)
  File "/usr/local/lib/python2.7/dist-packages/sympy/core/numbers.py", line 1791, in __lt__
    return Expr.__lt__(expr, other)
  File "/usr/local/lib/python2.7/dist-packages/sympy/core/expr.py", line 328, in __lt__
    dif = self - other
  File "/usr/local/lib/python2.7/dist-packages/sympy/core/numbers.py", line 2057, in __sub__
    return Rational.__sub__(self, other)
  File "/usr/local/lib/python2.7/dist-packages/sympy/core/decorators.py", line 91, in __sympifyit_wrapper
    return func(a, b)
  File "/usr/local/lib/python2.7/dist-packages/sympy/core/numbers.py", line 1577, in __sub__
    return Number.__sub__(self, other)
  File "/usr/local/lib/python2.7/dist-packages/sympy/core/decorators.py", line 91, in __sympifyit_wrapper
    return func(a, b)
  File "/usr/local/lib/python2.7/dist-packages/sympy/core/numbers.py", line 652, in __sub__
    return AtomicExpr.__sub__(self, other)
  File "/usr/local/lib/python2.7/dist-packages/sympy/core/decorators.py", line 91, in __sympifyit_wrapper
    return func(a, b)
  File "/usr/local/lib/python2.7/dist-packages/sympy/core/decorators.py", line 131, in binary_op_wrapper
    return f(self)
  File "/usr/local/lib/python2.7/dist-packages/sympy/core/decorators.py", line 132, in binary_op_wrapper
    return func(self, other)
  File "/usr/local/lib/python2.7/dist-packages/sympy/matrices/common.py", line 2092, in __rsub__
    return (-self) + a
  File "/usr/local/lib/python2.7/dist-packages/sympy/core/decorators.py", line 132, in binary_op_wrapper
    return func(self, other)
  File "/usr/local/lib/python2.7/dist-packages/sympy/matrices/common.py", line 1964, in __add__
    raise TypeError('cannot add %s and %s' % (type(self), type(other)))
TypeError: cannot add <class 'sympy.matrices.immutable.ImmutableDenseMatrix'> and <class 'sympy.core.numbers.Zero'>

Also, the excite.py script does not work with the regressor.npz files generated from our custom-made URDF files. The custom URDF file I am using is also 7DOF like Kuka's with only mass, com, axes of rotations, and inertial values changed.

kjyv commented 6 years ago

Thanks for your report. I'll have to find some time in the next week to look at your issues properly.

kiwiwan commented 5 years ago

@mouhyemen , @kjyv ,have this problem been solved? I have the same problem when i run test_identification_fixed.py.Should i have install sympy 0.7.3?Please give me a help? 100%|█████████████████████████████████████| 9054/9054 [00:04<00:00, 2251.22it/s] ./identify.py:590: FutureWarning: rcond parameter will change to the default of machine precision times max(M, N) where M and N are the input matrix dimensions. To use the future default and silence this warning we advise to pass rcond=None, to keep using the old, explicitly pass rcond=-1. self.model.xBase = la.lstsq(YBase, tau)[0] Traceback (most recent call last): File "./identify.py", line 1096, in main() File "./identify.py", line 1074, in main idf.estimateParameters() File "./identify.py", line 762, in estimateParameters self.sdp.initSDP_LMIs(self) File "/home/kiwi/soft/learn/IDIM/FloBaRoID/identification/sdp.py", line 305, in initSDP_LMIs self.LMIs = list(map(LMI_PD, self.D_blocks)) File "/home/kiwi/soft/learn/IDIM/FloBaRoID/identification/sdp_helpers.py", line 28, in LMI_PD lmi = lhs > sympify(rhs) File "/home/kiwi/anaconda2/envs/FloBaRoID/lib/python2.7/site-packages/sympy/core/numbers.py", line 2185, in lt return Rational.lt(self, other) File "/home/kiwi/anaconda2/envs/FloBaRoID/lib/python2.7/site-packages/sympy/core/numbers.py", line 1818, in lt return Expr.lt(expr, other) File "/home/kiwi/anaconda2/envs/FloBaRoID/lib/python2.7/site-packages/sympy/core/expr.py", line 341, in lt dif = self - other File "/home/kiwi/anaconda2/envs/FloBaRoID/lib/python2.7/site-packages/sympy/core/numbers.py", line 2109, in sub return Rational.sub(self, other) File "/home/kiwi/anaconda2/envs/FloBaRoID/lib/python2.7/site-packages/sympy/core/decorators.py", line 91, in sympifyit_wrapper return func(a, b) File "/home/kiwi/anaconda2/envs/FloBaRoID/lib/python2.7/site-packages/sympy/core/numbers.py", line 1608, in sub return Number.sub(self, other) File "/home/kiwi/anaconda2/envs/FloBaRoID/lib/python2.7/site-packages/sympy/core/decorators.py", line 91, in __sympifyit_wrapper return func(a, b) File "/home/kiwi/anaconda2/envs/FloBaRoID/lib/python2.7/site-packages/sympy/core/numbers.py", line 665, in sub return AtomicExpr.sub(self, other) File "/home/kiwi/anaconda2/envs/FloBaRoID/lib/python2.7/site-packages/sympy/core/decorators.py", line 91, in sympifyit_wrapper return func(a, b) File "/home/kiwi/anaconda2/envs/FloBaRoID/lib/python2.7/site-packages/sympy/core/decorators.py", line 131, in binary_op_wrapper return f(self) File "/home/kiwi/anaconda2/envs/FloBaRoID/lib/python2.7/site-packages/sympy/core/decorators.py", line 132, in binary_op_wrapper return func(self, other) File "/home/kiwi/anaconda2/envs/FloBaRoID/lib/python2.7/site-packages/sympy/matrices/common.py", line 2116, in rsub return (-self) + a File "/home/kiwi/anaconda2/envs/FloBaRoID/lib/python2.7/site-packages/sympy/core/decorators.py", line 132, in binary_op_wrapper return func(self, other) File "/home/kiwi/anaconda2/envs/FloBaRoID/lib/python2.7/site-packages/sympy/matrices/common.py", line 1976, in add raise TypeError('cannot add %s and %s' % (type(self), type(other))) TypeError: cannot add <class 'sympy.matrices.immutable.ImmutableDenseMatrix'> and <class 'sympy.core.numbers.Zero'> loaded model model/kuka_lwr4.urdf # DOFs: 7 Joints: ['lwr_0_joint', 'lwr_1_joint', 'lwr_2_joint', 'lwr_3_joint', 'lwr_4_joint', 'lwr_5_joint', 'lwr_6_joint'] # regressor outputs: 7 # links: 8 (+ 0 fake) {0: 'lwr_base_link', 1: 'lwr_1_link', 2: 'lwr_2_link', 3: 'lwr_3_link', 4: 'lwr_4_link', 5: 'lwr_5_link', 6: 'lwr_6_link', 7: 'lwr_7_link'} # params: 80 (94 will be identified) loaded random structural regressor from model/kuka_lwr4.urdf.regressor.npz loaded 9054 measurement samples (using 9054) computing standard regressor matrix for data samples estimating parameters using regressor Initializing LMIs...

kiwiwan commented 5 years ago

@mouhyemen , @kjyv .I have sovle the problem by install sympy 1.0.I installed sympy 1.3 before.

kjyv commented 5 years ago

That's great to hear! Sorry that I haven't been able to look into the problem, I was rather busy lately. I will change the Readme to state sympy 1.0 has to be used. Possibly the line with the error can be changed to work with sympy 1.3 easily.