• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python vehicle.Vehicle类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: read_vehicles

def read_vehicles(database, query_no):
    """
    read vehicle data
    """
    conn = sqlite3.connect(database)
    cursor = conn.cursor()
    # database should have index on Sim
    if query_no == "all":
        cursor.execute("SELECT DISTINCT id FROM vehicles")
        all_ids = cursor.fetchall()
    else:
        all_ids = [(no, ) for no in query_no]
    vehicles = Vehicles()
    for ID in all_ids:
        # Order by Id?
        cursor.execute("""SELECT gpstime, latitude, longitude 
                          FROM vehicles
                          WHERE id = ? ORDER BY gpstime ASC""", ID)
        results = cursor.fetchall()
        vehicle = Vehicle(results, ID[0])
        vehicle = vehicle.denoise()
        vehicles.add(vehicle)
    cursor.close()
    conn.close()
    return vehicles
开发者ID:YunshengWei,项目名称:Route-Matching,代码行数:25,代码来源:read_data.py


示例2: __init__

    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,代码行数:27,代码来源:quadrotor.py


示例3: __init__

    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,代码行数:28,代码来源:holonomic.py


示例4: __init__

 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,代码行数:7,代码来源:holonomic1d.py


示例5: __init__

 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,代码行数:8,代码来源:holonomic3d.py


示例6: __init__

 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,代码行数:8,代码来源:platform.py


示例7: process_pipeline

def process_pipeline(frame, verbose=False):

    detected_vehicles = []

    img_blend_out = frame.copy()

    # return bounding boxes detected by SSD
    ssd_bboxes = process_frame_bgr_with_SSD(frame, ssd_model, bbox_helper, allow_classes=[7], min_confidence=0.3)
    for row in ssd_bboxes:
        label, confidence, x_min, y_min, x_max, y_max = row
        x_min = int(round(x_min * frame.shape[1]))
        y_min = int(round(y_min * frame.shape[0]))
        x_max = int(round(x_max * frame.shape[1]))
        y_max = int(round(y_max * frame.shape[0]))

        proposed_vehicle = Vehicle(x_min, y_min, x_max, y_max)

        if not detected_vehicles:
            detected_vehicles.append(proposed_vehicle)
        else:
            for i, vehicle in enumerate(detected_vehicles):
                if vehicle.contains(*proposed_vehicle.center):
                    pass  # go on, bigger bbox already detected in that position
                elif proposed_vehicle.contains(*vehicle.center):
                    detected_vehicles[i] = proposed_vehicle  # keep the bigger window
                else:
                    detected_vehicles.append(proposed_vehicle)

    # draw bounding boxes of detected vehicles on frame
    for vehicle in detected_vehicles:
        vehicle.draw(img_blend_out, color=(0, 255, 255), thickness=2)

    h, w = frame.shape[:2]
    off_x, off_y = 30, 30
    thumb_h, thumb_w = (96, 128)

    # add a semi-transparent rectangle to highlight thumbnails on the left
    mask = cv2.rectangle(frame.copy(), (0, 0), (w, 2 * off_y + thumb_h), (0, 0, 0), thickness=cv2.FILLED)
    img_blend_out = cv2.addWeighted(src1=mask, alpha=0.3, src2=img_blend_out, beta=0.8, gamma=0)

    # create list of thumbnails s.t. this can be later sorted for drawing
    vehicle_thumbs = []
    for i, vehicle in enumerate(detected_vehicles):
        x_min, y_min, x_max, y_max = vehicle.coords
        vehicle_thumbs.append(frame[y_min:y_max, x_min:x_max, :])

    # draw detected car thumbnails on the top of the frame
    for i, thumbnail in enumerate(sorted(vehicle_thumbs, key=lambda x: np.mean(x), reverse=True)):
        vehicle_thumb = cv2.resize(thumbnail, dsize=(thumb_w, thumb_h))
        start_x = 300 + (i+1) * off_x + i * thumb_w
        img_blend_out[off_y:off_y + thumb_h, start_x:start_x + thumb_w, :] = vehicle_thumb

    # write the counter of cars detected
    font = cv2.FONT_HERSHEY_SIMPLEX
    cv2.putText(img_blend_out, 'Vehicles in sight: {:02d}'.format(len(detected_vehicles)),
                (20, off_y + thumb_h // 2), font, 0.8, (255, 255, 255), 2, cv2.LINE_AA)

    return img_blend_out
开发者ID:Forrest-Z,项目名称:self-driving-car,代码行数:58,代码来源:main_ssd.py


示例8: __init__

 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,代码行数:9,代码来源:holonomic.py


示例9: __init__

 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,代码行数:10,代码来源:quadrotor.py


示例10: keyPressEvent

 def keyPressEvent(self, QKeyEvent):
     if QKeyEvent.key() == QtCore.Qt.Key_Z:
         vehicle = Vehicle(parent=self, x=100, y=600)
         vehicle.summon()
     elif QKeyEvent.key() == QtCore.Qt.Key_Space:
         self.message.set_text("Paused")
         self.message.show()
         self.pause()
     else:
         self.shooter.move(QKeyEvent.key())
开发者ID:eduguerra,项目名称:Zombie-Game,代码行数:10,代码来源:window.py


示例11: __init__

 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,代码行数:10,代码来源:trailer.py


示例12: __init__

 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,代码行数:10,代码来源:holonomicorient.py


示例13: __init__

 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,代码行数:11,代码来源:bicycle.py


示例14: __init__

 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,代码行数:11,代码来源:quadrotor.py


示例15: destroy

 def destroy(self):
     """Prepare this Character to be garbage-collected by Python:
     
     Remove all of the Character's nodes from the scene graph, remove its
     CollisionSolids from the global CollisionTraverser, clear its
     CollisionHandler, remove tasks, destroy Actor.
     
     After executing this method, any remaining references to the Character
     object can be destroyed by the user module, and the Character will be
     garbage-collected by Python.
     """
 
     taskMgr.remove(self.characterStepTask)
     self.cleanup()
     self.actor.delete()
     Vehicle.destroy(self)
开发者ID:kengleason,项目名称:PandaSteer,代码行数:16,代码来源:character.py


示例16: set_parameters

 def set_parameters(self, current_time):
     parameters = Vehicle.set_parameters(self, current_time)
     parameters[self]['spl0'] = self.prediction['state'][:2]
     parameters[self]['dspl0'] = self.prediction['dspl']
     parameters[self]['ddspl0'] = self.prediction['ddspl']
     parameters[self]['poseT'] = self.poseT
     return parameters
开发者ID:meco-group,项目名称:omg-tools,代码行数:7,代码来源:quadrotor.py


示例17: set_parameters

 def set_parameters(self, current_time):
     parameters = Vehicle.set_parameters(self, current_time)
     parameters[self]['state0'] = self.prediction['state']
     parameters[self]['input0'] = self.prediction['input']
     # parameters[self]['dinput0'] = self.prediction['dinput']
     parameters[self]['poseT'] = self.poseT
     return parameters
开发者ID:meco-group,项目名称:omg-tools,代码行数:7,代码来源:holonomic.py


示例18: __init__

    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,代码行数:17,代码来源:quadrotor3d.py


示例19: set_parameters

 def set_parameters(self, current_time):
     # for the optimization problem
     # convert theta to tg_ha here
     parameters = Vehicle.set_parameters(self, current_time)
     parameters[self]['pos0'] = self.prediction['state'][:2]  # x, y
     parameters[self]['tg_ha0'] = np.tan(self.prediction['state'][2]/2)
     parameters[self]['vel0'] = self.prediction['input'][:2]  # dx, dy
     parameters[self]['dtg_ha0'] = 0.5*self.prediction['input'][2]*(1+parameters[self]['tg_ha0']**2)
     parameters[self]['posT'] = self.poseT[:2]  # x, y
     parameters[self]['tg_haT'] = np.tan(self.poseT[2]/2)
     return parameters
开发者ID:meco-group,项目名称:omg-tools,代码行数:11,代码来源:holonomicorient.py


示例20: __init__

    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,代码行数:40,代码来源:dennis.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python compat.from_none函数代码示例发布时间:2022-05-26
下一篇:
Python vector.Vector类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap