def __init__(self, sim, world): self.robot = KukaIIWA(sim) self.world = world # change the robot visual self.robot.change_transparency() self.robot.draw_link_frames(link_ids=[-1, 0]) self.start_pos = np.array([-0.75, 0., 0.75]) self.end_pos = np.array([0.75, 0., 0.75]) self.pid = {'kp': 100, 'kd': 0} self.ee_id = self.robot.get_end_effector_ids(end_effector=0)
def __init__(self, spheres=[[0.09, -0.44, 0.715, 1]], cuboids=None): # Define size of the map self.res = 1. # Initialize XBox controller self.controller = XboxControllerInterface(use_thread=True, verbose=False) # Create simulator self.sim = Bullet() # create world self.world = BasicWorld(self.sim) # create robot self.robot = KukaIIWA(self.sim) # define start/end pt self.start_pt = [-0.75, 0., 0.75] self.end_pt = [0.75, 0., 0.75] # Initialize robot location self.send_robot_to(np.array(self.start_pt), dt=2) # Get via points from user via_pts = self.get_via_pts( ) # [[-0.19, -0.65, 0.77], [0.51, -0.44, 0.58]] self.motion_targets = [self.start_pt] + via_pts + [self.end_pt]
import os import pickle from itertools import count from pyrobolearn.simulators import Bullet from pyrobolearn.worlds import BasicWorld from pyrobolearn.robots import KukaIIWA, Body # Create simulator sim = Bullet() # create world world = BasicWorld(sim) # create robot robot = KukaIIWA(sim) robot.print_info() # define useful variables for FK link_id = robot.get_end_effector_ids(end_effector=0) joint_ids = robot.joints # actuated joint # load data with open(os.path.dirname(os.path.abspath(__file__)) + '/data.txt', 'rb') as f: positions = pickle.load(f) # set initial joint position robot.reset_joint_states(q=positions[0]) # draw a sphere at the position of the end-effector sphere = world.load_visual_sphere(