def __init__(self, direct=False): self.robot_config = arm.Config(use_cython=False, hand_attached=True) # Timestap is fixed and specified in .ttt file self.dt = 0.005 self.direct = direct if direct: self.interface = VREP(robot_config=self.robot_config, dt=self.dt) self.interface.connect() else: self.interface = None self.requested_reset_q = None self.requested_target_shadow_q = None self.close_requested = False
""" Move the UR5 VREP arm to a target position. The simulation ends after 1.5 simulated seconds, and the trajectory of the end-effector is plotted in 3D. """ import numpy as np import traceback from abr_control.arms import jaco2 as arm from abr_control.controllers import OSC, Damping, signals from abr_control.interfaces import VREP # initialize our robot config for the jaco2 robot_config = arm.Config(use_cython=True, hand_attached=False) # damp the movements of the arm damping = Damping(robot_config, kv=10) # instantiate controller ctrlr = OSC( robot_config, kp=200, null_controllers=[damping], vmax=[0.5, 0], # [m/s, rad/s] # control (x, y, z) out of [x, y, z, alpha, beta, gamma] ctrlr_dof=[True, True, True, False, False, False]) # create our adaptive controller adapt = signals.DynamicsAdaptation( n_neurons=1000, n_ensembles=5, n_input=2, # we apply adaptation on the most heavily stressed joints
Move the UR5 CoppeliaSim arm to a target position. The simulation ends after 1500 time steps, and the trajectory of the end-effector is plotted in 3D. """ 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
""" A basic script for connecting and moving the arm to a target configuration in joint space, offset from its starting position. The simulation simulates 1500 time steps and then plots the results. """ 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 Joint 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=False) # instantiate the REACH controller for the jaco2 robot ctrlr = Joint(robot_config, kp=50) # create interface and connect interface = VREP(robot_config=robot_config, dt=.005) interface.connect() # make the target an offset of the current configuration feedback = interface.get_feedback() target = feedback['q'] + np.ones(robot_config.N_JOINTS) * .3 # For VREP files that have a shadow arm to show the target configuration
from download_examples_db import check_exists as examples_db from abr_analyze.paths import figures_dir from abr_analyze.plotting import Draw3dData, DrawArm examples_db() # the number of samples to interpolate our data to, set to None for no # interpolation interpolated_samples = 100 # list our tests and their relevant save locations db_name = "abr_analyze_examples" test = "test_1" baseline = "baseline_1" # instantiate our robot config robot_config = jaco2.Config() # Instantiate our arm drawing module draw_arm = DrawArm( db_name=db_name, robot_config=robot_config, interpolated_samples=interpolated_samples, ) # instantiate our generic trajectory drawing module draw_3d = Draw3dData(db_name=db_name, interpolated_samples=interpolated_samples) plt.figure() ax = plt.subplot(111, projection="3d")