@@ -123,6 +123,11 @@ def __init__(self, conf):
123
123
self .vel_z = 0.0
124
124
self .lidar = []
125
125
126
+ # car in Unity lefthand coordinate system: roll is Z, pitch is X and yaw is Y
127
+ self .roll = 0.0
128
+ self .pitch = 0.0
129
+ self .yaw = 0.0
130
+
126
131
def on_connect (self , client ):
127
132
logger .debug ("socket connected" )
128
133
self .client = client
@@ -260,6 +265,11 @@ def reset(self):
260
265
self .vel_z = 0.0
261
266
self .lidar = []
262
267
268
+ # car
269
+ self .roll = 0.0
270
+ self .pitch = 0.0
271
+ self .yaw = 0.0
272
+
263
273
def get_sensor_size (self ):
264
274
return self .camera_img_size
265
275
@@ -285,6 +295,7 @@ def observe(self):
285
295
"accel" : (self .accel_x , self .accel_y , self .accel_z ),
286
296
"vel" : (self .vel_x , self .vel_y , self .vel_z ),
287
297
"lidar" : (self .lidar ),
298
+ "car" : (self .roll , self .pitch , self .yaw ),
288
299
}
289
300
290
301
# self.timer.on_frame()
@@ -344,6 +355,12 @@ def on_telemetry(self, data):
344
355
self .vel_y = data ["vel_y" ]
345
356
self .vel_z = data ["vel_z" ]
346
357
358
+ if "roll" in data :
359
+ self .roll = data ["roll" ]
360
+ self .pitch = data ["pitch" ]
361
+ self .yaw = data ["yaw" ]
362
+ print (self .roll , self .pitch , self .yaw )
363
+
347
364
# Cross track error not always present.
348
365
# Will be missing if path is not setup in the given scene.
349
366
# It should be setup in the 4 scenes available now.
@@ -358,9 +375,10 @@ def on_telemetry(self, data):
358
375
359
376
try :
360
377
self .lidar = data ["lidar" ]
361
- logger .info ("reading lidar in telemetry package DONE." )
378
+ # logger.info("reading lidar in telemetry package DONE.")
362
379
except :
363
- logger .info ("reading lidar in telemetry package FAILED." )
380
+ pass
381
+ # logger.info("reading lidar in telemetry package FAILED.")
364
382
365
383
self .determine_episode_over ()
366
384
0 commit comments