BerkeleyLearnVerify / Scenic

A compiler and scenario generator for the Scenic scenario description language.
https://scenic-lang.org/
Other
256 stars 91 forks source link

Support for Webots Versions <= 2022b #260

Open abanuelo opened 2 months ago

abanuelo commented 2 months ago

System Details

  1. Python Version: 3.10.12
  2. Scenic Version: 3.0.0b2
  3. Operating System / Platform: Linux
  4. Simulator Version: Webots 2022a

Detailed Description

  1. Description: If you try to run any webots example file from the examples/webots folder with a version of Webots < 2022b, it throws an error:
  2. Scenic command: Not applicable
  3. Error Log within Webots Console:
    ERROR: '/home/abanuelo/Scenic/examples/webots/vacuum/worlds/create.wbt':3:1: error: Expected node or PROTO name, found 'EXTERNPROTO'.
    ERROR: '/home/abanuelo/Scenic/examples/webots/vacuum/worlds/create.wbt': Failed to load due to syntax error(s).

Steps To Reproduce

  1. Load the world file .wbt into webots for any given example in the examples/webots folder.
  2. Once you do it will throw the following error in the Webots console Screenshot 2024-05-08 at 11 58 37 AM

Question: Do we want to support older version of webots? My guess is no given there were many breaking changes to the interface as described here: https://cyberbotics.com/doc/guide/from-2022a-to-2022b

Issue Submission Checklist

Eric-Vin commented 2 months ago

In this case it's the Webots world files themselves that are incompatible with < Webots 2022b, so it's entirely Webots that broke backwards compatibility and Scenic is completely unrelated. Regardless I don't think there's a pressing need to spend time adding support for old Webots versions unless there's a compelling reason, though it would be good to maintain support for any versions we currently support as long as it's not too much additional work.

abanuelo commented 2 months ago

Will follow up with documentation updates and .wbt file updates!

abanuelo commented 2 months ago

Version of Webots 2022b isn't entirely backward compatible with some of the working examples in the repo. Namely if you run the adhoc.wbt file it throws:

./webots --stdout --stderr 
WARNING: '/home/ubuntu/Scenic/examples/webots/generic/webots_data/worlds/adhoc.wbt': This file was created by Webots R2023a while you are using Webots R2022b. Forward compatibility may not work.
WARNING: '/home/ubuntu/Scenic/examples/webots/generic/webots_data/worlds/adhoc.wbt': This file was created by Webots R2023a while you are using Webots R2022b. Forward compatibility may not work.
WARNING: '/home/ubuntu/.cache/Cyberbotics/Webots/assets/0dcadc7dae2ab58631659c60077ade08949c5518': This file was created by Webots R2023a while you are using Webots R2022b. Forward compatibility may not work.
WARNING: '/home/ubuntu/.cache/Cyberbotics/Webots/assets/1d3a23272010fb5f44e231f939f3d35fd911f51e': This file was created by Webots R2023a while you are using Webots R2022b. Forward compatibility may not work.
INFO: scenic_supervisor: Starting controller: python3 -u scenic_supervisor.py
WARNING: '/home/ubuntu/Scenic/examples/webots/generic/webots_data/protos/ScenicObjectWithPhysics.proto': This file was created by Webots R2023a while you are using Webots R2022b. Forward compatibility may not work.
Traceback (most recent call last; use -b to show Scenic internals):
  File "/home/ubuntu/Scenic/examples/webots/generic/webots_data/controllers/scenic_supervisor/scenic_supervisor.py", line 16, in <module>
    simulator.simulate(scene, verbosity=2)
  File "/home/ubuntu/Scenic/src/scenic/simulators/webots/simulator.py", line 56, in createSimulation
    return WebotsSimulation(
  File "/home/ubuntu/Scenic/src/scenic/simulators/webots/simulator.py", line 82, in __init__
    super().__init__(scene, timestep=timestep, **kwargs)
  File "/home/ubuntu/Scenic/src/scenic/simulators/webots/simulator.py", line 85, in setup
    super().setup()
  File "/home/ubuntu/Scenic/src/scenic/simulators/webots/simulator.py", line 173, in createObjectInSimulator
    densityField = getFieldSafe(webotsObj, "density")
  File "/home/ubuntu/Scenic/src/scenic/simulators/webots/simulator.py", line 280, in getFieldSafe
    if isinstance(field._ref, ctypes.c_void_p) and field._ref.value is not None:
AttributeError: 'Field' object has no attribute '_ref'
Loading Scenic scenario ../../../adhoc.scenic
Starting new simulation...
  Starting simulation 1...
WARNING: 'scenic_supervisor' controller exited with status: 1.
./webots: line 102:  3757 Segmentation fault      (core dumped) "$webots_home/bin/webots-bin" "$@"

I will add to the documentation that support for versions 2023a and above will be the defacto standard.