Skip to content

Commit 3a70c2c

Browse files
committed
Add timestamp to control signal
1 parent 35e8600 commit 3a70c2c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

avstack/modules/control/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from .pid import PIDBase, PIDLateralController, PIDLongitudinalController
2+
from .types import VehicleControlSignal
23
from .vehicle import VehiclePIDController
34

45

@@ -7,4 +8,5 @@
78
"PIDLateralController",
89
"PIDLongitudinalController",
910
"VehiclePIDController",
11+
"VehicleControlSignal",
1012
]

avstack/modules/control/types.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
class VehicleControlSignal:
22
def __init__(
33
self,
4+
timestamp=None,
45
throttle=0.0,
56
brake=0.0,
67
steer=0.0,
78
hand_brake=False,
89
reverse=False,
910
manual_gear_shift=False,
1011
):
12+
"""Define the vehicle control signal"""
13+
14+
self.timestamp = timestamp
1115
self.throttle = throttle
1216
self.brake = brake
1317
self.steer = steer
@@ -46,4 +50,4 @@ def __repr__(self):
4650
return self.__str__()
4751

4852
def __str__(self):
49-
return f"VehicleControlSignal -- throttle: {self.throttle}, brake: {self.brake}, steer: {self.steer}"
53+
return f"VehicleControlSignal at time {self.timestamp:.3f} -- throttle: {self.throttle}, brake: {self.brake}, steer: {self.steer}"

0 commit comments

Comments
 (0)