Esempio n. 1
0
 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
Esempio n. 2
0
 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
Esempio n. 3
0
# 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,
Esempio n. 4
0
# 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, start_paused = 1, render_objs=1, draw_contacts=1, publish_int=20)

yaw_joint      = s.robot.joints['hip_yaw']
pitch_joint    = s.robot.joints['hip_pitch']
knee_joint     = s.robot.joints['knee_pitch']
yaw_joint_bl   = s.robot.joints['hip_yaw_bl']