Skip to content

Vehicle Controller

sturdan edited this page Mar 30, 2022 · 9 revisions

About

The Vehicle Controller (DrivingController) returns the DrivingSignal which contains of the target_velocity_mps and the steering angle. It uses different Methods to Control the steering and speed of the vehicle. Furthermore it can detect curves on the trajectory and calculate the possible speed of the car in it.

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.

Steering Control

NaiveSteeringController

It takes 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.

StanleySteeringController

Calculates the steering angle by the stanley-method

Stanley Controller

It combines the heading and crosstrack error for calculating the steering angle. There is an additional PID Conroller with an I component in it to prefent the car from oszilatiating.

References

https://dingyan89.medium.com/three-methods-of-vehicle-lateral-control-pure-pursuit-stanley-and-mpc-db8cc1d32081 http://ai.stanford.edu/~gabeh/papers/hoffmann_stanley_control07.pdf

predictiveStanley

Uses Predicitions of position of the car in the futur by using the StanleySteeringController for calculating the steering angle

predictiveStanley

References

https://www.researchgate.net/publication/347286170_A_path-tracking_algorithm_using_predictive_Stanley_lateral_controller/fulltext/609c290f4585158bf0a36d35/A-path-tracking-algorithm-using-predictive-Stanley-lateral-controller.pdf

CombinedSteering

Uses StanleyController on straights and NaiveSteeringController in curves

curve detection

The curve_detection calculate the Bounds of the next incomming curve by calculating the radii of the points in front. For that it uses the perimeter of Triangle and the Formula in the following Picture to get the target_velocity of the car in this curve.

Curve

Interfaces

Following data interfaces are used for inter-component communication:

CARLA Sensor Topics

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

Input Topics

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)

Output Topics

Topic Message Type Description
/carla/<vehicle_name>/ackermann_cmd ackermann_msgs/AckermannDrive The target speed to be achieved by continuous regulations