mug.SetTransform(mugTransform) s = SuperRaveEnv(rave_env=env, beacons=beacons) s.draw() robot = env.GetRobots()[0] # get the first robot arm = BarretWAM(robot, env) arm.attach_sensor(BeaconSensor3D(decay_coeff=25), lambda x: arm.traj_pos(x)) localizer = RaveLocalizerBot(arm, mug_pos) localizer.attach_sensor( OpenRAVECamera(KK=np.mat( np.array([(640.0, 0.0, 320.0), (0.0, 480.0, 240.0), (0.0, 0.0, 1.0)]))), lambda x: localizer.camera_obj_state(x)) s.add_robot(localizer) for attachedsensor in robot.GetAttachedSensors(): if attachedsensor.GetSensor().Supports(Sensor.Type.Camera): attachedsensor.GetSensor().Configure(Sensor.ConfigureCommand.PowerOn) attachedsensor.GetSensor().Configure( Sensor.ConfigureCommand.RenderDataOn) num_states = localizer.NX num_ctrls = localizer.NU num_measure = len(beacons) + 2 Q = np.mat(np.diag([1e-7] * num_states)) #arg Q[arm.NX, arm.NX] = 1e-11 Q[arm.NX + 1, arm.NX + 1] = 1e-11 Q[arm.NX + 2, arm.NX + 2] = 1e-11 #Q[2,2] = 1e-8 # Gets out of hand if noise in theta or phi
env = Environment() # create the environment env.SetViewer("qtcoin") # start the viewer env.Load(os.getcwd() + "/data/wam_scene.env.xml") # load a scene beacons = [Beacon(np.mat(np.array([-1.3, 0.4, 2.0])).T)] beacons.append(Beacon(np.mat(np.array([-0.0, 0.2, 1.0])).T)) # beacons = [Beacon(np.mat(np.array([0.0, 2.0, 2.0])).T)] s = SuperRaveEnv(rave_env=env, beacons=beacons) s.draw() robot = env.GetRobots()[0] # get the first robot arm = BarretWAM(robot, env) arm.attach_sensor(BeaconSensor3D(decay_coeff=25), lambda x: arm.traj_pos(x)) s.add_robot(arm) num_states = arm.NX num_ctrls = arm.NU num_measure = len(beacons) # arg/make part of robot observe Q = np.mat(np.diag([1e-7] * num_states)) # arg # Q[2,2] = 1e-8 # Gets out of hand if noise in theta or phi R = np.mat(np.diag([1e-5] * num_measure)) # arg # R[3,3] = 5e-7 T = 20 x0 = np.array([-0.5] * arm.NX) du = np.array([0.0, 0.1, -0.02, -0.05, 0.04, 0.02, 0.1]) du = np.mat(du).T
""" env = Environment() # create the environment env.SetViewer('qtcoin') # start the viewer env.Load(os.getcwd() + '/data/wam_scene.env.xml') # load a scene beacons = [Beacon(np.mat(np.array([-1.3, 0.4, 2.0])).T)] beacons.append(Beacon(np.mat(np.array([-0.0, 0.2, 1.0])).T)) #beacons = [Beacon(np.mat(np.array([0.0, 2.0, 2.0])).T)] s = SuperRaveEnv(rave_env=env, beacons=beacons) s.draw() robot = env.GetRobots()[0] # get the first robot arm = BarretWAM(robot, env) arm.attach_sensor(BeaconSensor3D(decay_coeff=25), lambda x: arm.traj_pos(x)) s.add_robot(arm) num_states = arm.NX num_ctrls = arm.NU num_measure = len(beacons) #arg/make part of robot observe Q = np.mat(np.diag([1e-7] * num_states)) #arg #Q[2,2] = 1e-8 # Gets out of hand if noise in theta or phi R = np.mat(np.diag([1e-5] * num_measure)) #arg #R[3,3] = 5e-7 T = 20 x0 = np.array([-0.5] * arm.NX) du = np.array([0.0, 0.1, -0.02, -0.05, 0.04, 0.02, 0.1]) du = np.mat(du).T