예제 #1
0
import traceback

# from abr_control.arms import ur5 as arm
from abr_control.arms import jaco2 as arm
# from abr_control.arms import onelink as arm
from abr_control.controllers import Sliding
from abr_control.interfaces import VREP

# initialize our robot config
# robot_config = arm.Config(use_cython=True)
# if using the Jaco 2 arm with the hand attached, use the following instead:
robot_config = arm.Config(use_cython=True, hand_attached=True)

# instantiate controller
# NOTE: These values are non-optimal
ctrlr = Sliding(robot_config, kd=10.0, lamb=30.00)

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

# set up lists for tracking data
ee_track = []
target_track = []

try:
    # get the end-effector's initial position
    feedback = interface.get_feedback()
    start = robot_config.Tx('EE', feedback['q'])
    # make the target offset from that start position
    target_xyz = start + np.array([0.2, -0.2, 0.0])
예제 #2
0
import traceback
import numpy as np

# from abr_control.arms import ur5 as arm
from abr_control.arms import jaco2 as arm

# from abr_control.arms import onejoint as arm
from abr_control.controllers import Sliding
from abr_control.interfaces import CoppeliaSim

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

# instantiate controller
# NOTE: These values are non-optimal
ctrlr = Sliding(robot_config, kd=10.0, lamb=30.00)

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

# set up lists for tracking data
ee_track = []
target_track = []

try:
    # get the end-effector's initial position
    feedback = interface.get_feedback()
    start = robot_config.Tx("EE", feedback["q"])

    # make the target offset from that start position
예제 #3
0
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 import PyGame
from abr_control.controllers import Sliding, signals

# 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 = Sliding(robot_config, kd=30)

# create our nonlinear adaptation controller
adapt = signals.DynamicsAdaptation(
    n_input=robot_config.N_JOINTS,
    n_output=robot_config.N_JOINTS,
    pes_learning_rate=1e-1,
    means=[0, 0, 0],
    variances=[2 * np.pi, 2 * np.pi, 2 * np.pi],
)


def on_click(self, mouse_x, mouse_y):
    self.target[0] = self.mouse_x
    self.target[1] = self.mouse_y
예제 #4
0
# from abr_control.arms import twolink as arm
from abr_control.interfaces import PyGame
from abr_control.controllers import Sliding, signals


# initialize our robot config
robot_config = arm.Config(use_cython=True)
# get Jacobians to each link for calculating perturbation
J_links = [robot_config._calc_J('link%s' % ii, x=[0, 0, 0])
           for ii in range(robot_config.N_LINKS)]

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

# create an operational space controller
ctrlr = Sliding(robot_config)

# create our nonlinear adaptation controller
adapt = signals.DynamicsAdaptation(
    n_input=robot_config.N_JOINTS,
    n_output=robot_config.N_JOINTS,
    pes_learning_rate=1e-2, backend='nengo')

def on_click(self, mouse_x, mouse_y):
    self.target[0] = self.mouse_x
    self.target[1] = self.mouse_y


def on_keypress(self, key):
    if key == pygame.K_SPACE:
        self.adaptation = not self.adaptation
move the end-effector to the target, which can be moved by
clicking on the background.
"""
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 Sliding

# initialize our robot config
robot_config = arm.Config()
# create our arm simulation
arm_sim = arm.ArmSim(robot_config)

# create an operational space controller
ctrlr = Sliding(robot_config)


def on_click(self, mouse_x, mouse_y):
    self.target[0] = self.mouse_x
    self.target[1] = self.mouse_y


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

# create a target
feedback = interface.get_feedback()
target_xyz = robot_config.Tx("EE", feedback["q"])
interface.set_target(target_xyz)
예제 #6
0
trajectory of the end-effector is plotted in 3D.
"""
import numpy as np
import traceback

# from abr_control.arms import ur5 as arm
from abr_control.arms import jaco2 as arm
# from abr_control.arms import onelink as arm
from abr_control.controllers import OSC, Sliding
from abr_control.interfaces import VREP

# initialize our robot config for the ur5
robot_config = arm.Config(use_cython=True, hand_attached=True)

# instantiate controller
ctrlr = Sliding(robot_config, kd=16.0, lamb=3.00)

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

# set up lists for tracking data
ee_track = []
target_track = []

try:
    # get the end-effector's initial position
    feedback = interface.get_feedback()
    start = robot_config.Tx('EE', feedback['q'])
    # make the target offset from that start position
    target_xyz = start + np.array([0.2, -0.2, 0.0])