umich_sim.sim_backend package#

Subpackages#

Submodules#

umich_sim.sim_backend.helpers module#

Backend - Helpers Created on Tue February 15, 2022

Summary: The Helpers file defines and implements various helper functions and classes that are needed

throughout the backend.

class umich_sim.sim_backend.helpers.ExperimentType(value)#

Bases: IntEnum

An enumeration.

FREEWAY = 1#
INTERSECTION = 0#
class umich_sim.sim_backend.helpers.VehicleType(value)#

Bases: IntEnum

An enumeration.

EGO = 0#
EGO_FULL_MANUAL = 2#
EGO_MANUAL_STEER = 1#
FOLLOWER = 4#
GENERIC = 5#
LEAD = 3#
class umich_sim.sim_backend.helpers.WorldDirection(value)#

Bases: IntEnum

An enumeration.

BACKWARD = 1#
FORWARD = 0#
LEFT = 2#
RIGHT = 3#
umich_sim.sim_backend.helpers.angle_difference(first: float, second: float) float#

Calculates the difference between two angles in Degrees.

Accounts for the rollover from 359 degrees -> 0 degrees

Parameters:
  • first – the first angle measurement in degrees

  • second – the second angle measurement in degrees

Returns:

the angle difference in degrees

umich_sim.sim_backend.helpers.config_world(world: World, synchrony: bool = True, delta_seconds: float = 0.02) None#

Configures the CARLA world to use certain synchrony and time step settings.

Carla Documentation: https://carla.readthedocs.io/en/latest/adv_synchrony_timestep/

Parameters:
  • world – a carla.World object representing the current simulation world

  • synchrony – a bool representing whether synchrony should be applied to the world

  • delta_seconds – a float representing the world’s time step

Returns:

umich_sim.sim_backend.helpers.logging_setup(directory_name: str = 'logs') None#

Configured the logging package to write out logs to the correct place under the correct filename.

Parameters:

directory_name – the directory to which the logs will be written

Returns:

None

umich_sim.sim_backend.helpers.project_forward(transform: Transform, distance: float) Transform#

Projects a carla.Transform forward a given distance in the direction of the Transforms yaw

This function only calculates the projection in two dimension. Only yaw is used as the direction for the project, so there will be no changes to the Z axis. Pass in a negative distance to project backwards.

Parameters:
  • transform – the carla.Transform to project forward

  • distance – the distance to project forward

Returns:

a new carla.Transform that represents the transform projected forward

umich_sim.sim_backend.helpers.rotate_vector(vector: array, degrees: float) array#

Rotates the provided vector around the z-axis by the specified number of degrees

Parameters:
  • vector – a np.array representing the vector to rotate

  • degrees – a float representing the number of degrees to rotate by

Returns:

a np.array containing the rotated vector

umich_sim.sim_backend.helpers.smooth_path(current_path: List[Transform], num_passes=1) List[Transform]#

Function that smooths the provided path by adding intermediate points between all neighboring points.

Parameters:
  • current_path – a List of carla.Transforms representing the path to be smoothed

  • num_passes – an int representing the number of smoothing passes to make

Returns:

a List of carla.Transforms representing the newly smoothed path

umich_sim.sim_backend.helpers.to_numpy_vector(carla_vector: Union[Vector3D, Vector2D], dims=3) array#

Converts a carla.Vector3d into a numpy.array with length three or two

Parameters:

carla_vector – the carla.Vector3d to convert

Returns:

a numpy.array representing the Carla vector

Module contents#