Beispiel #1
0
def single_leg_controller():
    import leg_model as lm
    import leg_controller as lc
    import model_animator as ma
    from ik_3dof import IK_3DoF
    from multiprocessing import Pipe

    # Set up leg
    model_leg = lm.get_test_leg()
    leg_controller = lc.LegController(lm.get_test_leg(), IK_3DoF)

    # Inter-thread/process communication pipes
    step_command_output, step_command_input = Pipe()
    servo_command_output, servo_command_input = Pipe()
    segment_output, segment_input = Pipe()

    # Threads and processes
    thread.start_new_thread(point_keyboard, (step_command_input, ))
    leg_controller_process = Process(target=lc.leg_controller_updater,
                                     args=(leg_controller, step_command_output,
                                           servo_command_input))
    model_leg_process = Process(target=lm.leg_model_updater,
                                args=(model_leg, servo_command_output,
                                      segment_input))
    segment_supplier = ma.SegmentSupplier(segment_output)

    leg_controller_process.start()
    model_leg_process.start()

    canvas = ma.Canvas()
    canvas.register_drawable(segment_supplier)
    canvas.show()

    leg_controller_process.join()
    model_leg_process.join()
def single_leg_controller():
  import leg_model as lm
  import leg_controller as lc
  import model_animator as ma
  from ik_3dof import IK_3DoF
  from multiprocessing import Pipe

  # Set up leg
  model_leg = lm.get_test_leg() 
  leg_controller = lc.LegController(lm.get_test_leg(), IK_3DoF)

  # Inter-thread/process communication pipes
  step_command_output, step_command_input = Pipe()
  servo_command_output, servo_command_input = Pipe()
  segment_output, segment_input = Pipe()

  # Threads and processes
  thread.start_new_thread(point_keyboard, (step_command_input,))
  leg_controller_process = Process(target=lc.leg_controller_updater, args=(leg_controller, step_command_output, servo_command_input))
  model_leg_process = Process(target=lm.leg_model_updater, args=(model_leg, servo_command_output, segment_input))
  segment_supplier = ma.SegmentSupplier(segment_output)

  leg_controller_process.start()
  model_leg_process.start()

  canvas = ma.Canvas()
  canvas.register_drawable(segment_supplier)
  canvas.show()

  leg_controller_process.join()
  model_leg_process.join()
def leg_test():
  import leg_model as lm
  from math import pi

  leg = lm.get_test_leg() 
  leg.set_angles([pi/5, pi/5, -pi/2])
  canvas = Canvas()
  canvas.register_drawable(leg)
  canvas.show()
Beispiel #4
0
def leg_test():
    import leg_model as lm
    from math import pi

    leg = lm.get_test_leg()
    leg.set_angles([pi / 5, pi / 5, -pi / 2])
    canvas = Canvas()
    canvas.register_drawable(leg)
    canvas.show()
Beispiel #5
0
def get_test_chassis():
    import math
    midwidth = 2.
    topwidth = 1.5
    height = 2.5

    top_r_p = pose.Pose(topwidth, height, 0, math.atan2(height, topwidth), 0,
                        0)
    mid_r_p = pose.Pose(midwidth, 0, math.atan2(0, midwidth), 0, 0, 0)
    bot_r_p = pose.Pose(topwidth, -height, 0, math.atan2(-height, topwidth), 0,
                        0)
    bot_l_p = pose.Pose(-topwidth, -height, 0, math.atan2(-height, -topwidth),
                        0, 0)
    mid_l_p = pose.Pose(-midwidth, 0, 0, math.atan2(0, -midwidth), 0, 0)
    top_l_p = pose.Pose(-topwidth, height, 0, math.atan2(height, -topwidth), 0,
                        0)

    top_r = lm.get_test_leg()
    mid_r = lm.get_test_leg()
    bot_r = lm.get_test_leg()
    bot_l = lm.get_test_leg()
    mid_l = lm.get_test_leg()
    top_l = lm.get_test_leg()

    legs = [top_r, mid_r, bot_r, bot_l, mid_l, top_l]
    leg_poses = [top_r_p, mid_r_p, bot_r_p, bot_l_p, mid_l_p, top_l_p]

    return Chassis(legs, leg_poses)
def get_test_chassis():
  import math
  midwidth = 2.
  topwidth = 1.5
  height = 2.5

  top_r_p = pose.Pose(topwidth,height,0,math.atan2(height, topwidth),0,0)
  mid_r_p = pose.Pose(midwidth,0,math.atan2(0,midwidth),0,0,0)
  bot_r_p = pose.Pose(topwidth,-height,0,math.atan2(-height,topwidth),0,0)
  bot_l_p = pose.Pose(-topwidth,-height,0,math.atan2(-height,-topwidth),0,0)
  mid_l_p = pose.Pose(-midwidth,0,0,math.atan2(0,-midwidth),0,0)
  top_l_p = pose.Pose(-topwidth,height,0,math.atan2(height,-topwidth),0,0)

  top_r = lm.get_test_leg()
  mid_r = lm.get_test_leg()
  bot_r = lm.get_test_leg()
  bot_l = lm.get_test_leg()
  mid_l = lm.get_test_leg()
  top_l = lm.get_test_leg()

  legs = [top_r, mid_r, bot_r, bot_l, mid_l, top_l]
  leg_poses = [top_r_p, mid_r_p, bot_r_p, bot_l_p, mid_l_p, top_l_p]
  
  return Chassis(legs, leg_poses)