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


Python Robot.Robot类代码示例

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


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

示例1: __init__

    def __init__(self,r_name,r_id,x_off,y_off,theta_off, capacity):

        Robot.__init__(self,r_name,r_id,x_off,y_off,theta_off)

        self.carrier_pub = rospy.Publisher("carrier_position",String, queue_size=10)
        self.carrier_sub = rospy.Subscriber("carrier_position", String, self.carrier_callback)
        self.picker_sub = rospy.Subscriber("picker_position", String, self.picker_callback)
        self.kiwi_sub = rospy.Subscriber("picker_kiwi_transfer", String, self.kiwi_callback)
        self.kiwi_pub = rospy.Publisher("carrier_kiwi_transfer",String, queue_size=10)
        self.queue_pub = rospy.Publisher("carrier_allocation_request", String, queue_size=10)
        self.queue_sub = rospy.Subscriber("carrier_allocation_response", String, self.queue_callback)

        self.next_robot_id = None
        self.carrier_robots = ["0,0,0","0,0,0","0,0,0","0,0,0","0,0,0","0,0,0","0,0,0","0,0,0","0,0,0","0,0,0"]
        self.picker_robots = ["0,0,0","0,0,0","0,0,0","0,0,0","0,0,0","0,0,0","0,0,0","0,0,0","0,0,0","0,0,0"]

        self.max_load = capacity
        self.previousState = self.CarrierState.WAITINGFORPICKER
        self.is_going_home = False

        #these variables are used to help the laser callback, it will help in dealing with entities/debris on
        # it's path to the picker robot
        #self.StageLaser_sub = rospy.Subscriber(self.robot_node_identifier+"/base_scan",sensor_msgs.msg.LaserScan,self.StageLaser_callback)
        self.ReadLaser = False
        self.FiveCounter = 0
        self._divertingPath_ = False
开发者ID:hsye185,项目名称:SoftEng-306-Project-1,代码行数:26,代码来源:RobotCarrier.py

示例2: sineMotion

def sineMotion(ids, commandRate, offset, amp, freq):
    robot = Robot(expectedIds=ids, commandRate=commandRate, cropMethod=None)

    nIds = len(ids)
    motionFunction = lambda time: [offset + amp * sin(2 * pi * time * freq) for ii in range(nIds)]

    robot.run(motionFunction, runSeconds=10, interpBegin=1, resetFirst=False)
开发者ID:yosinski,项目名称:QuadraTot,代码行数:7,代码来源:sineMotion.py

示例3: Simulation

class Simulation():
    def __init__(self):
        self.town = Town(maxShops = 10)
        self.town.render(DisplayDriver.engine)
        self.robot = Robot(random.choice(list(self.town.shopDict)), town = self.town)
        self.robot.render(DisplayDriver.engine)

    def tick(self):
        self.robot.tick()
开发者ID:AnwarKoromah,项目名称:ECU178A4,代码行数:9,代码来源:Main.py

示例4: __init__

 def __init__(self,
              parent=None,
              instanceName=None,
              instanceType = Sensation.InstanceType.SubInstance,
              level=0):
     Robot.__init__(self,
                    parent=parent,
                    instanceName=instanceName,
                    instanceType=instanceType,
                    level=level)
     print("We are in Hearing, not Robot")
开发者ID:korhore,项目名称:Wall-E,代码行数:11,代码来源:Hearing.py

示例5: __init__

 def __init__(self,
              parent=None,
              instanceName=None,
              instanceType = Sensation.InstanceType.Real,
              level=0):
     print("We are in Connection, not Robot")
     Robot.__init__(self,
                    parent=parent,
                    instanceName=instanceName,
                    instanceType=instanceType,
                    level=level)
开发者ID:korhore,项目名称:Wall-E,代码行数:11,代码来源:Connection.py

示例6: __init__

 def __init__(self,
              parent=None,
              instanceName=None,
              instanceType = Sensation.InstanceType.SubInstance,
              level=0):
     print("We are in TensorFlowClassification, not Robot")
     Robot.__init__(self,
                    parent=parent,
                    instanceName=instanceName,
                    instanceType=instanceType,
                    level=level)
开发者ID:korhore,项目名称:Wall-E,代码行数:11,代码来源:TensorFlowClassification.py

示例7: main

def main():
    if len(sys.argv) < 3:
        print 'Usage: %s input_gait_file output_position_file' % sys.argv[0]
        sys.exit(1)

    gaitFile = sys.argv[1]
    posFile  = sys.argv[2]


    strategy = TimedFileStrategy(posFile = gaitFile)

    motionFunction, logInfo = strategy.getNext()

    #runman = RunManager()
    #runman.do_many_runs(strategy, SineModel5.typicalRanges)

    #timeScale = .3
    #motionFunctionScaled = scaleTime(motionFunction, timeScale)
    wiiTrack = WiiTrackFastClient("localhost", 8080)
    time.sleep(.5)
    position,age = wiiTrack.getPosAge()
    if age is None:
        raise Exception('Could not get position from wiiTrack.')

    robot = Robot(loud = True)
    bucket = []

    def foo():
        savePosition(wiiTrack, bucket)

    robot.run(motionFunction, runSeconds = 10, resetFirst = True,
              interpBegin = 2, interpEnd = 2, extraLogInfoFn = foo)

    print 'Positions:'
    print len(bucket)

    relTimeBucket = []
    for ii, line in enumerate(bucket):
        delta = line[0] - bucket[0][0]
        relTime = delta.seconds + delta.microseconds/1e6
        relTimeBucket.append((relTime, line[1], line[2]))


    ff = open (posFile, 'w')
    ff.write('# time (junk junk)x9 pos.x pos.y 0 age\n')
    for ii, timePosAge in enumerate(relTimeBucket):
        timeOfPosition, position, age = timePosAge
        line = '%.3f' % timeOfPosition
        line += ' -1 -1' * 9
        line += ' %.1f %.1f %.1f' % (position[0], position[1], 0)
        line += ' %f' % age
        ff.write(line + '\n')
    ff.close()
    print 'Wrote position file:', posFile
开发者ID:PHPDOTSQL,项目名称:QuadraTot,代码行数:54,代码来源:runGaitAndLogPos.py

示例8: sluchaj_wejscie_z_gniazda

def sluchaj_wejscie_z_gniazda(sock): # thread
    parser = CompParser()
    robot = Robot()
    global dzialaj
    while dzialaj:
        odebrane_dane = sock.otrzymaj_dane(ile=20)
        print odebrane_dane
        x, y, przyciskPSP2Stan = parser.parsuj_klawisze(dane=odebrane_dane)
        robot.reaguj(int(x), int(y), przyciskPSP2Stan)
        # krotszy niz na psp ; 50razy/sek cos odczytam; ale w pesymistycznym
        # przypadku tylko 25 razy na sek ;/
        time.sleep(0.002)
开发者ID:ILoveMuffins,项目名称:psp-rmt-ctrl,代码行数:12,代码来源:senderServ.py

示例9: generate_ground_truth

def generate_ground_truth(motions, landmarks, worldSize):

	myrobot = Robot({'landmarks':landmarks, 'worldSize':worldSize})
    	myrobot.set_noise({'bearing':bearing_noise, 'steering': steering_noise, 'distance': distance_noise})

    	Z = []
    	T = len(motions)

    	for t in range(T):
        	myrobot = myrobot.move(motions[t])
        	Z.append(myrobot.sense())
    	return [myrobot, Z]
开发者ID:Ranlot,项目名称:self-driving-robot,代码行数:12,代码来源:runRobot.py

示例10: __init__

    def __init__(self,r_name,r_id,x_off,y_off,theta_off,capacity):
        Robot.__init__(self,r_name,r_id,x_off,y_off,theta_off)

        self.max_load = capacity

        self.timeLastAdded = time.clock()
        self.disableSideLaser = False

        self.picker_pub = rospy.Publisher("picker_position",String, queue_size=10)
        self.kiwi_sub = rospy.Subscriber("carrier_kiwi_transfer", String, self.kiwi_callback)
        self.kiwi_pub = rospy.Publisher("picker_kiwi_transfer",String, queue_size=10)

        self.picker_sub = rospy.Subscriber("picker_position", String, self.picker_callback)
        self.picker_robots = ["0,0,0","0,0,0","0,0,0","0,0,0","0,0,0","0,0,0"]
开发者ID:hsye185,项目名称:SoftEng-306-Project-1,代码行数:14,代码来源:RobotPicker.py

示例11: __init__

 def __init__(self, position, id, scale):
     Robot.__init__(self,position,id,scale)
         
     self.type = randint(0,1)
     
     if self.type == 0:
         taskMgr.add( self.randomWalk, 'walk')
         self.destination = Point2()
         self.setRandomPoint( self.destination )
     else:
         taskMgr.add( self.hunt, 'hunt')
         self.target = None
             
     self.time = 0
     self.bulletTime = 0
开发者ID:DisposedCheese,项目名称:RobotFightingGame,代码行数:15,代码来源:AI.py

示例12: Simulation

class Simulation():
    def __init__(self):
        self.robot = Robot([640/2,640/2])
        self.robot.render(DisplayDriver.engine)
        #r.setBearing(random.random()*360)

        self.robot.velocity = 100

        #DisplayDriver.eventManager.bind(MOUSEMOTION,mouseMoved)
        DisplayDriver.engine.addTask(r.tick)


    def mouseMoved(event):
        pos = event.pos

        self.robot.setBearing(Point(pos).getBearing(r.getPos()))
开发者ID:maddockm,项目名称:ECU178A4,代码行数:16,代码来源:Main.py

示例13: update_robot

    def update_robot(self, unused_addr, args):
        print("update robot")
        self.robot.run()
        score = Robot.count("Soja")
        self.playerListBox.delete(0, tk.END)
        #self.playerListBox.insert(tk.END, player_name + " " + str(score))
        print(self.players_list)
        for p in self.players_list:
            self.playerListBox.insert(tk.END, p + " " + str(self.players_list[p]))

        msg = osc_message_builder.OscMessageBuilder(address="/player")
        msg.add_arg(player_name)
        msg.add_arg(score) #
        msg = msg.build()
        self.to_client_client.send(msg)

        if self.robot.win:
            # I am the winner
            # lets tel that to ohters
            msg = osc_message_builder.OscMessageBuilder(address="/winner")
            msg.add_arg(player_name)
            msg.add_arg(score)
            msg = msg.build()
            #self.to_client_client.send(msg)
            self.to_server_client.send(msg)
            alert(text = "Vous avez gagné la partie !")
开发者ID:RandomLab,项目名称:craft,代码行数:26,代码来源:run.py

示例14: select_a_rect_distance_search

	def select_a_rect_distance_search(self):

		self.load_environment()
		self.clear_components()

		self.optionDialog = DialogOption()
		self.optionDialog.display_option_message("Do you want avoid cycles")
		option_response = self.optionDialog.get_taken_option()

		message = "Please specify the numerator and denominator to complement the heuristic method"
		aSearchValueDialog = DialogASearchValues()
		aSearchValueDialog.show_request_message(message)
		numerator = aSearchValueDialog.get_numerator()
		denominator = aSearchValueDialog.get_denominator()
		
		self.robot = Robot(self,self.environment,self.dimension,self.queue_dimension,"A*h1",option_response,numerator,denominator)

		if option_response:
			self.labelSelectedSearch.setText("A* Straight Line Distance avoiding cycles")
		else:
			self.labelSelectedSearch.setText("A* Straight Line Distance with cycles")

		self.draw_environment()
		self.plainTextEditRobotStatus.appendPlainText("Ready .......")
		
		self.pushButtonMoveRobot.setEnabled(False)
		self.pushButtonLookGraph.setEnabled(True)
		self.pushButtonFastSearch.setEnabled(True)
		self.pushButtonNextStep.setEnabled(True)
开发者ID:DonAurelio,项目名称:Artificial_Intelligence_proyect,代码行数:29,代码来源:Window.py

示例15: Simulation

class Simulation():
    def __init__(self):
        self.town = Town(maxShops = 10)
        self.town.render(DisplayDriver.engine)
        self.robot = Robot(random.choice(list(self.town.shopDict)), town = self.town)
        self.robot.render(DisplayDriver.engine)

        self.consumeText = OnscreenText(pos = [Globals.RESOLUTION[0]-200,0], text = '', size = 20)
        self.consumeText.render(DisplayDriver.engine)

        self.distanceText = OnscreenText(pos = [Globals.RESOLUTION[0]-200,20], text = '', size = 20)
        self.distanceText.render(DisplayDriver.engine)

        self.contraintsText = OnscreenText(pos = [Globals.RESOLUTION[0]-200,30], text = '', size = 20)
        self.contraintsText.render(DisplayDriver.engine)



    def tick(self):
        self.robot.tick()
        self.distanceText.setText('Distance: %sm' %(int(self.robot.getDistanceTraveled())))
        self.consumeText.setText('Fuel Used: %s' %(int(self.robot.getFuelUsed())))

        try:
            self.contraintsText.setText('Distance/Fuel: %s' %(round(self.robot.getDistanceTraveled()/self.robot.getFuelUsed(), 2)))
        except ZeroDivisionError:
            pass
开发者ID:JJM07,项目名称:ECU178A4,代码行数:27,代码来源:Main.py


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