|
@@ -13,7 +13,6 @@ import os
|
|
|
save_dir = r'C:\logs'
|
|
|
|
|
|
|
|
|
-
|
|
|
class MessageListener(object):
|
|
|
"""
|
|
|
"""
|
|
@@ -31,13 +30,53 @@ class MessageListener(object):
|
|
|
log_file_path = os.path.join(save_dir, file_name)
|
|
|
log_dict = json.loads(message.payload)
|
|
|
log_list = [
|
|
|
- f"timestamp: {methods.ts_to_string(int(log_dict.get('timestamp'))/1000)}",
|
|
|
+
|
|
|
+ f"timestamp: {methods.ts_to_string(int(log_dict.get('timestamp')) / 1000)}",
|
|
|
f"userID: {log_dict.get('userID')}",
|
|
|
f"VehicleID: {log_dict.get('VehicleID')}",
|
|
|
+
|
|
|
f"directSwitch: {log_dict.get('baseControl')[0].get('directSwitch')}",
|
|
|
- f"eStop: {log_dict.get('eStop')[0].get('eStop')}",
|
|
|
- f"gearCaontrol: {log_dict.get('gearCaontrol')[0].get('gearCaontrol')}",
|
|
|
- f"hazardLight: {log_dict.get('hazardLight')[0].get('hazardLight')}",
|
|
|
+ f"eStop: {log_dict.get('baseControl')[0].get('eStop')}",
|
|
|
+ f"gearCaontrol: {log_dict.get('baseControl')[0].get('gearCaontrol')}",
|
|
|
+ f"hazardLight: {log_dict.get('baseControl')[0].get('hazardLight')}",
|
|
|
+ f"keyStatus: {log_dict.get('baseControl')[0].get('keyStatus')}",
|
|
|
+ f"parkControl: {log_dict.get('baseControl')[0].get('parkControl')}",
|
|
|
+ f"silencedAlarm: {log_dict.get('baseControl')[0].get('silencedAlarm')}",
|
|
|
+ f"travelLight: {log_dict.get('baseControl')[0].get('travelLight')}",
|
|
|
+ f"travelMode: {log_dict.get('baseControl')[0].get('travelMode')}",
|
|
|
+ f"vehicleHorn: {log_dict.get('baseControl')[0].get('vehicleHorn')}",
|
|
|
+
|
|
|
+ f"accPedalF: {log_dict.get('driveControl')[0].get('accPedal')[0].get('accPedalF')}",
|
|
|
+ f"accPedalH: {log_dict.get('driveControl')[0].get('accPedal')[0].get('accPedalH')}",
|
|
|
+
|
|
|
+ f"accPedalH: {log_dict.get('driveControl')[0].get('brakePedal')}",
|
|
|
+ f"steeringWheel: {log_dict.get('driveControl')[0].get('steeringWheel')}",
|
|
|
+ f"turnMode: {log_dict.get('driveControl')[0].get('turnMode')}",
|
|
|
+ f"turnSignal: {log_dict.get('driveControl')[0].get('turnSignal')}",
|
|
|
+
|
|
|
+ f"errAccPedal: {log_dict.get('errCode')[0].get('errAccPedal')}",
|
|
|
+ f"errBasOperation: {log_dict.get('errCode')[0].get('errBasOperation')}",
|
|
|
+ f"errBrakePedal: {log_dict.get('errCode')[0].get('errBrakePedal')}",
|
|
|
+ f"errEndTool: {log_dict.get('errCode')[0].get('errEndTool')}",
|
|
|
+ f"errHandle: {log_dict.get('errCode')[0].get('errHandle')}",
|
|
|
+ f"errOther: {log_dict.get('errCode')[0].get('errOther')}",
|
|
|
+ f"errSteeringWheel: {log_dict.get('errCode')[0].get('errSteeringWheel')}",
|
|
|
+
|
|
|
+ f"baseLegControl: {log_dict.get('taskControl')[0].get('baseLegControl')}",
|
|
|
+ f"baseLegSwitch: {log_dict.get('taskControl')[0].get('baseLegSwitch')}",
|
|
|
+ f"bypassSwitch: {log_dict.get('taskControl')[0].get('bypassSwitch')}",
|
|
|
+ f"cabLift: {log_dict.get('taskControl')[0].get('cabLift')}",
|
|
|
+ f"coopSignal: {log_dict.get('taskControl')[0].get('coopSignal')}",
|
|
|
+ f"enableHydraulic: {log_dict.get('taskControl')[0].get('enableHydraulic')}",
|
|
|
+ f"endJoint: {log_dict.get('taskControl')[0].get('endJoint')}",
|
|
|
+ f"esCabLift: {log_dict.get('taskControl')[0].get('esCabLift')}",
|
|
|
+ f"suckerSelect: {log_dict.get('taskControl')[0].get('suckerSelect')}",
|
|
|
+ f"taskJoint_1: {log_dict.get('taskControl')[0].get('taskJoint_1')}",
|
|
|
+ f"taskJoint_2: {log_dict.get('taskControl')[0].get('taskJoint_2')}",
|
|
|
+ f"taskJoint_3: {log_dict.get('taskControl')[0].get('taskJoint_3')}",
|
|
|
+ f"toolControl: {log_dict.get('taskControl')[0].get('toolControl')}",
|
|
|
+ f"workLight: {log_dict.get('taskControl')[0].get('workLight')}",
|
|
|
+
|
|
|
]
|
|
|
|
|
|
|
|
@@ -47,7 +86,7 @@ class MessageListener(object):
|
|
|
|
|
|
if not MessageListener.log_key:
|
|
|
MessageListener.log_key = '-'.join(log_list[1:])
|
|
|
-
|
|
|
+
|
|
|
print(f'MessageListener24: #log_list: {log_list}', flush=True)
|
|
|
methods.write_text(log_file_path, ' | '.join(log_list) + '\n', 'a')
|
|
|
|
|
@@ -68,7 +107,7 @@ class MessageListener(object):
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -85,6 +124,7 @@ class MessageListener(object):
|
|
|
for thread in thread_list:
|
|
|
thread.join()
|
|
|
|
|
|
+
|
|
|
if __name__ == '__main__':
|
|
|
|
|
|
MessageListener.run()
|