示例#1
0
	def __init__(self,features,user_name = None):
		
		self.com = COM()
		self.robot = hsrb_interface.Robot()

		self.noise = 0.1
		self.features = features#self.com.binary_image
		self.count = 0
	
		if(not user_name == None):
			self.com.Options.setup(self.com.Options.root_dir,user_name)

		

		self.omni_base = self.robot.get('omni_base')
		self.whole_body = self.robot.get('whole_body')
		self.gripper = self.robot.get('gripper')

		self.com.go_to_initial_state(self.whole_body,self.gripper)

		self.joystick = JoyStick_X(self.com)

		self.policy = Policy(self.com,self.features)

		self.com.change_grip(self.gripper)
示例#2
0
    def __init__(self, user_name=None, inject_noise=False, noise_scale=1.0):
        self.robot = hsrb_interface.Robot()

        self.noise = 0.1

        self.omni_base = self.robot.get('omni_base')
        self.whole_body = self.robot.get('whole_body')
        self.gripper = self.robot.get('gripper')
        self.tl = TransformListener()
        self.cam = RGBD()
        time.sleep(5)
        self.b_d = Bottle_Detect(self.cam.read_info_data())

        self.start_recording = False
        self.stop_recording = False

        self.com = COM()

        if (not user_name == None):
            self.com.Options.setup(self.com.Options.root_dir, user_name)

        #self.com.go_to_initial_state(self.whole_body,self.gripper)

        #self.whole_body.move_to_joint_positions({'head_tilt_joint':-0.3})

        self.joystick = JoyStick_X(self.com,
                                   inject_noise=inject_noise,
                                   noise_scale=noise_scale)
        self.torque = Gripper_Torque()
        self.joints = Joint_Positions()
示例#3
0
    def __init__(self, user_name=None):
        self.noise = 0.1

        self.start_recording = False
        self.stop_recording = False

        self.com = COM(load_net=True)

        if (not user_name == None):
            self.com.Options.setup(self.com.Options.root_dir, user_name)

        self.com.load_net()

        self.options = self.com.Options

        self.features = Features()
示例#4
0
    def __init__(self):
        self.robot = hsrb_interface.Robot()

        self.noise = 0.1

        self.omni_base = self.robot.get('omni_base')
        self.whole_body = self.robot.get('whole_body')
        self.gripper = self.robot.get('gripper')
        self.tl = TransformListener()

        self.start_recording = False
        self.stop_recording = False

        self.com = COM()

        self.com.go_to_initial_state(self.whole_body, self.gripper)

        #self.whole_body.move_to_joint_positions({'head_tilt_joint':-0.3})

        self.cam = RGBD()

        self.joystick = JoyStick()
        self.torque = Gripper_Torque()
        self.joints = Joint_Positions()
示例#5
0
    if args.last is not None:
        last = args.last
    else:
        print "please enter a last value with -l (not inclusive)"
        sys.exit()

    f = []
    for (dirpath, dirnames, filenames) in os.walk(
            Options.rollouts_dir):  #specific: sup_dir from specific options
        print dirpath
        print filenames
        f.extend(dirnames)

    train_data = []
    test_data = []
    com = COM()

    image_data = []
    count = 0
    for filename in f:

        rollout_data = pickle.load(
            open(Options.rollouts_dir + filename + '/rollout.p', 'r'))

        state = rollout_data[0]

        img = state['color_img']

        com.depth_state(state)

        height, width, layers = img.shape
示例#6
0
        
        c_img = self.cam.read_color_data()
        
        pos = self.com.eval_policy(c_img,self.features)
        print pos
        twist = self.com.format_twist(pos)

        self.pubTwist.publish(twist)


if __name__ == "__main__":
   
    
    yumi = YuMiRobot()
    options = Options()
    com = COM(train=False)
    bincam = BinaryCamera(options)
    yumi.set_z('fine')
    
    
    bincam.open(threshTolerance= options.THRESH_TOLERANCE)

    frame = bincam.display_frame()

    yumi.set_v(1500)
    
    debug_overlay(bincam,options.binaries_dir+'rollout0_frame_0.jpg')
    
    
    pi = Policy(yumi,com,bincam=bincam)
示例#7
0
from skvideo.io import vwrite
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"  # see issue #152
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
from il_ros_hsr.p_pi.safe_corl.features import Features

#######NETWORK FILES TO BE CHANGED#####################
#specific: imports options from specific options file
from il_ros_hsr.p_pi.safe_corl.options import Corl_Options as options
from il_ros_hsr.p_pi.safe_corl.com import Safe_COM as COM

#specific: fetches specific net file
#from deep_lfd.tensor.nets.net_grasp import Net_Grasp as Net
########################################################

Options = options()
com = COM(load_net=True)
features = Features()


def caculate_error(data):

    errors = np.zeros([len(data), 3])
    count = 0
    for state in data:

        img = state['color_img']
        action = state['action']

        action_ = com.eval_policy(img, features.vgg_features, cropped=True)

        dif = np.abs(action - action_)