gym-carla icon indicating copy to clipboard operation
gym-carla copied to clipboard

AttributeError: 'LidarDetection' object has no attribute 'x'

Open xiaowang304 opened this issue 2 years ago • 5 comments

Traceback (most recent call last): File "C:/Users/wxk/Desktop/saccode/carla/test.py", line 55, in main() File "C:/Users/wxk/Desktop/saccode/carla/test.py", line 44, in main obs = env.reset() File "C:\Users\wxk\anaconda3\envs\highway\lib\site-packages\gym\wrappers\order_enforcing.py", line 42, in reset return self.env.reset(**kwargs) File "C:\Users\wxk\anaconda3\envs\highway\lib\site-packages\gym\wrappers\env_checker.py", line 47, in reset return passive_env_reset_check(self.env, **kwargs) File "C:\Users\wxk\anaconda3\envs\highway\lib\site-packages\gym\utils\passive_env_checker.py", line 238, in passive_env_reset_check result = env.reset(**kwargs) File "C:\Users\wxk\anaconda3\envs\highway\lib\site-packages\gym_carla-0.0.1-py3.8.egg\gym_carla\envs\carla_env.py", line 255, in reset File "C:\Users\wxk\anaconda3\envs\highway\lib\site-packages\gym_carla-0.0.1-py3.8.egg\gym_carla\envs\carla_env.py", line 496, in _get_obs AttributeError: 'LidarDetection' object has no attribute 'x'

xiaowang304 avatar Oct 09 '22 02:10 xiaowang304

Maybe ur CARLA version like me, is not 0.9.6. u can try add 'location = location.point' before 'point_cloud.append([location.x, location.y, -location.z])' at line 499 in 'carla_env.py'.

slowdive500 avatar Oct 30 '22 08:10 slowdive500

This problem is that your CARLA version is not 0.9.6, more like 0.9.8 or 0.9.10.

Tangzj2020 avatar Nov 02 '22 15:11 Tangzj2020

@xiaowang304 your CARLA version look at not 0.9.6, other version I've solved this problem with this setting: change this line, point_cloud.append([location.x, location.y, -location.z]) to the line, point_cloud.append([location.point.x, location.point.y, location.point.z]) at line 499 in 'carla_env.py'.

Tangzj2020 avatar Dec 06 '22 05:12 Tangzj2020

More precisely, in Carla0.9.14, this should be changed to point_cloud.append([location.point.y, -location.point.x,-location.point.z]) to ensure that the visualization is correct at the same time

Derkai52 avatar Mar 17 '23 05:03 Derkai52

I met the same question too,however it's no use for me when I change the code, and my brand is 0.9.13

sunaining avatar Oct 06 '23 08:10 sunaining