smarts.core.controllers.lane_following_controller module

class smarts.core.controllers.lane_following_controller.LaneFollowingController[source]

A controller that attempts to follow road waypoints along the vehicle’s plan.

Requires the controlled vehicle to have an Ackermann chassis.

static calculate_lateral_gains(sim, state, vehicle, desired_poles, target_speed)[source]

Update the state lateral gains

static find_current_lane(wp_paths, vehicle_position)[source]

Find the lane of the vehicle given a set of waypoint paths.

heading_error = -15
lateral_error = -35
classmethod perform_lane_following(sim, agent_id: str, vehicle, controller_state: LaneFollowingControllerState, sensor_state, target_speed: float = 12.5, lane_change: int = 0)[source]

Control a vehicle

Parameters:
  • sim – The simulator instance.

  • agent_id – The id of the agent controlling the vehicle. XXX: unsure why this is needed

  • vehicle – The vehicle that is to be controlled.

  • controller_state – The previous controller state from this controller.

  • sensor_state – The current sensor state from the vehicle’s sensors.

  • target_speed – The baseline target speed (controller may give more or less regardless.)

  • lane_change – Lane index offset from vehicle’s current lane.

static place_poles(A: ndarray, B: ndarray, poles: ndarray) ndarray[source]

Given a linear system described by ẋ = Ax + Bu, compute the gain matrix K such that the closed loop eigenvalues of A - BK are in the desired pole locations.

References

side_slip_angle = -3
yaw_rate = -2
class smarts.core.controllers.lane_following_controller.LaneFollowingControllerState(target_lane_id)[source]

Controller state