umich_sim.sim_backend.carla_modules package#

Submodules#

umich_sim.sim_backend.carla_modules.camera_manager module#

class umich_sim.sim_backend.carla_modules.camera_manager.CameraManager#

Bases: object

Manage graphics stuffs with carla

next_sensor()#
render(display)#
set_sensor(index, notify=True)#
toggle_camera()#
toggle_recording()#

umich_sim.sim_backend.carla_modules.collision_sensor module#

class umich_sim.sim_backend.carla_modules.collision_sensor.CollisionSensor#

Bases: object

Sensor to get the car collision data with the environment

get_collision_history()#

umich_sim.sim_backend.carla_modules.ego_vehicle module#

class umich_sim.sim_backend.carla_modules.ego_vehicle.EgoVehicle(blueprint=None, spawn_point=None)#

Bases: Vehicle

Vehicle class is a wrapper for carla vehicle apis and is combined with wizard switching functions. It also owns the drivers for the racing wheels. The class is a singleton.

change_steer(val: float = 0.05)#

change steer by value :param val: value to change

change_throttle(val: float = 0.05)#

change current throttle by val :param val: value to change

change_vehicle(blueprint, spawn_point)#

Using carla api to change the current vehicle

destroy()#

destroy the vehicle TODO: change to destructor

get_control()#

From carla api

get_driver_name() str#

Get the current driver as string

static get_instance()#

get the instance of the singleton

get_transform() Transform#

from carla Vehicle api

get_velocity() Vector3D#

from carla Vehicle api

kb_set_brake(val: float)#

set the vehicle brake value

kb_set_steer(val: float = 0)#

set steer :param val: value to set

lane_effect_update()#
  1. Calculate the distance from four wheels to the center of the lane

2. Update rumbling and lane-departure-warning status Return:

if_rumble: True if rumbling is needed if_ldw: True if ldw is needed

ldw_handler(if_ldw)#
set_brake(data: InputPacket)#

set the vehicle brake value

set_collision()#
set_reverse(dev: ClientMode, val: bool)#

Set the inverse mode of the vehicle

set_steer(data: InputPacket)#

set the vehicle steer value

set_throttle(data: InputPacket)#

set the vehicle throttle value

set_vehicle(vehicle: Vehicle)#

set vehicle from outside :param vehicle: carla vehicle to set

start()#
start_rumble()#
stop_rumble()#
switch_driver()#

Switch the current driver, wizard should be enabled

toggle_ldw()#

Toggle the lane departure warning system

toggle_reverse()#

Toggle the reverse mode of the vehicle

update() None#

Update the vehicle status

umich_sim.sim_backend.carla_modules.gnss_sensor module#

class umich_sim.sim_backend.carla_modules.gnss_sensor.GnssSensor#

Bases: object

Sensor to collect geographical data

umich_sim.sim_backend.carla_modules.hud module#

Welcome to CARLA manual control with steering wheel Logitech G29. To drive start by preshing the brake pedal. Change your wheel_config.ini according to your steering wheel. To find out the values of your steering wheel use jstest-gtk in Ubuntu.

class umich_sim.sim_backend.carla_modules.hud.FadingText(font, dim, pos)#

Bases: object

render(display)#
set_text(text, color=(255, 255, 255), seconds=2.0)#
tick(_, clock)#
class umich_sim.sim_backend.carla_modules.hud.HUD(width, height)#

Bases: object

Singleton class HUD for gui controls

error(text)#
static get_instance()#
notification(text, seconds=2.0)#
on_world_tick(timestamp)#
render(display)#
tick(clock)#
toggle_info()#
class umich_sim.sim_backend.carla_modules.hud.HelpText(font, width, height)#

Bases: object

render(display)#
toggle()#

umich_sim.sim_backend.carla_modules.imu_sensor module#

class umich_sim.sim_backend.carla_modules.imu_sensor.IMUSensor#

Bases: object

Sensor to collect IMU data

umich_sim.sim_backend.carla_modules.lane_invasion_sensor module#

class umich_sim.sim_backend.carla_modules.lane_invasion_sensor.LaneInvasionSensor#

Bases: object

Sensor to detect Lane Invasion

umich_sim.sim_backend.carla_modules.module_helper module#

class umich_sim.sim_backend.carla_modules.module_helper.DefaultSettings#

Bases: object

autopilot = False#
filter = 'vehicle.*'#
gamma = 2.2#
generation = '2'#
rolename = 'hero'#
sync = True#
umich_sim.sim_backend.carla_modules.module_helper.find_weather_presets()#
umich_sim.sim_backend.carla_modules.module_helper.get_actor_blueprints(world, filter, generation)#
umich_sim.sim_backend.carla_modules.module_helper.get_actor_display_name(actor, truncate=250)#

umich_sim.sim_backend.carla_modules.vehicle module#

Backend - Vehicle Class Created on Tue February 15, 2022

Summary: The Vehicle class represents a single vehicle in the CARLA simulation environment. It stores

all relevant information for a single instance. Provides a high level interface for controlling a vehicle’s motion through a Controller class.

class umich_sim.sim_backend.carla_modules.vehicle.Vehicle(carla_vehicle: Vehicle, name: str, type_id: VehicleType, target_distance: float = 10.0, straight_speed: float = 35.0, turning_speed: float = 25.0, breaking_distance: float = 20.0)#

Bases: object

advance_section() None#

Advances this vehicle to the next section.

If the vehicle is the ego vehicle, this section will become active and all initial vehicles at this section will become active.

Returns:

None

apply_control(new_control: VehicleControl) None#

Updates the control state being applied to the Vehicle.

Provides a wrapper around the carla.Vehicle.apply_control function.

Parameters:

new_control – the carla.VehicleControl to apply to the Vehicle

Returns:

None

check_vehicle_in_back() Tuple[bool, float]#

Determines if there is a vehicle behind this vehicle.

Returns:

a tuple containing whether there is a vehicle in back and the distance if there is a vehicle in back.

check_vehicle_in_front() Tuple[bool, float]#

Determines if there is a vehicle in front of this vehicle.

Returns:

a tuple containing whether there is a vehicle in front and the distance if there is a vehicle in front.

check_vehicle_to_left() Tuple[bool, float]#

Determines if there is a vehicle to the left of this vehicle.

Returns:

a tuple containing whether there is a vehicle to the left and the distance if there is a vehicle to the left.

check_vehicle_to_right() Tuple[bool, float]#

Determines if there is a vehicle to the right of this vehicle.

Returns:

a tuple containing whether there is a vehicle to the right and the distance if there is a vehicle to the right.

draw_waypoints() None#

Draws the waypoints and trajectory that the vehicle is following.

Parameters:

world – a carla.World object representing the current simulator world.

Returns:

None

get_current_location() Location#

Gets the current Location of the vehicle.

Returns:

the current position of the Vehicle a carla.Location

get_current_rotation() float#

Gets the current rotation of the vehicle (yaw).

Returns:

the current rotation of the vehicle as a float

get_current_speed(units='kmh') float#

Gets the current forward speed of the Vehicle.

Parameters:

units – Specifies the units that the speed should be returned in. Either “kmh” or “mph”

Returns:

the current forward speed of the Vehicle as a float

get_location_vector(dims=3) array#

Getter for the current location of the Vehicle as a numpy.array with length three

Parameters:

dims – number of dimensions that the output vector will have (either 2 or 3)

Returns:

the current location of the vector as a numpy.array

get_vehicle_size() Vector3D#

Gets the size of the vehicle’s bounding box as a width, length tuple.

If this function doesn’t work as intended, blame Austin :return: the width and length of the vehicle as a tuple

has_path()#

Getter for whether the Vehicle has an initialized path to follow.

Returns:

True if the vehicles path was initialized, and false otherwise

id = 0#
move_vehicle_location(new_position: Transform) None#

Updates the position of the Vehicle to a new position.

Parameters:

new_position – a carla.Transform representing the new location of the vehicle

Returns:

None

set_active_sections(starting_section, ending_section) None#

Sets the beginning and ending sections of the Vehicle

Parameters:
  • starting_section – the section the Vehicle will start at

  • ending_section – the section the Vehicle will end at

Returns:

None

toggle_left_blinker()#

Toggle the left blinker of the vehicle

toggle_right_blinker()#

Toggle the right blinker of the vehicle

update_other_vehicle_locations(other_vehicles: List) None#

Updates the internal list with the transforms of all other Vehicles in the simulation.

Also stores the vehicle length of all other vehicles in the Simulation. This enables distance calculates to take into account bumper to bumper distance

Parameters:

other_vehicles – a List of all other Vehicles in the Simulation

Returns:

None

umich_sim.sim_backend.carla_modules.world module#

class umich_sim.sim_backend.carla_modules.world.World(client: Client, hud, actor_filter, map_name: Optional[str] = None)#

Bases: object

Carla world object

destroy()#

TODO: change to destructor

static get_instance()#
next_weather(reverse=False)#
register_death(actor)#

Register the actors to be destroyed, actor should have destroy method

render(display)#
restart()#

Module contents#

modules interfacing carla directly