Newer
Older
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
################## static forces ##########################
function floorEnabled()
return false
end
function gravityEnabled()
return false
end
function staticSimulation()
return true
end
function externalForce(currentTimeStep,N_position,N_force)
return N_force
end
function externalDisplacement(currentTimeStep,N_position,N_fixedDisplacement)
return N_fixedDisplacement
end
function updateTemperature(currentRestLength,currentTimeStep,mat)
return currentRestLength
end
# ################## snake forces ##########################
# function floorEnabled()
# return setup["floorEnabled"]
# end
# function gravityEnabled()
# return setup["gravityEnabled"]
# end
# function staticSimulation()
# return setup["staticSimulation"]
# end
# function externalForce(currentTimeStep,N_position,N_force)
# # a0=1.0;
# # l=1.0 ;
# # f=2.0;
# # amp=0.5;
# # x=convert(Float64,N_position.z)/(75.0*15.0);
# # x=1.0;
# # t=currentTimeStep/10000.0;
# # ax=1.0-0.825*(x-1.0)+1.0625*(x*x-1.0);
# # z= a0* ax *CUDAnative.sin(2.0*3.14159265359*(x/l-f*t+amp));
# # totalForce =totalForce +Vector3(z,0.0,0.0);
# a0=100.0;
# l=1.0 ;
# f=10.0;
# amp=0.25;
# x=convert(Float64,N_position.z)/(75.0*15.0);
# # x=1.0;
# max=10000.0;
# m1= (mod(convert(Float64,currentTimeStep) ÷ (max/f),2.0) ==0.0)
# m2= (mod(convert(Float64,currentTimeStep) ÷ (max/f),2.0) !=0.0)
# t=currentTimeStep/max;
# ax=1.0-0.825*(x-1.0)+1.0625*(x*x-1.0);
# z= a0* ax *CUDAnative.sin(2.0*3.14159265359*(x/l-f*t+amp))
# z1= z* m1;
# z2= z* -m2;
# return Vector3(z1+z2,0.0,0.0)
# end
# ##################rover forces##########################
# function floorEnabled()
# return true
# end
# function gravityEnabled()
# return true
# end
# function staticSimulation()
# return false
# end
# function externalForce(currentTimeStep,N_position,N_force)
# if(convert(Float64,N_force.z)>0.0)
# pi=3.14159265359
# Bx=convert(Float64,N_position.x)
# By=convert(Float64,N_position.y)
# voxelSize=5.0*15.0
# d=0.000000001 #magnitude
# Ax= ( Bx ÷ voxelSize)*voxelSize
# Ay= ( By ÷ voxelSize)*voxelSize
# # Ay=0.0
# x=Bx+d*(Ay-By)/CUDAnative.sqrt((Ax-Bx)*(Ax-Bx)+(Ay-By)*(Ay-By))
# y=By-d*(Ax-Bx)/CUDAnative.sqrt((Ax-Bx)*(Ax-Bx)+(Ay-By)*(Ay-By))
# a0=100.0;
# l=1.0 ;
# f=5.0;
# amp=0.25;
# amp=0.0;
# max=10000.0;
# t=currentTimeStep/max;
# z= a0* CUDAnative.cos(2.0*3.14159265359*(f*t+amp))
# amp=0.25;
# y= a0* CUDAnative.sin(2.0*3.14159265359*(f*t+amp))
# if(convert(Float64,N_force.z)>1.5)
# z=-z
# y=-y
# end
# return Vector3(0.0,y,z)
# else
# return Vector3(0.0,0.0,0.0)
# end
# end
# ##################tendon forces##########################
# function floorEnabled()
# return false
# end
# function gravityEnabled()
# return false
# end
# function staticSimulation()
# return true
# end
# function externalForce(currentTimeStep,N_position,N_force)
# return Vector3(0.0,0.0,0.0);
# # if(convert(Float64,N_force.z)>1.0)
# # pi=3.14159265359
# # Bx=convert(Float64,N_position.x)
# # By=convert(Float64,N_position.y)
# # voxelSize=5.0*15.0
# # d=0.000000001 #magnitude
# # Ax= ( Bx ÷ voxelSize)*voxelSize
# # Ay= ( By ÷ voxelSize)*voxelSize
# # # Ay=0.0
# # x=Bx+d*(Ay-By)/CUDAnative.sqrt((Ax-Bx)*(Ax-Bx)+(Ay-By)*(Ay-By))
# # y=By-d*(Ax-Bx)/CUDAnative.sqrt((Ax-Bx)*(Ax-Bx)+(Ay-By)*(Ay-By))
# # a0=100.0;
# # l=1.0 ;
# # f=5.0;
# # amp=0.25;
# # amp=0.0;
# # max=10000.0;
# # t=currentTimeStep/max;
# # z= a0* CUDAnative.cos(2.0*3.14159265359*(f*t+amp))
# # amp=0.25;
# # y= a0* CUDAnative.sin(2.0*3.14159265359*(f*t+amp))
# # if(convert(Float64,N_force.z)>1.5)
# # z=-z
# # y=-y
# # end
# # return Vector3(0.0,y,z)
# # else
# # return N_force
# # end
# end
# function externalForce(currentTimeStep,N_position,N_force)
# return N_force
# end
#######################non linear test#############
# function externalForce(currentTimeStep,N_position,N_force)
# if (currentTimeStep>20&¤tTimeStep<=400)
# return N_force
# else
# return Vector3(0.0,0.0,0.0)
# end
# end
#######################thermal expansion#############
# function updateTemperature(currentRestLength,currentTimeStep,mat)
# if currentTimeStep<1000
# temp=-5.0*currentTimeStep/1000
# # currentRestLength=mat.L*(1.0+temp*mat.cTE)
# currentRestLength=0.5*mat.L*(2.0+temp*mat.cTE)
# # @cuprintln("currentRestLength $currentRestLength")
# # @cuprintln("mat.cTE $(mat.cTE)")
# elseif currentTimeStep==2500
# temp=0
# currentRestLength=0.5*mat.L*(2.0+temp*mat.cTE)
# # @cuprintln("currentRestLength $currentRestLength")
# end
# return currentRestLength
# end