MaisJamal / carla_apollo_bridge

This project provides a bridge for communication between the autonomous driving platform Apollo and Carla simulator. Receiving data from Carla, Apollo controls the autonomous vehicle.
Apache License 2.0
53 stars 13 forks source link

why is there a shift * math.cos(heading) in the localization? #2

Closed ThisisKKya closed 1 year ago

ThisisKKya commented 1 year ago

Hello! Thank you for your great work about the carla bridge. The project is awsome, but I have some questions about the code. child.transform.translation.x = x - shift * math.cos(heading) child.transform.translation.y = y - shift * math.sin(heading) Why we need to do this before sending to apollo? And how do you calculate the shift which is 1.355? Is this the key to make the bridge work properly?

MaisJamal commented 1 year ago

Hello, This shift is necessary to map the difference in the origin of two coordination systems. In Apollo, the origin of the vehicle's coordination system is in the middle of the wheels rear axis , while in Carla the origin of the vehicle's coordination system is in the middle of the vehicle's two wheel axes (in vehicle's center). So to find the real location in Apollo map, you should always apply the shifting. I defined the sift value as 1.355 m after I have calculated the distance between rear axis and the center of the vehicle depending on "vehicle parameters" in Apollo.