Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orientation issues with CARLA ego-vehicle spawning? #313

Open
rohanb2018 opened this issue Jun 10, 2020 · 0 comments
Open

Orientation issues with CARLA ego-vehicle spawning? #313

rohanb2018 opened this issue Jun 10, 2020 · 0 comments

Comments

@rohanb2018
Copy link

Hello, I noticed that there seemed to be two issues in the processing of spawn points passed to the CARLA ego-vehicle node.

Issue 1: Refers to the code here.

In the code snippet I referenced, it seems that spawn_point_param (provided through the spawn_point ROS parameter) is intended to be in the CARLA default (left-handed) coordinate system, and that self.actor_spawnpoint is intended to be in the ROS ENU (right-handed) coordinate system. When self.actor_spawnpoint is being created, however, it seems that although the position is being converted appropriately, the orientation is not being transformed into the ROS coordinate system.

To fix the problem, I ended up applying the carla_rotation_to_ros_quaternion utility function located in carla_ros_bridge/transforms.py (here) to the RPY values coming from the user.

Are my assumptions correct about what coordinate frames spawn_point_param and self.actor_spawnpoint are in?

Issue 2: Refers to the code here.

It seems that the roll and pitch values are being ignored entirely when spawning the vehicle - is this intentional?

I noticed that if the vehicle is given an initial spawn point (through the spawn-point ROS parameter) with RPY = (0, -180, 0), then the spawn_point variable actually ends up having a yaw angle of +180. I checked the RPY values given by euler_from_quaternion and they seem to be RPY = (180, 0, 180), which explains things.

My hypothesis is that this occurs because of gimbal lock, which makes it possible for multiple sets of RPY angles to correspond to the same 3D orientation in space. The issue is when we convert from RPY to quaternion and then back to RPY, we may not land up with the same RPY set that we started with. So when we truncate the roll and pitch angles, this might actually corrupt our final rotational state. This only seemed to happen when the pitch was sufficiently high, which is not a very realistic orientation for a vehicle.

My solution was to add the roll and pitch angles back in, so that at least the original 3D orientation would always be preserved (even if the RPY values change). I also again tried to account for the fact that self.actor_spawnpoint is in the ROS ENU (right-handed) frame, while spawn_point should be in the left-handed CARLA coordinate frame, by inverting the transform found here, which actually ends up being the same transformation.

@rohanb2018 rohanb2018 changed the title Orientation issues in CARLA ego-vehicle node? Orientation issues with CARLA ego-vehicle spawning? Jun 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant