-
Notifications
You must be signed in to change notification settings - Fork 5
/
forces.py
63 lines (43 loc) · 938 Bytes
/
forces.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import math
'''
fr = repulsive_force as function of time
fa = attractor_force as function of time
w = noise
dt = d_target
do = d_obstacle
psi = heading_direction
Psi1 = psi_target
Psi2 = psi_obstacle
Psi3 = psi_final
sb = sigma_obstacle = apparent 2r
omega_t = psi_dot_t = first time derivative
'''
pi = math.pi
exp = math.exp
atan2 = math.atan2
#psi =
#Psi1 =
#Psi2 =
#Psi3 =
#dt =
#do =
#sb =
b1 = 6
#b1 = 8
b2 = 18
#b2 = 15
##
z = pi/6
sig0 = dist[0]* atan2(30*pi/180)
sig1 = dist[1]* atan2(30*pi/180)
lamb1 = b1*exp(-(dist[0]-r0)/b2)
lamb2 = b1*exp(-(dist[1]-r0)/b2)
fr1 = -(lamb1*z*exp(-(z**2)/(sig0)**2))
fr2 = -(lamb2*z*exp(-(z**2)/(sig0)**2))
fr_final = fr1 + fr2
# Attractor Behaviors
#fr1 = -sin(psi-Psi1)
#fr3 = -exp(-dt)*sin(psi-Psi3)
#frf = fr1+fr3
# Repulsive Behaviors
#fr2 = exp(((-psi-Psi2)^2)/(2(sb^2)))*(psi-Psi2)*exp(-do/b2)