def __init__(self, width=0.7, height=0.1, options=None, bounds=None): bounds = bounds or {} Vehicle.__init__(self, n_spl=1, degree=3, shapes=Rectangle(width, height), options=options) self.vmin = bounds['vmin'] if 'vmin' in bounds else -0.5 self.vmax = bounds['vmax'] if 'vmax' in bounds else 0.5 self.amin = bounds['amin'] if 'amin' in bounds else -1. self.amax = bounds['amax'] if 'amax' in bounds else 1.
def __init__(self, shapes=Circle(0.1), options=None, bounds=None): bounds = bounds or {} Vehicle.__init__( self, n_spl=2, degree=3, shapes=shapes, options=options) if ((not 'syslimit' in self.options) or # default choose norm_inf (self.options['syslimit'] is 'norm_inf')): # user specified separate velocities for x and y self.vxmin = bounds['vxmin'] if 'vxmin' in bounds else -0.5 self.vymin = bounds['vymin'] if 'vymin' in bounds else -0.5 self.vxmax = bounds['vxmax'] if 'vxmax' in bounds else 0.5 self.vymax = bounds['vymax'] if 'vymax' in bounds else 0.5 self.axmin = bounds['axmin'] if 'axmin' in bounds else -1. self.aymin = bounds['aymin'] if 'aymin' in bounds else -1. self.axmax = bounds['axmax'] if 'axmax' in bounds else 1. self.aymax = bounds['aymax'] if 'aymax' in bounds else 1. # user specified a single velocity for x and y if 'vmin' in bounds: self.vxmin = self.vymin = bounds['vmin'] if 'vmax' in bounds: self.vxmax = self.vymax = bounds['vmax'] if 'amin' in bounds: self.axmin = self.aymin = bounds['amin'] if 'amax' in bounds: self.axmax = self.aymax = bounds['amax'] elif self.options['syslimit'] is 'norm_2': self.vmax = bounds['vmax'] if 'vmax' in bounds else 0.5 self.amax = bounds['amax'] if 'amax' in bounds else 1.
def __init__(self, pmcombo, battery, pmaterial, cmaterial, geometry=None, feasible=True, score=0, pareto=False): """ The input "feasible" will be true by default. If the quad is found to be infeasible the value will be changed to a tuple. The first entry will be a string explaining the first reason why the alternative was rejected (but not necessarily the only reason it would have been rejected). The second entry is the % (e.g., 0.15) off the vehicle spec was from the requirement. """ # Call vehicle constructor to initialize performance parameters Vehicle.__init__(self) if geometry is None: geometry = [0] * 4 self.hub_size, self.hub_separation, self.hub_grid, self.arm_len = geometry self.pmcombo = pmcombo self.prop = self.pmcombo.prop self.motor = self.pmcombo.motor self.battery = battery self.pmaterial = pmaterial self.cmaterial = cmaterial self.feasible = feasible self.score = score self.pareto = pareto self.name = "(%s, %s)" % (self.pmcombo.name, self.battery.name)
def __init__(self, shapes, options=None, bounds=None): bounds = bounds or {} Vehicle.__init__( self, n_spl=3, degree=3, shapes=shapes, options=options) self.vmin = bounds['vmin'] if 'vmin' in bounds else -0.5 self.vmax = bounds['vmax'] if 'vmax' in bounds else 0.5 self.amin = bounds['amin'] if 'amin' in bounds else -1. self.amax = bounds['amax'] if 'amax' in bounds else 1.
def __init__(self, width=0.7, height=0.1, options={}, bounds={}): Vehicle.__init__(self, n_spl=1, degree=3, shapes=Rectangle(width, height), options=options) self.vmin = bounds['vmin'] if 'vmin' in bounds else -0.8 self.vmax = bounds['vmax'] if 'vmax' in bounds else 0.8 self.amin = bounds['amin'] if 'amin' in bounds else -2. self.amax = bounds['amax'] if 'amax' in bounds else 2. # time horizon self.T = self.define_symbol('T')
def __init__(self, shapes=Circle(0.1), options={}, bounds={}): Vehicle.__init__( self, n_spl=2, degree=3, shapes=shapes, options=options) self.vmin = bounds['vmin'] if 'vmin' in bounds else -0.5 self.vmax = bounds['vmax'] if 'vmax' in bounds else 0.5 self.amin = bounds['amin'] if 'amin' in bounds else -1. self.amax = bounds['amax'] if 'amax' in bounds else 1. # time horizon self.T = self.define_symbol('T')
def __init__(self, lead_veh=None, shapes=Circle(0.2), l_hitch=0.2, options=None, bounds=None): bounds = bounds or {} Vehicle.__init__( self, n_spl=1 + lead_veh.n_spl, degree=3, shapes=shapes, options=options) # n_spl contains all splines of lead_veh and trailer # being: tg_ha_trailer, v_til_veh, tg_ha_veh self.lead_veh = Dubins(Circle(0.2)) if (lead_veh is None) else lead_veh # vehicle which pulls the trailer self.l_hitch = l_hitch # distance between rear axle of trailer and connection point on the car self.tmax = bounds['tmax'] if 'tmax' in bounds else np.pi/4. # limit angle between trailer and vehicle self.tmin = bounds['tmin'] if 'tmin' in bounds else -np.pi/4.
def __init__(self, shapes=Rectangle(width=0.2, height=0.4), options=None, bounds=None): bounds = bounds or {} Vehicle.__init__( self, n_spl=3, degree=3, shapes=shapes, options=options) self.vmin = bounds['vmin'] if 'vmin' in bounds else -0.5 self.vmax = bounds['vmax'] if 'vmax' in bounds else 0.5 self.amin = bounds['amin'] if 'amin' in bounds else -1. self.amax = bounds['amax'] if 'amax' in bounds else 1. self.wmin = bounds['wmin'] if 'wmin' in bounds else -np.pi/6. # in rad/s self.wmax = bounds['wmax'] if 'wmax' in bounds else np.pi/6.
def __init__(self, radius=0.2, options=None, bounds=None): bounds = bounds or {} Vehicle.__init__( self, n_spl=2, degree=4, shapes=Circle(radius), options=options) self.radius = radius self.u1min = bounds['u1min'] if 'u1min' in bounds else 2. self.u1max = bounds['u1max'] if 'u1max' in bounds else 15. self.u2min = bounds['u2min'] if 'u2min' in bounds else -8. self.u2max = bounds['u2max'] if 'u2max' in bounds else 8. self.g = 9.81
def __init__(self, length=0.4, options=None, bounds=None): bounds = bounds or {} Vehicle.__init__( self, n_spl=2, degree=2, shapes=Circle(length/2.), options=options) self.vmax = bounds['vmax'] if 'vmax' in bounds else 0.8 self.amax = bounds['amax'] if 'amax' in bounds else 1. self.dmin = bounds['dmin'] if 'dmin' in bounds else -np.pi/6. # steering angle [rad] self.dmax = bounds['dmax'] if 'dmax' in bounds else np.pi/6. self.ddmin = bounds['ddmin'] if 'ddmin' in bounds else -np.pi/4. # dsteering angle [rad/s] self.ddmax = bounds['ddmax'] if 'ddmax' in bounds else np.pi/4. self.length = length
def __init__(self, radius=0.2, options={}, bounds={}): Vehicle.__init__( self, n_spl=2, degree=4, shapes=Circle(radius), options=options) self.radius = radius self.u1min = bounds['u1min'] if 'u1min' in bounds else 1. self.u1max = bounds['u1max'] if 'u1max' in bounds else 15. self.u2min = bounds['u2min'] if 'u2min' in bounds else -8. self.u2max = bounds['u2max'] if 'u2max' in bounds else 8. self.g = 9.81 # time horizon self.T = self.define_symbol('T')
def __init__(self, radius=0.2, options=None, bounds=None): bounds = bounds or {} Vehicle.__init__( self, n_spl=3, degree=2, shapes=Sphere(radius), options=options) self.u1min = bounds['u1min'] if 'u1min' in bounds else 2. self.u1max = bounds['u1max'] if 'u1max' in bounds else 15. self.u2min = bounds['u2min'] if 'u2min' in bounds else -2. self.u2max = bounds['u2max'] if 'u2max' in bounds else 2. self.u3min = bounds['u3min'] if 'u3min' in bounds else -2. self.u3max = bounds['u3max'] if 'u3max' in bounds else 2. self.phimin = bounds['phimin'] if 'phimin' in bounds else -np.pi/6 self.phimax = bounds['phimax'] if 'phimax' in bounds else np.pi/6 self.thetamin = bounds['thetamin'] if 'thetamin' in bounds else -np.pi/6 self.thetamax = bounds['thetamax'] if 'thetamax' in bounds else np.pi/6 self.g = 9.81 self.radius = radius
def __init__(self, *args, **kwargs): Vehicle.__init__(self, *args, **kwargs) # quad servo controller if hasattr(self,'phid'): self.phid = int(self.phid) else: self.phid = 5927 self.q = QuadServo( self.phid ) # each servo has adjustable min, max positions (and final 10.6 "factor" - no idea what this does) self.q.setRange( PHIDGET_QUADSERVO_MOTOR0, 100, 3000 ) self.q.setRange( PHIDGET_QUADSERVO_MOTOR1, 1000, 3000 ) self.q.setRange( PHIDGET_QUADSERVO_MOTOR2, 1000, 3000 ) # servo motor controller positions, the middle 0.5 is stopped self.rest = 0.5 self.forward_start = 0.54 self.spin_forward_start = 0.54 self.motion_delta = 0.02 self.turn_delta = 0.01 self.spin_delta = 0.01 self.reverse_start = 0.45 self.spin_reverse_start = 0.46 self.max = 0.70 self.min = 0.30 self.tilt_min = 0.25 self.tilt_max = 0.85 self.tilt_delta = 0.01 self.left = self.rest self.right = self.rest self.tilt = 0.5 self.left_previous = self.left self.right_previous = self.right self.tilt_previous = self.tilt self.state = 'STOPPED'
def __init__(self,name='Ralph',model='models/ralph',run='models/ralph-run', walk='models/ralph-walk',pos=None,avoidObstacles=True, avoidVehicles=True, hprs=(180,0,0,1,1,1), # Ralph's Y is backward ): """Initialise the character. By default tries to load Panda3D's Ralph model: models/ralph, models/ralph-run and models/ralph-walk.""" FSM.FSM.__init__(self,'Character') Vehicle.__init__(self,pos=pos,avoidObstacles=avoidObstacles, avoidVehicles=avoidVehicles,radius=2.5) self.name = name self.lastPose = 0 # Used when transitioning between animations self.actor = Actor(model,{"run":run,"walk":walk}) self.actor.setHprScale(*hprs) self.actor.reparentTo(self.prime) # Add a task for this Character to the global task manager. self.characterStepTask=taskMgr.add(self.characterStep,"Character step task")
def __init__(self): Vehicle.__init__(self, "Ram", "Dodge", 395, 4) GasPowered.__init__(self, 26)
def __init__(self, grid, coor, size, color=(200, 250, 250)): coordinates = coor.extend_down(size) Vehicle.__init__(self, grid, coordinates, color)
def __init__(self, name): Vehicle.__init__(self, "Honda") self._name = name self._config = configuration
def __init__(self): Vehicle.__init__(self, "Leaf", "Nissan", 200, 4) ElectricPowered.__init__(self, 50)
def __init__(self): Vehicle.__init__(self, "Subaru", "Crosstrek", 60, 4) Gas.__init__(self, 40) Electric.__init__(self, 6)