How to use the fluids.assets.shape.Shape.__init__ function in fluids

To help you get started, we’ve selected a few fluids examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github BerkeleyAutomation / Urban_Driving_Simulator / fluids / assets / sidewalk.py View on Github external
def __init__(self, start_wps=[], end_wps=[], **kwargs):
        Shape.__init__(self, color=(0xf7, 0xf7, 0xf7), **kwargs)
        point0 = (self.points[2] + self.points[3]) / 2
        point1 = (self.points[0] + self.points[1]) / 2

        if len(start_wps) and len(end_wps):
            self.start_waypoints = start_wps
            self.end_waypoints   = end_wps
        else:
            self.start_waypoints = [Waypoint(point0[0],
                                             point0[1],
                                             self,
                                             angle=self.angle),
                                    Waypoint(point1[0],
                                             point1[1],
                                             self,
                                             angle=self.angle + np.pi)]
            self.end_waypoints   = [Waypoint(point1[0],
github BerkeleyAutomation / Urban_Driving_Simulator / fluids / assets / terrain.py View on Github external
def __init__(self, **kwargs):
        Shape.__init__(self, color=(0xfd,0xF8,0xef), **kwargs)
github BerkeleyAutomation / Urban_Driving_Simulator / fluids / assets / pedcrossing.py View on Github external
def __init__(self, **kwargs):
        Shape.__init__(self, color=(0xf7, 0xf7, 0xf7), **kwargs)
        self.in_waypoints = []
        self.out_waypoints = []
github BerkeleyAutomation / Urban_Driving_Simulator / fluids / assets / car.py View on Github external
def __init__(self, vel=0, mass=400, max_vel=5,
                 planning_depth=20, **kwargs):
        from fluids.assets import Lane, Car, Pedestrian, TrafficLight, Terrain, Sidewalk, PedCrossing
        collideables = [Lane,
                        Car,
                        Pedestrian,
                        TrafficLight,
                        Terrain,
                        Sidewalk,
                        PedCrossing]
        Shape.__init__(self,
                       collideables=collideables,
                       color=(0x1d,0xb1,0xb0),#769BB0
                       xdim=70,
                       ydim=35,
                       **kwargs)

        self.l_r            = self.l_f = self.ydim / 2
        self.mass           = mass
        self.max_vel        = max_vel
        self.vel            = vel
        self.waypoints      = []
        self.trajectory     = []
        self.planning_depth = planning_depth
        self.PID_acc        = PIDController(1.0, 0, 0)
        self.PID_steer      = PIDController(2.0, 0, 0)
        self.last_action    = SteeringAccAction(0, 0)
github BerkeleyAutomation / Urban_Driving_Simulator / fluids / assets / lane.py View on Github external
def __init__(self, start_wp=None, end_wp=None, **kwargs):
        #FCF59B
        Shape.__init__(self, color=(0xff, 0xff, 0xff), **kwargs)

        if start_wp is not None and end_wp is not None:
            self.start_waypoint = start_wp
            self.end_waypoint   = end_wp
        else:
            self.start_waypoint = (self.points[2] + self.points[3]) / 2
            self.end_waypoint   = (self.points[0] + self.points[1]) / 2

            self.start_waypoint = Waypoint(self.start_waypoint[0],
                                           self.start_waypoint[1],
                                           self,
                                           angle=self.angle)
            self.end_waypoint   = Waypoint(self.end_waypoint[0],
                                           self.end_waypoint[1],
                                           self,
                                           angle=self.angle)
github BerkeleyAutomation / Urban_Driving_Simulator / fluids / assets / street.py View on Github external
def __init__(self, **kwargs):
        Shape.__init__(self, color=(0xff, 0xff, 0xff), **kwargs)
        self.in_waypoints = []
        self.out_waypoints = []
        self.intersection_waypoints = []
github BerkeleyAutomation / Urban_Driving_Simulator / fluids / assets / traffic_light.py View on Github external
def __init__(self, init_color="red", **kwargs):
        color = {"red":RED,
                 "green":GREEN,
                 "yellow":YELLOW}[init_color]
        self.timer = {"red":0,
                      "green":200,
                      "yellow":350}[init_color]

        Shape.__init__(self, xdim=20, ydim=60, color=color, **kwargs)