Ejemplo n.º 1
0
To turn adaptation on or off, press the spacebar.
"""
import numpy as np
from os import environ

environ["PYGAME_HIDE_SUPPORT_PROMPT"] = "1"
import pygame

from abr_control.arms import threejoint as arm

# from abr_control.arms import twojoint as arm
from abr_control.interfaces.pygame import PyGame
from abr_control.controllers import OSC, Damping, signals

# initialize our robot config
robot_config = arm.Config()
# 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=50,
    null_controllers=[damping],
    # control (x, y) out of [x, y, z, alpha, beta, gamma]
    ctrlr_dof=[True, True, False, False, False, False],
)

# create our nonlinear adaptive controller
There is largely no benefit to using wall clock time in simulation, but for
implementation on real robots it can be a very helpful function.
"""
import numpy as np
import timeit

from abr_control.arms import threejoint as arm
from abr_control.interfaces import PyGame
from abr_control.controllers import OSC, Damping, path_planners

# if set to True, the simulation will plan the path to
# last for 1 second of real-time
use_wall_clock = False

# initialize our robot config for the ur5
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=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 = {}