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 Floating 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 the controller ctrlr = Floating(robot_config, dynamic=True) # create the VREP interface and connect up interface = VREP(robot_config, dt=.005) interface.connect() # set up arrays for tracking end-effector and target position ee_track = [] try: feedback = interface.get_feedback() start = robot_config.Tx('EE', q=feedback['q']) # run ctrl.generate once to load all functions zeros = np.zeros(robot_config.N_JOINTS) ctrlr.generate(q=zeros, dq=zeros)
mode, which only compensates for gravity. The end-effector position is recorded and plotted when the script is exited (with ctrl-c). """ 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 Floating from abr_control.interfaces import VREP # initialize our robot config robot_config = arm.Config(use_cython=True) # instantiate the controller ctrlr = Floating(robot_config) # create the VREP interface and connect up interface = VREP(robot_config, dt=.001) interface.connect() # set up arrays for tracking end-effector and target position ee_track = [] try: feedback = interface.get_feedback() start = robot_config.Tx('EE', q=feedback['q']) while 1: # get joint angle and velocity feedback feedback = interface.get_feedback() # calculate the control signal
In this example, the floating controller is applied in the joint space """ import numpy as np import traceback import glfw from abr_control.controllers import Floating from abr_control.arms.mujoco_config import MujocoConfig as arm from abr_control.interfaces.mujoco import Mujoco from abr_control.utils import transformations # initialize our robot config robot_config = arm('jaco2') # instantiate the controller ctrlr = Floating(robot_config, task_space=True, dynamic=True) # create the Mujoco interface and connect up interface = Mujoco(robot_config, dt=.001) interface.connect() interface.send_target_angles(robot_config.START_ANGLES) # set up arrays for tracking end-effector and target position ee_track = [] q_track = [] try: # get the end-effector's initial position feedback = interface.get_feedback() start = robot_config.Tx('EE', q=feedback['q'])
is recorded and plotted when the script is exited (with ctrl-c). In this example, the floating controller is applied in the joint space """ import traceback import numpy as np from abr_control.arms import jaco2 as arm from abr_control.controllers import Floating from abr_control.interfaces import CoppeliaSim # initialize our robot config robot_config = arm.Config() # instantiate the controller ctrlr = Floating(robot_config, dynamic=False, task_space=False) # create the CoppeliaSim interface and connect up interface = CoppeliaSim(robot_config, dt=0.005) interface.connect() # set up arrays for tracking end-effector and target position ee_track = [] q_track = [] try: # get the end-effector's initial position feedback = interface.get_feedback() start = robot_config.Tx("EE", q=feedback["q"]) print("\nSimulation starting...\n")
"""Uses force control to compensate for gravity. The arm will hold its position while maintaining compliance. """ import numpy as np import traceback import time import abr_jaco2 from abr_control.controllers import Floating # initialize our robot config robot_config = abr_jaco2.Config( use_cython=True) ctrlr = Floating(robot_config, dynamic=True, task_space=True) # run controller once to generate functions / take care of overhead # outside of the main loop, because force mode auto-exits after 200ms zeros = np.zeros(robot_config.N_JOINTS) ctrlr.generate(zeros, zeros) # create our interface for the jaco2 interface = abr_jaco2.Interface(robot_config) q_track = [] u_track = [] q_T_track = [] # connect to the jaco interface.connect() interface.init_position_mode() # Move to home position
***NOTE*** that this is a minimal controller and when other controllers are added (OSC, dynamics_adaptation etc) the control loop time will increase. """ import numpy as np import traceback import timeit import abr_jaco2 from abr_control.controllers import Floating # initialize our robot config robot_config = abr_jaco2.Config(use_cython=True, hand_attached=True) ctrlr = Floating(robot_config) # run controller once to generate functions / take care of overhead # outside of the main loop, because force mode auto-exits after 200ms zeros = np.zeros(robot_config.N_JOINTS) ctrlr.generate(zeros, zeros) # create our interface for the jaco2 interface = abr_jaco2.Interface(robot_config) time_track = [] # connect to the jaco interface.connect() interface.init_position_mode() # Move to home position