# Objects¶

## Cars¶

class gym_urbandriving.assets.Car(x, y, xdim=80, ydim=40, angle=0.0, vel=0.0, max_vel=5, mass=100.0, dynamics_model='kinematic', destination=None, trajectory=None)[source]

Represents a point-model car.

Parameters: x (float) – Starting x coordinate of car’s center y (float) – Starting y coordinate of car’s center angle (float) – Starting angle of car in world space vel (float) – Starting velocity of car
vel

float – Forwards velocity of car

max_vel

float – Maximum allowable velocity of this carst

xdim

float – Length of car

ydim

float – Width of car

can_collide(other)[source]

Specifies whether this object can collide with another object

Parameters: other – Object to test collision against True if this object can collide with other bool
step(action)[source]

Updates this object given this action input

Parameters: action – The action to take

## Pedestrians¶

class gym_urbandriving.assets.Pedestrian(x, y, radius=12, angle=0.0, vel=0.0, acc=0.0, max_vel=2.0, mass=100.0, dynamics_model='point')[source]

Represents a pedestrian as a circle

Parameters: x (float) – Center x coordinate y (float) – Center y coordinate radius (float) – Size of the pedestrian angle (float) – Initial orientation, in degrees vel (float) – Initial velocity max_vel (float) – Maximum velocity mass (float) – Mass of pedestrian
step(action, info_dict=None)[source]

Updates the pedestrian for one timestep.

Parameters: action (1x2 array) – Steering / acceleration action. info_dict (dict) – Contains information about the environment.

## Terrain¶

class gym_urbandriving.assets.Terrain(x, y, xdim=0, ydim=0, points=[], radius=0, excludes=[])[source]

Represents a square of impassable terrain

Parameters: points (list) – List of X-Y tuples in ccw order describing vertices of the polygon

## Lanes¶

class gym_urbandriving.assets.Lane(x=0, y=0, xdim=0, ydim=0, angle=0.0, angle_deg=0, points=[], curvature=0, inner_r=0, outer_r=0)[source]

Represents a lane of road. Lanes have directionality, so cars should drive in the right direction. Default construction creates a rectangular block.

Parameters: x (float) – Upper left x coordinate of the lane block y (float) – Upper left y coordinate of the lane block xdim (float) – Width of the lane block ydim (float) – Height of the lane block ; float (angle) – In degrees, the rotation of the lane block. The correct direction of travel along this lane. points (list) – List of XY coordinates specifying edge points of a polygon. If specified, lane will be constructed as a polygon. curvature (list) – If specified, generates a curved road segment with this arc angle, centered at x, y, and with inner and outer radii outer_r (inner_r,) – Use with curvature argument to generated curved road segment.
generate_car(car_model='kinematic')[source]

Creates a car on this lane ready to drive into the intersection

Parameters: car_type ("kinematic" or "point" or "reeds_shepp") – Specifies dynamics model for the car Generated Car object Car

## Sidewalks¶

class gym_urbandriving.assets.Sidewalk(x, y, xdim, ydim, angle=0.0, angle_deg=0, points=[])[source]

Represents a block of sidewalk. Passable for pedestrians, not for cars

Parameters: x (float) – Upper left x coordinate of the sidewalk block y (float) – Upper left y coordinate of the sidewalk block xdim (float) – Width of the sidewalk block ydim (float) – Height of the sidewalk block points (list) – If specified, constructs sidewalk as polygon
generate_man(man_type=<class 'gym_urbandriving.assets.pedestrian.Pedestrian'>)[source]

Generates a man on the sidewalk

Returns: Generated Pedestrian object Pedestrian

## Streets¶

class gym_urbandriving.assets.Street(x, y, xdim, ydim, angle=0, points=[])[source]

Represents a block of street. Passable for cars and pedestrians. Does not have directionality associated with it, so use this for the middle of an intersection

Parameters: x (float) – Upper left x coordinate of the street block y (float) – Upper left y coordinate of the street block xdim (float) – Width of the street block ydim (float) – Height of the street block points – If specified, constructs this shape as a polygon