Exemplo n.º 1
0
from abr_control.controllers import OSC, path_planners

print('\nClick to move the target.\n')

# initialize our robot config
robot_config = arm.Config(use_cython=True)

# create our arm simulation
arm_sim = arm.ArmSim(robot_config)

# create an operational space controller
ctrlr = OSC(robot_config, kp=100, vmax=10)

# create our path planner
n_timesteps = 250  # give .25s to reach target
path_planner = path_planners.Linear(robot_config)

# create our interface
interface = PyGame(robot_config, arm_sim, dt=.001)
interface.connect()

# set up lists for tracking data
ee_path = []
target_path = []

try:
    count = 0
    while 1:
        # get arm feedback
        feedback = interface.get_feedback()
        hand_xyz = robot_config.Tx('EE', feedback['q'])
arm_sim = arm.ArmSim(robot_config)

# damp the movements of the arm
damping = Damping(robot_config, kv=10)
# create an operational space controller
ctrlr = OSC(
    robot_config,
    kp=200,
    null_controllers=[damping],
    # control (gamma) out of [x, y, z, alpha, beta, gamma]
    ctrlr_dof=[True, True, False, False, False, False],
)

# create our path planner
target_dx = 0.001
path_planner = path_planners.Linear(dx=target_dx)

# create our interface
interface = PyGame(robot_config, arm_sim, dt=0.001)
interface.connect()

try:
    print("\nSimulation starting...")
    print("Click to move the target.\n")

    count = 0
    dx_track = []
    while 1:
        # get arm feedback
        feedback = interface.get_feedback()
        hand_xyz = robot_config.Tx("EE", feedback["q"])
    kp=200,
    null_controllers=[damping],
    # control (gamma) out of [x, y, z, alpha, beta, gamma]
    ctrlr_dof=[True, True, False, False, False, False],
)

# create our path planner
params = {"n_timesteps": 500}
if use_wall_clock:
    run_time = 1  # wall clock time to run each trajectory for
    time_elapsed = np.copy(run_time)
    count = 0
else:
    count = np.copy(params["n_timesteps"])
    time_elapsed = 0.0
path_planner = path_planners.Linear(**params)

# create our interface
interface = PyGame(robot_config, arm_sim, dt=0.001)
interface.connect()

try:
    print("\nSimulation starting...")
    print("Click to move the target.\n")

    while 1:
        start = timeit.default_timer()
        # get arm feedback
        feedback = interface.get_feedback()
        hand_xyz = robot_config.Tx("EE", feedback["q"])
from abr_control.controllers import OSC, Damping, path_planners

# initialize our robot config
robot_config = arm.Config(use_cython=True)

# create our arm simulation
arm_sim = arm.ArmSim(robot_config)

# damp the movements of the arm
damping = Damping(robot_config, kv=10)
# create an operational space controller
ctrlr = OSC(robot_config, kp=100, null_controllers=[damping])

# create our path planner
n_timesteps = 1000  # give 250 time steps to reach target
path_planner = path_planners.Linear()

# create our interface
interface = PyGame(robot_config, arm_sim, dt=.001)
interface.connect()

# control (x, y) out of [x, y, z, alpha, beta, gamma]
ctrlr_dof = [True, True, False, False, False, False]

try:
    print('\nSimulation starting...')
    print('Click to move the target.\n')

    count = 0
    while 1:
        # get arm feedback