caelan / pybullet-planning

PyBullet Planning
https://pypi.org/project/pybullet-planning/
MIT License
398 stars 113 forks source link

test_turtlebot.py: addition on lists throws TypeError #14

Open abhishek47kashyap opened 10 months ago

abhishek47kashyap commented 10 months ago

python -m examples.test_turtlebot crashes due to this TypeError:

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/abhishek/pybullet-planning/examples/test_turtlebot.py", line 98, in <module>
    main()
  File "/home/abhishek/pybullet-planning/examples/test_turtlebot.py", line 84, in main
    center = (lower + upper)/2. # Computing the center of the AABB
TypeError: unsupported operand type(s) for /: 'list' and 'float'

https://github.com/caelan/pybullet-planning/blob/d536384dca2c890bbbdb5c14f07a3b7580201d8a/examples/test_turtlebot.py#L82-L84

Since lower and upper are both type list, adding them results in concatenation instead of element-wise addition.

yasminedaly commented 8 months ago

Do this and it should work just fine

lower = np.array(lower) upper = np.array(upper) center = (lower + upper) / 2.0