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)
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)
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)
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()
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)