carla-simulator / carla

Open-source simulator for autonomous driving research.
http://carla.org
MIT License
11.17k stars 3.6k forks source link

Incorrect Vector Rotation Calculation in PythonAPI agents.tools.misc #8075

Open ZiyuZ opened 1 month ago

ZiyuZ commented 1 month ago

CARLA version: 0.9.15 Platform/OS: Python Code Problem you have experienced: Incorrect Vector Rotation Calculation

I found an issue in the carla/agents/tools/misc.py file regarding the calculation of rotated vectors. The relevant code is as follows:

rotated_x = math.cos(radians) * x - math.sin(radians) * y
rotated_y = math.sin(radians) * x - math.cos(radians) * y

The calculation for rotated_y should be rotated_y = math.sin(radians) * x + math.cos(radians) * y

ZiyuZ commented 1 month ago

btw, in Line 60

point = rotate_point(carla.Vector3D(0, 0, area_ext.z), math.radians(base_rot))

This seems to do nothing because both x and y are 0.