-
Notifications
You must be signed in to change notification settings - Fork 2
Vehicle Controller
The Vehicle Controller translates a given set of waypoints, a target velocity and some car sensor data like into actionable driving signals that can be sent to the CARLA simulator. Its' main tasks are steering and speed control.
For controlling the velocity, we figured out a rather simple approach. As the Ackermann Controller already provides some kind of PID, it seems to be sufficient to just forward the target velocity. Of course there will be further experiments on manipulating the acceleration property, which the Ackermann Controller exposes as well. But for a first prototype, this simple approach seems sufficient.
For steering, there had to be done some maths. It turns out that there's a rather simple but powerful approach to computing the steering angle. All it takes is capturing the vehicle's position + orientation and the next waypoint to aim at.
First, we compute the direction in which the car drives by subtracting the vehicle's position from the aim point, providing us with a vector that points to the target direction. This vector can be transformed into the actual direction by applying the math.atan2 function. The direction in which the car's driving is already given as the car's orientation. Finally, we can simply subtract the directions to retrieve the steering angle.
Of course this is really a simple approach for modeling the car, but it seems to work quite well. In some further tasks, we'll be figuring out if applying more complex vehicle models can bring additional enhancements.
Following data interfaces are used for inter-component communication:
Topic | Message Type | Description |
---|---|---|
/carla/<vehicle_name>/odometry | nav_msgs/Odometry | A car sensor for retrieving the vehicle's position (and orientation) |
/carla/<vehicle_name>/imu/imu1 | sensor_msgs/Imu | A car sensor for retrieving the vehicle's orientation (used because odometry didn't work |
Topic | Message Type | Description |
---|---|---|
/drive/<vehicle_name>/target_velocity | std_msgs/Float32 | The target speed to be achieved by regulations |
/drive/<vehicle_name>/local_route | std_msgs/String | The waypoints of the ideal route to be followed as JSON |
/carla/<vehicle_name>/waypoints | nav_msgs/Path | An alternative way to retrieve waypoints, e.g. for running scenarios (it's just a mock-up for global / local planning in test scenarios) |
Topic | Message Type | Description |
---|---|---|
/carla/<vehicle_name>/ackermann_cmd | ackermann_msgs/AckermannDrive | The target speed to be achieved by continuous regulations |