cmower/optas

`optas.Visualize.sphere` throwing TypeError in Python 3.12

hello-binit opened this issue · 1 comments

Hello, thanks for creating this library! I ran into a bug trying to visualize a sphere in Python 3.12. I know 3.12 isn't listed as an supported platform (https://github.com/cmower/optas#support), but I thought this might be helpful if you're intending to support 3.12 in the future.

Steps to reproduce:

  1. Create a 3.12 environment (e.g. mamba create -n optas python=3.12)
  2. Copy the following into a script and run it:
from optas.visualize import Visualizer

vis = Visualizer(camera_position=[3, 3, 3])
vis.sphere(position=[0.0, 0.0, 0.0], radius=0.01, rgb=[1, 0, 0])
vis.grid_floor()
vis.start()

You'll see an exception like the following:

Traceback (most recent call last):
  File "/home/path/visualize_error.py", line 4, in <module>
    vis.sphere(position=[0.0, 0.0, 0.0], radius=0.01, rgb=[1, 0, 0])
  File "/home/path/miniforge3/envs/optas/lib/python3.12/site-packages/optas/spatialmath.py", line 68, in wrap
    return fun(*args_use, **kwargs_use)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/path/miniforge3/envs/optas/lib/python3.12/site-packages/optas/visualize.py", line 318, in sphere
    sphere.SetThetaResolution(theta_resolution)
TypeError: SetThetaResolution argument 1:

Hi @hello-binit, thanks for your interest in optas and also pointing this out! 😄

Eventually, I and the other developers intend to provide support for recent python versions and also develop optas (new features, etc). However, currently, we do not have the bandwidth.

If you are able to fix this error and add the support for Python 3.12 (show that all test scripts go green) I would be happy to review a PR.