anki / vector-python-sdk

Anki Vector Python SDK
Other
559 stars 383 forks source link

List animations frequently causes a timeout #51

Open TylerGubala opened 2 years ago

TylerGubala commented 2 years ago

With the majority of the examples that I run from this repo, I get the following error:

Exception has occurred: VectorTimeoutException
StatusCode.DEADLINE_EXCEEDED: ListAnimations request timed out

Message took too long to complete.

  File "D:\Code\vector-python-sdk\anki_vector\connection.py", line 749, in log_handler
    result = await func(*args, **kwargs)
  File "D:\Code\vector-python-sdk\anki_vector\animation.py", line 168, in load_animation_list
    return await self._load_animation_list()
  File "D:\Code\vector-python-sdk\anki_vector\animation.py", line 134, in _load_animation_list
    result = await self.grpc_interface.ListAnimations(req)

The above exception was the direct cause of the following exception:

  File "D:\Code\vector-python-sdk\anki_vector\connection.py", line 751, in log_handler
    raise connection_error(rpc_error) from rpc_error
  File "D:\Code\vector-python-sdk\anki_vector\connection.py", line 806, in result
    return future.result()
  File "D:\Code\vector-python-sdk\anki_vector\robot.py", line 663, in connect
    anim_request = self._anim.load_animation_list()
  File "D:\Code\vector-python-sdk\anki_vector\robot.py", line 742, in __enter__
    self.connect(self.behavior_activation_timeout)
  File "D:\Code\vector-python-sdk\examples\tutorials\01_hello_world.py", line 27, in main
    with anki_vector.Robot(args.serial) as robot:
  File "D:\Code\vector-python-sdk\examples\tutorials\01_hello_world.py", line 33, in <module>
    main()

Any idea what is causing this?

thesmatt commented 1 year ago

It is SDK code no longer supported by most recent python. Revert to 3.7.5 to prevent all these errors.

sam1am commented 1 year ago

Even with python 3.7.5 I get this same error.

ninp0 commented 1 year ago

Somewhat of a hack but changing the behavior_activation_timeout value and setting cache_animation_lists=False at startup seems to eliminate the issue for me:

    robot = anki_vector.Robot(
      show_viewer=True,
      show_3d_viewer=True,
      enable_face_detection=True,
      enable_custom_object_detection=True,
      enable_nav_map_feed=True,
      behavior_activation_timeout=30.0,
      cache_animation_lists= False
    )
$ python --version
Python 3.11.2