Skip to content

Commit 5924262

Browse files
committed
Added setOrientation functionality to driving domain
1 parent 9b5243e commit 5924262

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

src/scenic/domains/driving/actions.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import numpy as np
1919

2020
from scenic.core.simulators import Action
21+
from scenic.core.type_support import toOrientation
2122
from scenic.core.vectors import Vector
2223

2324
## Mixin classes indicating support for various types of actions.
@@ -108,6 +109,16 @@ def applyTo(self, obj, sim):
108109
obj.setVelocity(vel)
109110

110111

112+
class SetOrientationAction(Action):
113+
"""Set the orientation of an agent."""
114+
115+
def __init__(self, orientation):
116+
self.orientation = toOrientation(orientation)
117+
118+
def applyTo(self, obj, sim):
119+
obj.setOrientation(self.orientation)
120+
121+
111122
## Actions available to vehicles which can steer
112123

113124

src/scenic/domains/driving/model.scenic

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,9 @@ class DrivingObject:
270270
def setVelocity(self, vel):
271271
raise NotImplementedError
272272

273+
def setOrientation(self, orientation):
274+
raise NotImplementedError
275+
273276
class Vehicle(DrivingObject):
274277
"""Vehicles which drive, such as cars.
275278

0 commit comments

Comments
 (0)