ros-bridge
ros-bridge copied to clipboard
Wrong conversion from CARLA coordinate system to ROS coordinate system?
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.
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.
Only if folks who build ROS and CARLA knew graphics, we wouldn't have to do these conversions.
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 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 , 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.