petercorke / robotics-toolbox-python

Robotics Toolbox for Python
MIT License
2.15k stars 448 forks source link

Inconsistent joint indexes in ETS #393

Open agudym opened 1 year ago

agudym commented 1 year ago

Describe the bug Multiplication (concatenation) of several ETS does not update joint indexes

Version information

roboticstoolbox-python 1.1.0

To Reproduce

import roboticstoolbox as rtb

et = rtb.ET.Rz()
ets = rtb.ETS([et, ])

print((et * et).joints()) # OK:
# [ET.Rz(jindex=0), ET.Rz(jindex=1)]

print((ets * ets).joints()) # NOT OK:
# [ET.Rz(jindex=0), ET.Rz(jindex=0)]

print((et * et *  ets).joints()) # NOT OK:
# [ET.Rz(jindex=0), ET.Rz(jindex=1), ET.Rz(jindex=0)]

print((et *  ets).joints()) # NOT OK:
# raise ValueError( "You can not have some jindices set for the ET's in arg. It must be all")

Expected behavior ETS consctructor should re-enumerate joint indexes

Environment (please complete the following information):

p.s. Awesome work btw :) !!!

agudym commented 1 year ago

If that's a bug (mb it's some "feature"?), I would be glad to help with the investigation