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


Python Transform.transform方法代码示例

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


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

示例1: pwmControlThread

# 需要导入模块: from transform import Transform [as 别名]
# 或者: from transform.Transform import transform [as 别名]
def pwmControlThread():
    # setup arduino serial comm
    pwm.setPWMFreq(50)
    t = Transform(True, False) #invert one motor and not the other when constructing
    watchdog = time.time()

    # thread main loop
    while True:
	time.sleep(.005)
        # check for data that needs to be bridged to arduino
        dataFlag = True
        if not serialRealTimeQueue.empty():
            data = serialRealTimeQueue.get()
        else:
            dataFlag = False

        # if data was recieved parse and update pwm hat
        if dataFlag:
            data = data[5:-1]
            print data
            data_nums = [int(x) for x in data.split(':') if x.strip()]
            print " ", data_nums[0], " ", data_nums[1]
            leftMtr,rightMtr = t.transform(data_nums[0],data_nums[1])
            print " ", leftMtr , " ", rightMtr
            setServoPulse(LEFT_MOT, leftMtr)
            setServoPulse(RIGHT_MOT, rightMtr)

            Transform.MOTOR_MIN = data_nums[5]*10
            Transform.MOTOR_IDLE = data_nums[6]*10
            Transform.MOTOR_MAX = data_nums[7]*10


            leftIntake = Transform.MOTOR_IDLE
            rightIntake = Transform.MOTOR_IDLE
            if data_nums[2] > 127 + 10: # if left trigger pressed (i think) spin motors in opposite direction
                leftIntake = Transform.map_range(data_nums[2],127,255,Transform.MOTOR_IDLE,Transform.MOTOR_MAX)
                rightIntake = Transform.map_range(data_nums[2],127,255,Transform.MOTOR_IDLE,Transform.MOTOR_MIN)
            elif data_nums[3] > 127 + 10: # if right trigger pressed
                leftIntake = Transform.map_range(data_nums[3],127,255,Transform.MOTOR_IDLE,Transform.MOTOR_MIN)
                rightIntake = Transform.map_range(data_nums[3],127,255,Transform.MOTOR_IDLE,Transform.MOTOR_MAX)
            else :
                leftIntake = Transform.MOTOR_IDLE
                rightIntake = Transform.MOTOR_IDLE
 
            print " " , leftIntake, " ", rightIntake

            setServoPulse(LEFT_MANIP,leftIntake)
            setServoPulse(RIGHT_MANIP,rightIntake)

            watchdog = time.time()

        if watchdog + WATCHDOG_DELAY < time.time():
            setServoPulse(LEFT_MOT, Transform.MOTOR_IDLE)
            setServoPulse(RIGHT_MOT, Transform.MOTOR_IDLE)
            setServoPulse(LEFT_MANIP, Transform.MOTOR_IDLE)
            setServoPulse(RIGHT_MANIP, Transform.MOTOR_IDLE)

            watchdog = time.time()
            print "you need to feed the dogs"
开发者ID:Saint-Francis-Robotics-Team2367,项目名称:yunServerSoftware,代码行数:61,代码来源:server.py

示例2: transform

# 需要导入模块: from transform import Transform [as 别名]
# 或者: from transform.Transform import transform [as 别名]
def transform(args, x_queue, datadir, fname_index, joint_index, o_queue):
    trans = Transform(args)
    while True:
        x = x_queue.get()
        if x is None:
            break
        x, t = trans.transform(x.split(','), datadir, fname_index, joint_index)
        o_queue.put((x.transpose((2, 0, 1)), t))
开发者ID:cybermatt,项目名称:deeppose,代码行数:10,代码来源:train.py


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