log dicts instead of object representations
This commit is contained in:
@@ -14,3 +14,13 @@ class DAF:
|
||||
velocity: float
|
||||
near_crash_event: bool
|
||||
timestamp: datetime
|
||||
|
||||
def to_dict(self):
|
||||
return {'vehicle_identification_number': self.vehicle_identification_number,
|
||||
'gps_location': {'latitude': self.gps_location.latitude,
|
||||
'longitude': self.gps_location.longitude
|
||||
},
|
||||
'velocity': self.velocity,
|
||||
'near_crash_event': self.near_crash_event,
|
||||
'timestamp': self.timestamp.timestamp()
|
||||
}
|
||||
|
||||
@@ -5,3 +5,6 @@ from dataclasses import dataclass
|
||||
class TargetVelocity:
|
||||
vin: str
|
||||
target_velocity: float
|
||||
|
||||
def to_dict(self):
|
||||
return self.__dict__
|
||||
|
||||
@@ -9,3 +9,8 @@ class TrafficLightState:
|
||||
tlid: str
|
||||
color: TrafficLightColor
|
||||
last_switch: datetime
|
||||
|
||||
def to_dict(self):
|
||||
return {'tlid': self.tlid,
|
||||
'color': self.color.name,
|
||||
'last_switch': self.last_switch.timestamp()}
|
||||
|
||||
Reference in New Issue
Block a user