コード例 #1
0
 def sendTPControlCommandToRobot(self, tpControlRole):
     commandChannelMsg = t_commandChannel()
     commandChannelMsg.sender = 'C'
     commandChannelMsg.to = '%s' % self.robotID
     commandChannelMsg.commandOwner = 'fieldSetup'
     commandChannelMsg.commandType = t_commandChannel.controlInterfaceRole
     commandChannelMsg.commandValue = tpControlRole
     commandChannelMsg.commandID = 0  # not used by this program
     commandChannelHandle.publish(commandChannelMsg)
コード例 #2
0
 def autoFeedOwnBallOff(self):
     print "R%d :autoFeedOwnBall Off" % self.robotNR
     self.autoFeedOwnBall = False
     commandChannelMsg = t_commandChannel()
     commandChannelMsg.sender = 'C'
     commandChannelMsg.to = '%s' % self.robotNR
     commandChannelMsg.commandOwner = 'fieldSetup'
     commandChannelMsg.commandType = t_commandChannel.stringCommand
     commandChannelMsg.commandValue = "autoFeedOwnBall Off"
     commandChannelMsg.commandID = 0  # not used by this program
     commandChannelHandle.publish(commandChannelMsg)
コード例 #3
0
 def sendObstacleListToRobot(self):
     print "R%d :Sending obstaclelist" % self.robotNR
     commandChannelMsg = t_commandChannel()
     commandChannelMsg.sender = 'C'
     commandChannelMsg.to = "%s" % self.robotNR
     commandChannelMsg.commandOwner = 'fieldSetup'
     commandChannelMsg.commandType = t_commandChannel.obstacleList
     commandChannelMsg.commandValue = pickle.dumps(
         self.getObstacleCoordList())  #serialize
     commandChannelMsg.commandID = 0  # not used by this program
     commandChannelHandle.publish(commandChannelMsg)
コード例 #4
0
 def autoFeedOwnObstaclesOn(self):
     self.autoFeedOwnObstacles = True
     print "R%d :autoFeedOwnObstacles On" % self.robotNR
     commandChannelMsg = t_commandChannel()
     commandChannelMsg.sender = 'C'
     commandChannelMsg.to = '%s' % self.robotNR
     commandChannelMsg.commandOwner = 'fieldSetup'
     commandChannelMsg.commandType = t_commandChannel.stringCommand
     commandChannelMsg.commandValue = "autoFeedOwnObstacles On"
     commandChannelMsg.commandID = 0  # not used by this program
     commandChannelHandle.publish(commandChannelMsg)
     self.sendObstacleListToRobot()
コード例 #5
0
    def setLocation(self, x,
                    y):  #used for interactive mode to emulate ball position
        self.x = x
        self.y = y
        commandChannelMsg = t_commandChannel()
        commandChannelMsg.sender = 'C'
        commandChannelMsg.to = '%s' % self.robotNR
        commandChannelMsg.commandOwner = 'fieldSetup'
        commandChannelMsg.commandType = t_commandChannel.stringCommand
        commandChannelMsg.commandValue = "ball %s %s" % (x, y)
        commandChannelMsg.commandID = 0  # not used by this program
        commandChannelHandle.publish(commandChannelMsg)

        print "R%d set: %s " % (self.robotNR, commandChannelMsg.commandValue)