diff --git a/components/orchestration/orchestrator.py b/components/orchestration/orchestrator.py index 7e8054e..35910a2 100644 --- a/components/orchestration/orchestrator.py +++ b/components/orchestration/orchestrator.py @@ -1,3 +1,4 @@ +import datetime import pickle import sys from random import randrange @@ -69,7 +70,8 @@ class Orchestrator: target_vel = randrange(0, 130) print('Target velocity: {}'.format(target_vel)) response_channel.send(pickle.dumps( - TargetVelocity(vin=received_daf_object.vehicle_identification_number, target_velocity=target_vel))) + TargetVelocity(vin=received_daf_object.vehicle_identification_number, target_velocity=target_vel, + timestamp=datetime.datetime.now()))) def handle_tl_state_receive(self, msg): """ diff --git a/components/shared/dse_shared_libs/target_velocity.py b/components/shared/dse_shared_libs/target_velocity.py index 8936573..620c53b 100644 --- a/components/shared/dse_shared_libs/target_velocity.py +++ b/components/shared/dse_shared_libs/target_velocity.py @@ -1,10 +1,15 @@ from dataclasses import dataclass +from datetime import datetime @dataclass class TargetVelocity: vin: str target_velocity: float + timestamp: datetime def to_dict(self): - return self.__dict__ + return {'vin': self.vin, + 'target_velocity': self.target_velocity, + 'timestamp': self.timestamp.timestamp() + }