ros-bridge icon indicating copy to clipboard operation
ros-bridge copied to clipboard

Wrong conversion from CARLA coordinate system to ROS coordinate system?

Open gunnxx opened this issue 1 year ago • 4 comments

Hi, I noticed that in carla_rotation_to_RPY function, yaw and pitch are inverted. If CARLA uses left-hand coordinate system (with z-axis up) and ROS uses right-hand coordinate system (with z-axis up), then yaw and roll should be the ones inverted. See figure below. Screenshot from 2022-09-05 15-55-56

I do not know if there is another rule that I missed, because CARLA documentation itself is kind of inconsistent. In the carla.Rotation documentation, the picture shows that the yaw is left-handed but roll and pitch are right-handed.

gunnxx avatar Sep 05 '22 06:09 gunnxx

Only if folks who build ROS and CARLA knew graphics, we wouldn't have to do these conversions.

geyang avatar Oct 03 '22 03:10 geyang

Correct transforms should be like this in transforms.py as mentioned by @gunnxx

RHS (ROS) = LHS (CARLA)

Position:

x_ros = x_carla
y_ros = -y_carla
z_ros = z_carla


Rotation:

roll_ros = -roll_carla
pitch_ros = pitch_carla
yaw_ros = -yaw_carla

UditSinghParihar avatar Nov 14 '22 08:11 UditSinghParihar

@UditSinghParihar you also have to change the default config to spawn ego if you use that one (here). You have to negate the pitch. This is very very inconvenient.

gunnxx avatar Nov 14 '22 08:11 gunnxx

@gunnxx , thanks for the pointer but moving forward I have just changed the tranforms.py and the changes in the objects.json would only be in the right-hand coordinate transform.

UditSinghParihar avatar Nov 14 '22 09:11 UditSinghParihar