Hello, thank you for your work developing Scenic.
I am trying to enforce a minimum distance between objects, but it seems I cannot use objects that are members of a list in a require statement. Ultimately I’d like to enforce a minimum distance between all pairs of objects in a list.
For example, the first “require” in the code snippet works fine, but the other two “require” statements throw “InvalidScenarioError: cannot define distributions inside a requirement (try moving them outside)”.
workspace = Workspace(RectangularRegion((0, 0), 0, 10, 10))
# This works:
cube = new Object on workspace, with shape BoxShape()
sphere = new Object on workspace, with shape SpheroidShape()
minDist = 8
require distance from cube to sphere > minDist
# This doesn't work:
cones = []
for i in range(2):
cones.append(new Object on workspace, with shape ConeShape())
# InvalidScenarioError:
# cannot define distributions inside a requirement (try moving them outside)
require distance from cube to cones[0] > minDist
# InvalidScenarioError:
# cannot define distributions inside a requirement (try moving them outside)
require distance from cube to cones.__getitem__(0) > minDist
Is there another way to do this? Any help is much appreciated! Thanks!