robotarium / robotarium_python_simulator

A Python simulator for the Robotarium! See your algorithm run on real robots!
MIT License
111 stars 58 forks source link

Error while running the examples - TypeError: __init__() takes 4 positional arguments but 5 were given #20

Open dingusagar opened 2 months ago

dingusagar commented 2 months ago

I was trying to setup on macOS and play around with some examples. But it gives the following error while running an example - python rps/examples/go_to_point/si_go_to_point.py

Traceback (most recent call last):
  File "/Users/dingusagar/fun/robotarium_python_simulator/rps/examples/go_to_point/si_go_to_point.py", line 14, in <module>
    r = robotarium.Robotarium(number_of_robots=N, show_figure=True, initial_conditions=initial_conditions, sim_in_real_time=False)
  File "/Users/dingusagar/fun/robotarium_python_simulator/rps/robotarium.py", line 16, in __init__
    super().__init__(number_of_robots, show_figure, sim_in_real_time, initial_conditions)
  File "/Users/dingusagar/fun/robotarium_python_simulator/rps/robotarium_abc.py", line 82, in __init__
    p = patches.Rectangle((self.poses[:2, i]+self.robot_length/2*np.array((np.cos(self.poses[2, i]+math.pi/2), np.sin(self.poses[2, i]+math.pi/2)))+\
TypeError: __init__() takes 4 positional arguments but 5 were given

My dependencies output from pip freeze.

contourpy==1.2.1
cvxopt==1.3.2
cycler==0.12.1
fonttools==4.52.1
importlib_resources==6.4.0
kiwisolver==1.4.5
matplotlib==3.9.0
numpy==1.26.4
packaging==24.0
pillow==10.3.0
pyparsing==3.1.2
python-dateutil==2.9.0.post0
-e git+ssh://git@github.com/robotarium/robotarium_python_simulator.git@02fc776f6174ca37bfbc4eb2bbbeb9964fe71860#egg=robotarium_python_simulator
scipy==1.13.1
six==1.16.0
zipp==3.19.0

looks like there is some issue with the number of arguments given to matplotlib.patches.Rectangle. Is there a specific version that I have to install to fix it? the same issue is present for matplotlib.patches.Circle too.

Jude200 commented 2 months ago

1 . install matplotlib 3.7.0 or

  1. named the 'angle' argument of the function (patches.Rectangle) in the file "robotarium_python_simulator/rps/robotarium_abc.py" like this: Capture d'écran 2024-06-04 152031