Skip to content

Commit

Permalink
Minor Misc Fixes (#279)
Browse files Browse the repository at this point in the history
* Modified pruning test.

* Webots example fix and docs minor update.

* Update tests/syntax/test_pruning.py

Co-authored-by: Daniel Fremont <[email protected]>

* Made path general.

---------

Co-authored-by: Daniel Fremont <[email protected]>
  • Loading branch information
Eric-Vin and dfremont authored Jun 11, 2024
1 parent 7126916 commit 0c667bd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions docs/reference/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ localPath
---------
The `localPath` function takes a relative path with respect to the directory containing the ``.scenic`` file where it is used, and converts it to an absolute path. Note that the path is returned as a `pathlib.Path` object.

.. versionchanged:: 3.0

This function now returns a `pathlib.Path` object instead of a string.

.. _verbosePrint_func:

verbosePrint
Expand Down
6 changes: 3 additions & 3 deletions examples/webots/city_intersection/city_intersection.scenic
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ class LogImageAction(Action):
def applyTo(self, obj, sim):
print("Other Car Visible:", self.visible)

target_path = self.path + "/"
target_path += "visible" if self.visible else "invisible"
target_path = self.path
target_path /= "visible" if self.visible else "invisible"

if not os.path.exists(target_path):
os.makedirs(target_path)

target_path += "/" + str(self.count) + ".jpeg"
target_path /= f"{self.count}.jpeg"

print("IMG Path:", target_path)

Expand Down
4 changes: 2 additions & 2 deletions tests/syntax/test_pruning.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ def test_containment_2d_region():

# Test both combined, in a slightly more complicated case.
# Specifically, there is a non vertical component to baseOffset
# that should be accounted for and the height is random.
# that should be accounted for.
scenario = compileScenic(
"""
class TestObject:
baseOffset: (0.1, 0, self.height/2)
workspace = Workspace(PolygonalRegion([0@0, 2@0, 2@2, 0@2]))
ego = new TestObject on workspace, with height Range(0.1,0.5)
ego = new TestObject on workspace, with height 100
"""
)
# Sampling should fail ~30.56% of the time, so
Expand Down

0 comments on commit 0c667bd

Please sign in to comment.