def __init__(self, start): self.start = start self.topics = getTopicFactory() self.power = self.topics.power.off self.mode = self.topics.mode.manual self.delta = Particle.DELTA self.setLocation(*start) self.moveIndex = 0
def onInit(self): self.logInfo(RobotConnection.LOG_NEW_CONNECTION) self.masterConn = self.data.masterConn self.driver = self.data.driver self.topics = getTopicFactory() self.methodHandlers = { RobotMethod.POWER: self.handlePower, RobotMethod.MODE: self.handleMode, RobotMethod.STATUS: self.handleStatus, } self.read()
def onInit(self, **kwargs): logging.info(RobotServer.LOG_SERVER_RUNNING) defaults = {RobotServer.PARAM_MASTER_CONN: None, RobotServer.PARAM_DRIVER: None} self.topics = getTopicFactory() self.servicesFound = False self.data.update(defaults, True) self.data.update(kwargs, False) self.driver = self.data.driver self.masterConn = self.data.masterConn
def main(): # Starts up a client connection to publish commands to Betelbot server. cfg = JsonConfig() topics = getTopicFactory() client = Client('', cfg.server.port, BetelbotClientConnection) conn = client.connect() thread = threading.Thread(target=threadedLoop) thread.daemon = True thread.start() teleop = Teleop(conn, topics, cfg.teleop.location, cfg.teleop.waypoint) teleop.printInstructions() teleop.run() term = NonBlockingTerm() term.run(teleop.onInput)
def initialize(self, conn): self.conn = conn self.topics = getTopicFactory() self.encoder = jsonrpc.Encoder()