コード例 #1
0
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)]
mug_pos = np.mat(np.array([0.0, 1.0, 0.8])).T
mug = env.GetKinBody('mug2')
mugTransform = mug.GetTransform()
mugTransform[0, 3] = mug_pos[0]
mugTransform[1, 3] = mug_pos[1]
mugTransform[2, 3] = mug_pos[2]
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():
コード例 #2
0

"""
def waitrobot(robot):
    while not robot.GetController().IsDone():
        time.sleep(0.01)
"""

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
コード例 #3
0
import struct
import _Getch
"""
def waitrobot(robot):
    while not robot.GetController().IsDone():
        time.sleep(0.01)
"""

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