Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added goal_distance_data.npy
Binary file not shown.
18 changes: 18 additions & 0 deletions goal_distance_data.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
2.031290700207774233e-02
1.765916347503662109e+00
2.040656628445848553e-02
3.924012184143066406e+00
2.002831476383618720e-02
6.620127439498901367e+00
2.016944935839263750e-02
8.746846914291381836e+00
2.003081774458192674e-02
1.085422492027282715e+01
2.016879848002731471e-02
1.257592725753784180e+01
2.003082672150304291e-02
1.468001270294189453e+01
2.016879701623289223e-02
1.637891817092895508e+01
2.003082675435431670e-02
1.844886445999145508e+01
Binary file added inter_robot_distance_data.npy
Binary file not shown.
5,000 changes: 5,000 additions & 0 deletions inter_robot_distance_data.txt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

# Instantiate Robotarium object
N = 5
initial_conditions = np.array(np.mat('1 0.5 -0.5 0 0.28; 0.8 -0.3 -0.75 0.1 0.34; 0 0 0 0 0'))
initial_conditions = np.array(np.asmatrix('1 0.5 -0.5 0 0.28; 0.8 -0.3 -0.75 0.1 0.34; 0 0 0 0 0'))
r = robotarium.Robotarium(number_of_robots=N, show_figure=True, initial_conditions=initial_conditions,sim_in_real_time=True)

# The robots will never reach their goal points so set iteration number
iterations = 3000

# Define goal points outside of the arena
goal_points = np.array(np.mat('5 -5 5 -5 5; 5 5 -5 -5 5; 0 0 0 0 0'))
goal_points = np.array(np.asmatrix('5 -5 5 -5 5; 5 5 -5 -5 5; 0 0 0 0 0'))

# Create unicycle position controller
si_position_controller = create_si_position_controller()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
iterations = 3000

# Define goal points outside of the arena
goal_points = np.array(np.mat('5 5 5 5 5; 5 5 5 5 5; 0 0 0 0 0'))
goal_points = np.array(np.asmatrix('5 5 5 5 5; 5 5 5 5 5; 0 0 0 0 0'))

# Create unicycle position controller
unicycle_position_controller = create_clf_unicycle_position_controller()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
iterations = 3000

# Define goal points outside of the arena
goal_points = np.array(np.mat('5 5 5 5 5; 5 5 5 5 5; 0 0 0 0 0'))
goal_points = np.array(np.asmatrix('5 5 5 5 5; 5 5 5 5 5; 0 0 0 0 0'))

# Create unicycle position controller
unicycle_position_controller = create_clf_unicycle_position_controller()
Expand Down
2 changes: 1 addition & 1 deletion rps/examples/go_to_point/si_go_to_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# Instantiate Robotarium object
N = 5
initial_conditions = np.array(np.mat('1 0.5 -0.5 0 0.28; 0.8 -0.3 -0.75 0.1 0.34; 0 0 0 0 0'))
initial_conditions = np.array(np.asmatrix('1 0.5 -0.5 0 0.28; 0.8 -0.3 -0.75 0.1 0.34; 0 0 0 0 0'))

r = robotarium.Robotarium(number_of_robots=N, show_figure=True, initial_conditions=initial_conditions, sim_in_real_time=False)

Expand Down
2 changes: 1 addition & 1 deletion rps/examples/go_to_point/uni_go_to_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# Instantiate Robotarium object
N = 5
initial_conditions = np.array(np.mat('1 0.5 -0.5 0 0.28; 0.8 -0.3 -0.75 0.1 0.34; 0 0 0 0 0'))
initial_conditions = np.array(np.asmatrix('1 0.5 -0.5 0 0.28; 0.8 -0.3 -0.75 0.1 0.34; 0 0 0 0 0'))
r = robotarium.Robotarium(number_of_robots=N, show_figure=True, initial_conditions=initial_conditions,sim_in_real_time=True)

# Define goal points by removing orientation from poses
Expand Down
2 changes: 1 addition & 1 deletion rps/examples/go_to_pose/uni_go_to_pose_clf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# Instantiate Robotarium object
N = 5
initial_conditions = np.array(np.mat('1 0.5 -0.5 0 0.28; 0.8 -0.3 -0.75 0.1 0.34; 0 0 0 0 0'))
initial_conditions = np.array(np.asmatrix('1 0.5 -0.5 0 0.28; 0.8 -0.3 -0.75 0.1 0.34; 0 0 0 0 0'))
r = robotarium.Robotarium(number_of_robots=N, show_figure=True, initial_conditions=initial_conditions,sim_in_real_time=True)

# Define goal points by removing orientation from poses
Expand Down
2 changes: 1 addition & 1 deletion rps/examples/go_to_pose/uni_go_to_pose_hybrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# Instantiate Robotarium object
N = 5
initial_conditions = np.array(np.mat('1 0.5 -0.5 0 0.28; 0.8 -0.3 -0.75 0.1 0.34; 0 0 0 0 0'))
initial_conditions = np.array(np.asmatrix('1 0.5 -0.5 0 0.28; 0.8 -0.3 -0.75 0.1 0.34; 0 0 0 0 0'))
r = robotarium.Robotarium(number_of_robots=N, show_figure=True, initial_conditions=initial_conditions,sim_in_real_time=True)

# Define goal points by removing orientation from poses
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# Instantiate Robotarium object
N = 5
initial_conditions = np.array(np.mat('1 0.5 -0.5 0 0.28; 0.8 -0.3 -0.75 0.1 0.34; 0 0 0 0 0'))
initial_conditions = np.array(np.asmatrix('1 0.5 -0.5 0 0.28; 0.8 -0.3 -0.75 0.1 0.34; 0 0 0 0 0'))
r = robotarium.Robotarium(number_of_robots=N, show_figure=True, initial_conditions=initial_conditions,sim_in_real_time=True)

# Define goal points by removing orientation from poses
Expand Down
20 changes: 10 additions & 10 deletions rps/utilities/barrier_certificates.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,17 +410,17 @@ def create_unicycle_differential_drive_barrier_certificate(max_num_obstacle_poin
projection_distance =0.05, barrier_gain = 150, safety_radius = 0.17):


D = np.matrix([[wheel_radius/2, wheel_radius/2], [-wheel_radius/base_length, wheel_radius/base_length]])
L = np.matrix([[1,0],[0,projection_distance]])* D
disturb = np.matrix([[-disturbance, -disturbance, disturbance, disturbance],[-disturbance, disturbance, disturbance, -disturbance]])
D = np.asmatrixrix([[wheel_radius/2, wheel_radius/2], [-wheel_radius/base_length, wheel_radius/base_length]])
L = np.asmatrixrix([[1,0],[0,projection_distance]])* D
disturb = np.asmatrixrix([[-disturbance, -disturbance, disturbance, disturbance],[-disturbance, disturbance, disturbance, -disturbance]])
num_disturbs = np.size(disturb[1,:])

max_num_constraints = (max_num_robots**2-max_num_robots)//2 + max_num_robots*max_num_obstacle_points
A = np.matrix(np.zeros([max_num_constraints, 2*max_num_robots]))
b = np.matrix(np.zeros([max_num_constraints, 1]))
Os = np.matrix(np.zeros([2,max_num_robots]))
ps = np.matrix(np.zeros([2,max_num_robots]))
Ms = np.matrix(np.zeros([2,2*max_num_robots]))
A = np.asmatrixrix(np.zeros([max_num_constraints, 2*max_num_robots]))
b = np.asmatrixrix(np.zeros([max_num_constraints, 1]))
Os = np.asmatrixrix(np.zeros([2,max_num_robots]))
ps = np.asmatrixrix(np.zeros([2,max_num_robots]))
Ms = np.asmatrixrix(np.zeros([2,2*max_num_robots]))

def robust_barriers(dxu, x, obstacles=np.empty(0)):

Expand Down Expand Up @@ -464,7 +464,7 @@ def robust_barriers(dxu, x, obstacles=np.empty(0)):
diffs = ps[:,i] - ps[:, i+1:num_robots]
hs = np.sum(np.square(diffs),0) - safety_radius**2 # 1 by N
h_dot_is = 2*diffs.T*MDs[:,(2*i, 2*i+1)] # N by 2
h_dot_js = np.matrix(np.zeros((2,num_robots - (i+1))))
h_dot_js = np.asmatrixrix(np.zeros((2,num_robots - (i+1))))
h_dot_js[0, :] = -np.sum(2*np.multiply(diffs, MDs[:,2*(i+1):2*num_robots:2]), 0)
h_dot_js[1, :] = -np.sum(2*np.multiply(diffs, MDs[:,2*(i+1)+1:2*num_robots:2]), 0)
new_constraints = num_robots - i - 1
Expand Down Expand Up @@ -496,7 +496,7 @@ def robust_barriers(dxu, x, obstacles=np.empty(0)):
# Solve QP program generated earlier
L_all = np.kron(np.eye(num_robots), L)
dxu = np.linalg.inv(D)*dxu # Convert user input to differential drive
vhat = np.matrix(np.reshape(dxu ,(2*num_robots,1), order='F'))
vhat = np.asmatrixrix(np.reshape(dxu ,(2*num_robots,1), order='F'))
H = 2*L_all.T*L_all
f = np.transpose(-2*np.transpose(vhat)*np.transpose(L_all)*L_all)

Expand Down
20 changes: 10 additions & 10 deletions rps/utilities/barrier_certificates2.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@

def create_robust_barriers(max_num_obstacles = 100, max_num_robots = 30, d = 5, wheel_vel_limit = 12.5, base_length = 0.105, wheel_radius = 0.016,
projection_distance =0.05, gamma = 150, safety_radius = 0.12): # gamma was 150
D = np.matrix([[wheel_radius/2, wheel_radius/2], [-wheel_radius/base_length, wheel_radius/base_length]])
L = np.matrix([[1,0],[0,projection_distance]])* D
disturb = np.matrix([[-d, -d, d, d],[-d, d, d, -d]])
D = np.asmatrixrix([[wheel_radius/2, wheel_radius/2], [-wheel_radius/base_length, wheel_radius/base_length]])
L = np.asmatrixrix([[1,0],[0,projection_distance]])* D
disturb = np.asmatrixrix([[-d, -d, d, d],[-d, d, d, -d]])
num_disturbs = np.size(disturb[1,:])

#TODO: Take out 4*max_num_robots?
max_num_constraints = (max_num_robots**2-max_num_robots)//2 + max_num_robots*max_num_obstacles + 4*max_num_robots
A = np.matrix(np.zeros([max_num_constraints, 2*max_num_robots]))
b = np.matrix(np.zeros([max_num_constraints, 1]))
Os = np.matrix(np.zeros([2,max_num_robots]))
ps = np.matrix(np.zeros([2,max_num_robots]))
Ms = np.matrix(np.zeros([2,2*max_num_robots]))
A = np.asmatrixrix(np.zeros([max_num_constraints, 2*max_num_robots]))
b = np.asmatrixrix(np.zeros([max_num_constraints, 1]))
Os = np.asmatrixrix(np.zeros([2,max_num_robots]))
ps = np.asmatrixrix(np.zeros([2,max_num_robots]))
Ms = np.asmatrixrix(np.zeros([2,2*max_num_robots]))

def robust_barriers(dxu, x, obstacles):

Expand Down Expand Up @@ -68,7 +68,7 @@ def robust_barriers(dxu, x, obstacles):
diffs = ps[:,i] - ps[:, i+1:num_robots]
hs = np.sum(np.square(diffs),0) - safety_radius**2 # 1 by N
h_dot_is = 2*diffs.T*MDs[:,2*i:2*i+2] # N by 2
h_dot_js = np.matrix(np.zeros((2,num_robots - (i+1))))
h_dot_js = np.asmatrixrix(np.zeros((2,num_robots - (i+1))))
h_dot_js[0, :] = -np.sum(2*np.multiply(diffs, MDs[:,2*(i+1):2*num_robots:2]), 0)
h_dot_js[1, :] = -np.sum(2*np.multiply(diffs, MDs[:,2*(i+1)+1:2*num_robots:2]), 0)
new_constraints = num_robots - i - 1
Expand Down Expand Up @@ -100,7 +100,7 @@ def robust_barriers(dxu, x, obstacles):
# Solve QP program generated earlier
L_all = np.kron(np.eye(num_robots), L)
dxu = np.linalg.inv(D)*dxu # Convert user input to differential drive
vhat = np.matrix(np.reshape(dxu ,(2*num_robots,1), order='F'))
vhat = np.asmatrixrix(np.reshape(dxu ,(2*num_robots,1), order='F'))
H = 2*L_all.T*L_all
f = np.transpose(-2*np.transpose(vhat)*np.transpose(L_all)*L_all)

Expand Down