def createPublisher(self, values_to_publish): """Creates a publisher on the next available port. If you'd like a custom real time graph simply call this method with a list of what you want graphed and then hook up a consumer that graphs the output (SimulationKit.pubsub.Subscriber). """ pub = Publisher(self.next_publisher_port) self.next_publisher_port += 1 for val in values_to_publish: pub.addToCatalog("logging." + val, self.__getattr__("get_" + val)) pub.start() return pub
# Check command-line arguments to find the planner module retval = importPlanner() # FIXME: This is to allow backwards compatibility to older versions of importPlanner if type(retval) == tuple: if len(retval) == 3: update, controller, graceful_exit = retval elif len(retval) == 2: update, controller = retval else: update = retval controller = None commands = [0, 0, 0] publisher = Publisher(5055) if controller != None: publisher.addToCatalog('yaw_ang_target', controller.getDesiredYawDeg) publisher.addToCatalog('pitch_ang_target', controller.getDesiredPitchDeg) publisher.addToCatalog('knee_ang_target', controller.getDesiredKneeDeg) publisher.addToCatalog('yaw_cmd', lambda: commands[0]) publisher.addToCatalog('pitch_cmd', lambda: commands[1]) publisher.addToCatalog('knee_cmd', lambda: commands[2]) d = {'offset': (0, 0, 2.00)} s = Simulator(dt=5e-3, plane=1, pave=0, graphical=1, robot=LegOnColumn, robot_kwargs=d,