Beacon(np.array([0.2, 0.8]))] #obstacles = [RectangularObstacle(np.array([[0.75, 0.2], [0.75, 0.4], [0.85, 0.4], [0.85,0.2]], float).T),\ # RectangularObstacle(np.array([[0.5,0.85], [1.15,0.85], [1.15,0.6], [0.5,0.6]], float).T)] obstacles=[] s = SimEnv2D(bounds=[-0.1, 1.5, -0.1, 1], beacons=beacons, obstacles=obstacles) ball = np.array([1.4, 0.30]) x0 = np.array([0, 0.5, 0, 0]) car = SimpleCar(x0) car.attach_sensor(BeaconSensor(decay_coeff=25), lambda x: x[0:2]) localizer = LocalizerBot(car,ball) x0 = np.mat(localizer.x) localizer.attach_sensor(FOVSensor(localizer.x, fov_angle=2*pi, decay_coeff=25), lambda x: localizer.fov_state(x)) s.add_robot(localizer) # Number of timesteps T = 30 #arg # Dynamics and measurement noise num_states = localizer.NX num_ctrls = localizer.NU num_measure = len(beacons)+1+1 #arg/make part of robot observe Q = np.mat(np.diag([1e-5]*num_states)) #arg Q[2,2] = 1e-8 # Gets out of hand if noise in theta or phi Q[3,3] = 1e-8 # Can also add theta/phi to measurement like Sameep #TODO? Q[4,4] = 1e-10 # Can also add theta/phi to measurement like Sameep #TODO? Q[5,5] = 1e-10 # Can also add theta/phi to measurement like Sameep #TODO?
xN = np.vstack((thetaN.T, ball.T)) xN = np.reshape(xN, (4,1)) print xN #xN = links.forward_kinematics(origin, thetaN) #xN = np.mat(xN).T links.attach_sensor(BeaconSensor(decay_coeff=15), lambda x: links.forward_kinematics(origin, x)) #links.attach_sensor(BeaconSensor(decay_coeff=25), lambda x: x[0:2]) localizer = LocalizerBot(links, ball) x0 = np.mat(localizer.x).T; w = f = 500 localizer.attach_sensor(ExtendedCamera2D(f, localizer.x, w, ks=[-0.33, 0.1]), lambda x: localizer.fov_state(x)) #localizer.attach_sensor(PinholeCamera2D(f, localizer.x, w), #lambda x: localizer.fov_state(x)) s.add_robot(localizer) T = 20 num_states = localizer.NX num_ctrls = localizer.NU num_measure = len(beacons)+1#+1 #arg/make part of robot observe Q = np.mat(np.diag([1e-5]*num_states)) #arg Q[2,2] = 1e-10 Q[3,3] = 1e-10 R = np.mat(np.diag([0.0005]*num_measure)) #arg R[1,1] = 5e-4 #R[2,2] = 1e-3
# RectangularObstacle(np.array([[0.5,0.85], [1.15,0.85], [1.15,0.6], [0.5,0.6]], float).T)] obstacles = [] s = SimEnv2D(bounds=[-0.1, 1.5, -0.1, 1], beacons=beacons, obstacles=obstacles) ball = np.array([1.4, 0.30]) x0 = np.array([0, 0.5, 0, 0]) car = SimpleCar(x0) car.attach_sensor(BeaconSensor(decay_coeff=25), lambda x: x[0:2]) localizer = LocalizerBot(car, ball) x0 = np.mat(localizer.x) localizer.attach_sensor( FOVSensor(localizer.x, fov_angle=2 * pi, decay_coeff=25), lambda x: localizer.fov_state(x)) s.add_robot(localizer) # Number of timesteps T = 30 #arg # Dynamics and measurement noise num_states = localizer.NX num_ctrls = localizer.NU num_measure = len(beacons) + 1 + 1 #arg/make part of robot observe Q = np.mat(np.diag([1e-5] * num_states)) #arg Q[2, 2] = 1e-8 # Gets out of hand if noise in theta or phi Q[3, 3] = 1e-8 # Can also add theta/phi to measurement like Sameep #TODO? Q[4, 4] = 1e-10 # Can also add theta/phi to measurement like Sameep #TODO? Q[5, 5] = 1e-10 # Can also add theta/phi to measurement like Sameep #TODO?