You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/components.jl
+10-6Lines changed: 10 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -234,9 +234,8 @@ Representing a body with 3 translational and 3 rotational degrees-of-freedom.
234
234
phid0 =zeros(3),
235
235
r_0 =0,
236
236
v_0 =0,
237
-
radius =0.05,
238
-
v_0 =0,
239
237
w_a =0,
238
+
radius =0.05,
240
239
air_resistance =0.0,
241
240
color = [1,0,0,1],
242
241
quat=false,)
@@ -416,7 +415,7 @@ There are three different methods of adding damping to the rope:
416
415
- Damping in flexing of the rope, modeled as viscous friction in the joints between the links, controlled by the parameter `d_joint`.
417
416
- Air resistance to the rope moving through the air, controlled by the parameter `air_resistance`. This damping is quadratic in the velocity (``f_d ~ -||v||v``) of each link relative to the world frame.
418
417
"""
419
-
functionRope(; name, l =1, dir = [0,-1, 0], n =10, m =1, c =0, d=0, air_resistance=0, d_joint =0, color = [255, 219, 120, 255]./255, radius =0.05f0, kwargs...)
418
+
functionRope(; name, l =1, dir = [0,-1, 0], n =10, m =1, c =0, d=0, air_resistance=0, d_joint =0, cutspherical =false, cutprismatic=false, color = [255, 219, 120, 255]./255, radius =0.05f0, kwargs...)
420
419
421
420
@assert n >=1
422
421
systems =@namedbegin
@@ -428,8 +427,13 @@ function Rope(; name, l = 1, dir = [0,-1, 0], n = 10, m = 1, c = 0, d=0, air_res
428
427
li = l / n # Segment length
429
428
mi = m / n # Segment mass
430
429
431
-
# joints = [Spherical(name=Symbol("joint_$i"), isroot=!(iscut && i == 1), iscut = iscut && i == 1, state=true, d = d_joint) for i = 1:n+1]
432
-
joints = [Spherical(; name=Symbol("joint_$i"), isroot=true, state=true, d = d_joint, radius=0, color) for i =1:n+1]
430
+
joints = [Spherical(name=Symbol("joint_$i"),
431
+
# isroot=!(cutspherical && i == 1),
432
+
isroot=true,
433
+
iscut = cutspherical && i ==1,
434
+
# state=!(cutspherical && i == 1),
435
+
state=true,
436
+
d = d_joint) for i =1:n+1]
433
437
434
438
eqs = [
435
439
connect(frame_a, joints[1].frame_a)
@@ -443,7 +447,7 @@ function Rope(; name, l = 1, dir = [0,-1, 0], n = 10, m = 1, c = 0, d=0, air_res
443
447
springs = [Translational.Spring(c = ci, s_rel0=li, name=Symbol("link_$i")) for i =1:n]
444
448
dampers = [Translational.Damper(d = di, name=Symbol("damping_$i")) for i =1:n]
445
449
masses = [Body(; m = mi, name=Symbol("mass_$i"), isroot=false, r_cm = li/2*dir, air_resistance, color=0.9*color) for i =1:n]
446
-
links = [Prismatic(; n = dir, s0 = li, name=Symbol("flexibility_$i"), axisflange=true, color, radius) for i =1:n]
450
+
links = [Prismatic(; n = dir, s0 = li, name=Symbol("flexibility_$i"), axisflange=true, color, radius, iscut = cutprismatic && i ==1) for i =1:n]
0 commit comments