当前位置: 首页>>代码示例>>Python>>正文


Python Vehicle.__init__方法代码示例

本文整理汇总了Python中vehicle.Vehicle.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Vehicle.__init__方法的具体用法?Python Vehicle.__init__怎么用?Python Vehicle.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vehicle.Vehicle的用法示例。


在下文中一共展示了Vehicle.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from vehicle import Vehicle [as 别名]
# 或者: from vehicle.Vehicle import __init__ [as 别名]
    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)
开发者ID:Nathan-Beals,项目名称:MASR-Design-Tool,代码行数:29,代码来源:quadrotor.py

示例2: __init__

# 需要导入模块: from vehicle import Vehicle [as 别名]
# 或者: from vehicle.Vehicle import __init__ [as 别名]
    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.
开发者ID:meco-group,项目名称:omg-tools,代码行数:30,代码来源:holonomic.py

示例3: __init__

# 需要导入模块: from vehicle import Vehicle [as 别名]
# 或者: from vehicle.Vehicle import __init__ [as 别名]
 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.
开发者ID:meco-group,项目名称:omg-tools,代码行数:9,代码来源:holonomic1d.py

示例4: __init__

# 需要导入模块: from vehicle import Vehicle [as 别名]
# 或者: from vehicle.Vehicle import __init__ [as 别名]
 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')
开发者ID:jgillis,项目名称:omg-tools,代码行数:10,代码来源:platform.py

示例5: __init__

# 需要导入模块: from vehicle import Vehicle [as 别名]
# 或者: from vehicle.Vehicle import __init__ [as 别名]
 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.
开发者ID:meco-group,项目名称:omg-tools,代码行数:10,代码来源:holonomic3d.py

示例6: __init__

# 需要导入模块: from vehicle import Vehicle [as 别名]
# 或者: from vehicle.Vehicle import __init__ [as 别名]
 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')
开发者ID:jgillis,项目名称:omg-tools,代码行数:11,代码来源:holonomic.py

示例7: __init__

# 需要导入模块: from vehicle import Vehicle [as 别名]
# 或者: from vehicle.Vehicle import __init__ [as 别名]
 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.
开发者ID:meco-group,项目名称:omg-tools,代码行数:12,代码来源:trailer.py

示例8: __init__

# 需要导入模块: from vehicle import Vehicle [as 别名]
# 或者: from vehicle.Vehicle import __init__ [as 别名]
 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.
开发者ID:meco-group,项目名称:omg-tools,代码行数:12,代码来源:holonomicorient.py

示例9: __init__

# 需要导入模块: from vehicle import Vehicle [as 别名]
# 或者: from vehicle.Vehicle import __init__ [as 别名]
 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
开发者ID:meco-group,项目名称:omg-tools,代码行数:12,代码来源:quadrotor.py

示例10: __init__

# 需要导入模块: from vehicle import Vehicle [as 别名]
# 或者: from vehicle.Vehicle import __init__ [as 别名]
 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
开发者ID:meco-group,项目名称:omg-tools,代码行数:13,代码来源:bicycle.py

示例11: __init__

# 需要导入模块: from vehicle import Vehicle [as 别名]
# 或者: from vehicle.Vehicle import __init__ [as 别名]
 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')
开发者ID:jgillis,项目名称:omg-tools,代码行数:13,代码来源:quadrotor.py

示例12: __init__

# 需要导入模块: from vehicle import Vehicle [as 别名]
# 或者: from vehicle.Vehicle import __init__ [as 别名]
    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
开发者ID:meco-group,项目名称:omg-tools,代码行数:19,代码来源:quadrotor3d.py

示例13: __init__

# 需要导入模块: from vehicle import Vehicle [as 别名]
# 或者: from vehicle.Vehicle import __init__ [as 别名]
    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'
开发者ID:pwarren,项目名称:AGDeviceControl,代码行数:42,代码来源:dennis.py

示例14: __init__

# 需要导入模块: from vehicle import Vehicle [as 别名]
# 或者: from vehicle.Vehicle import __init__ [as 别名]
    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")
开发者ID:kengleason,项目名称:PandaSteer,代码行数:24,代码来源:character.py

示例15: __init__

# 需要导入模块: from vehicle import Vehicle [as 别名]
# 或者: from vehicle.Vehicle import __init__ [as 别名]
 def __init__(self, name):
     Vehicle.__init__(self, "Honda")
     self._name = name
     self._config = configuration
开发者ID:vollov,项目名称:py-lab,代码行数:6,代码来源:car.py


注:本文中的vehicle.Vehicle.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。