Exemple #1
0
    subfolder = 'two_link'
elif args['ARM'][:4] == 'arm3':
    subfolder = 'three_link'
arm_name = 'arms.%s.%s'%(subfolder, 'arm'+args['ARM'][4:])
arm_module = importlib.import_module(name=arm_name)
arm = arm_module.Arm(dt=dt)

# get the chosen controller class
controller_name = 'controllers.%s'%args['CONTROLLER'].lower()
controller_class = importlib.import_module(name=controller_name)

# get the chosen task class
task_name = 'tasks.%s'%args['TASK']
task_module = importlib.import_module(name=task_name)
print 'task: ', task_module
task = task_module.Task

# instantiate the controller for the chosen task
# and get the sim_and_plot parameters 
control_shell, runner_pars = task(arm, controller_class,
    sequence=args['--sequence'], scale=args['--scale'], 
    force=float(args['--force']) if args['--force'] is not None else None, 
    write_to_file=bool(args['--write_to_file']))

# set up simulate and plot system
runner = Runner(dt=dt, **runner_pars)
runner.run(arm=arm, control_shell=control_shell, 
        end_time=float(args['--end_time']) \
                if args['--end_time'] is not None else None)
runner.show()
Exemple #2
0
arm_module = importlib.import_module(name=arm_name)
arm = arm_module.Arm(dt=dt)

# get the chosen controller class
controller_name = 'controllers.%s' % args['CONTROLLER'].lower()
controller_class = importlib.import_module(name=controller_name)

# get the chosen task class
task_name = 'tasks.%s' % args['TASK']
task_module = importlib.import_module(name=task_name)
print('task: ', task_module)
task = task_module.Task

# instantiate the controller for the chosen task
# and get the sim_and_plot parameters
control_shell, runner_pars = task(
    arm,
    controller_class,
    sequence=args['--sequence'],
    scale=args['--scale'],
    force=float(args['--force']) if args['--force'] is not None else None,
    write_to_file=bool(args['--write_to_file']))

# set up simulate and plot system
runner = Runner(dt=dt, **runner_pars)
runner.run(arm=arm,
           control_shell=control_shell,
           end_time=(float(args['--end_time'])
                     if args['--end_time'] is not None else None))
runner.show()
Exemple #3
0
# get and instantiate the chosen arm
arm_class = {'arm1':Arm1,
             'arm2':Arm2,
             'arm2_python':Arm2Python,
             'arm3':Arm3}[args['ARM']]
arm = arm_class(options=args['--arm_options'])

# get the chosen controller class
control_class = {'dmp':dmp.Shell,
           'gc':gc.Control,
           'osc':osc.Control,
           'trace':trace.Shell}[args['CONTROL']]

# get the chosen task class
task = {'follow':follow_mouse.Task,
        'random':random_movements.Task,
        'reach':reach.Task,
        'write_numbers':write_numbers.Task,
        'write_words':write_words.Task,
        'walk':walk.Task}[args['TASK']]

# instantiate the controller for the chosen task
# and get the sim_and_plot parameters 
control_shell, runner_pars = task(arm_class, control_class)

# set up simulate and plot system
runner = Runner(**runner_pars)

runner.run(arm=arm, control_shell=control_shell, video=args['--video'])
runner.show()
Exemple #4
0
    subfolder = 'two_link'
elif args['ARM'][:4] == 'arm3':
    subfolder = 'three_link'
arm_name = 'Arms.%s.%s' % (subfolder, 'arm' + args['ARM'][4:])
arm_module = importlib.import_module(name=arm_name)
arm = arm_module.Arm(dt=dt)

# get the chosen controller class
controller_name = 'Controllers.%s' % args['CONTROLLER'].lower()
controller_class = importlib.import_module(name=controller_name)

# get the chosen task class
task_name = 'Tasks.%s' % args['TASK']
task_module = importlib.import_module(name=task_name)
task = task_module.Task

# instantiate the controller for the chosen task
# and get the sim_and_plot parameters
control_shell, runner_pars = task(
    arm,
    controller_class,
    sequence=args['--phrase'],
    scale=args['--scale'],
    force=float(args['--force']) if args['--force'] is not None else None,
    write_to_file=bool(args['--write_to_file']))

# set up simulate and plot system
runner = Runner(dt=dt, **runner_pars)
runner.run(arm=arm, control_shell=control_shell, end_time=args['--end_time'])
runner.show()
Exemple #5
0
    subfolder = 'one_link'
if args['ARM'][:4] == 'arm2':
    subfolder = 'two_link'
elif args['ARM'][:4] == 'arm3':
    subfolder = 'three_link'
arm_name = 'Arms.%s.%s'%(subfolder, 'arm'+args['ARM'][4:])
arm_module = importlib.import_module(name=arm_name)
arm = arm_module.Arm(dt=dt)

# get the chosen controller class
controller_name = 'Controllers.%s'%args['CONTROLLER'].lower()
controller_class = importlib.import_module(name=controller_name)

# get the chosen task class
task_name = 'Tasks.%s'%args['TASK']
task_module = importlib.import_module(name=task_name)
task = task_module.Task

# instantiate the controller for the chosen task
# and get the sim_and_plot parameters 
control_shell, runner_pars = task(arm, controller_class,
    sequence=args['--phrase'], scale=args['--scale'], 
    force=float(args['--force']) if args['--force'] is not None else None, 
    write_to_file=bool(args['--write_to_file']))

# set up simulate and plot system
runner = Runner(dt=dt, **runner_pars)
runner.run(arm=arm, control_shell=control_shell, 
        end_time=args['--end_time'])
runner.show()
Exemple #6
0
                             'tau':.01, # tau is the time scaling term
                             'add_to_goals':[0,0, 0,-.3, 5e-4,-.3]}) # respecify goals for spatial scaling
    else: 
        from Controllers.control_trajectory import Control_trajectory as Control
        control_pars.update({'dt':.00001}) # how fast the trajectories rolls out

    control_pars.update({'pen_down':False, 
                         'gain':1000, # pd gain for trajectory following
                         'trajectory':trajectory.T})
    #[0, 1.5, 1, 3]
    runner_pars.update({'box':[-1.75, 1.75, 1, 2.5],#[-3,3,0,3],#[-.5, .5, 0, .5],
                       'trajectory':trajectory})

#--------------------------------
# run and plot the system

kp = 5 # position error gain on the PD controller

arm = Arm(**arm_pars)
control = Control(kp=kp, kv=np.sqrt(kp), **control_pars)

# set up mouse control
runner = Runner(dt=1e-4, 
                control_steps=1,
                display_steps=100, 
                t_target=1., 
                **runner_pars)

runner.run(arm=arm, control=control)#, video='word.mp4')
runner.show()
Exemple #7
0
}[args['ARM']]
arm = arm_class(options=args['--arm_options'])

# get the chosen controller class
control_class = {
    'dmp': dmp.Shell,
    'gc': gc.Control,
    'osc': osc.Control,
    'trace': trace.Shell
}[args['CONTROL']]

# get the chosen task class
task = {
    'follow': follow_mouse.Task,
    'random': random_movements.Task,
    'reach': reach.Task,
    'write_numbers': write_numbers.Task,
    'write_words': write_words.Task,
    'walk': walk.Task
}[args['TASK']]

# instantiate the controller for the chosen task
# and get the sim_and_plot parameters
control_shell, runner_pars = task(arm_class, control_class)

# set up simulate and plot system
runner = Runner(**runner_pars)

runner.run(arm=arm, control_shell=control_shell, video=args['--video'])
runner.show()