-
Notifications
You must be signed in to change notification settings - Fork 2
Vehicle Controller
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.
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.
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.
Calculates the steering angle by the stanley-method
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.
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
Uses Predicitions of position of the car in the futur by using the StanleySteeringController for calculating the steering angle
Uses StanleyController on straights and NaiveSteeringController in curves
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.
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 |