petercorke / robotics-toolbox-python

Robotics Toolbox for Python
MIT License
2.08k stars 433 forks source link

Unicycle model str and deriv function raises traces #333

Closed pauloone closed 1 year ago

pauloone commented 2 years ago

Describe the bug I tryied to use the Unicycle mobile model, and the str function did not work, as well as the diff function

Version information

Did you install from PyPI or GitHub? PyPi If PyPI what version number? 1.0.2 If GitHub what commit hash?

Robotics Toolbox depends heavily on two other packages: Swift (3D graphics) and SpatialMath toolbox (underpinning maths utilities). If you think your issue is related to these, then please answer the questions above for them.

To Reproduce Steps to reproduce the behavior:

  1. The shortest, complete, Python script that exhibits the bug.
    uni = Unicycle()
    str(uni)

and

uni = Unicycle()
state = np.r_[0, 0, 0]
input = [1, 0] # no rotation
uni.deriv(state, input)
  1. The script output, including error messages.
    Traceback (most recent call last):
    File "/home/<redacted>/simple_movement.py", line 12, in <module>
    print(uni)
    File "/home/<redacted>/roboticstoolbox/mobile/Vehicle.py", line 1076, in __str__
    s += f"\n  W={self._w}, steer_max={self._steer_max}, vel_max={self._vel_max}, accel_max={self.accel_max}"
    AttributeError: 'Unicycle' object has no attribute '_steer_max'

and for the second

AttributeError: 'Unicycle' object has no attribute 'w'

Expected behavior A clear and concise description of what you expected to happen. str should return a string describing the instance deriv should return the derivative state of a unicycle robot

Screenshots If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

Additional context I will provide an PR with the fixes

pauloone commented 2 years ago

Link to the MR: https://github.com/petercorke/robotics-toolbox-python/pull/334