Skip to content

Commit 8a41225

Browse files
Test centrifugal velocity
1 parent 79b2489 commit 8a41225

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

src/Mechanical/PlanarMechanics/sensors.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -718,9 +718,6 @@ end
718718
connect(pos.frame_a, frame_a),
719719
connect(zero_pos.frame_resolve, pos.frame_resolve),
720720
connect(transform_absolute_vector.frame_a, frame_a),
721-
frame_a.fx ~ 0,
722-
frame_a.fy ~ 0,
723-
frame_a.j ~ 0,
724721
]
725722

726723
if resolve_in_frame == :frame_resolve

test/Mechanical/planar_mechanics.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ end
6565
m = 1
6666
j = 0.1
6767
ω = 10
68+
resolve_in_frame = :world
6869

6970
# components
7071
@named body = Body(; m, j, gy = 0.0)
@@ -73,13 +74,13 @@ end
7374
@named revolute = Revolute(constant_ω = ω)
7475

7576
# sensors
76-
@named abs_pos_sensor = AbsolutePosition()
77+
@named abs_v_sensor = AbsoluteVelocity(; resolve_in_frame)
7778

7879
eqs = [
7980
connect(fixed.frame, revolute.frame_a),
8081
connect(revolute.frame_b, fixed_translation.frame_a),
8182
connect(fixed_translation.frame_b, body.frame),
82-
connect_sensor(abs_pos_sensor.frame_a, body.frame)...,
83+
connect_sensor(body.frame, abs_v_sensor.frame_a)...,
8384
]
8485

8586
@named model = ODESystem(eqs,
@@ -91,7 +92,7 @@ end
9192
fixed_translation,
9293
fixed,
9394
revolute,
94-
abs_pos_sensor,
95+
abs_v_sensor,
9596
])
9697
sys = structural_simplify(model)
9798
u0 = [0.0, ω, 0.0]
@@ -103,9 +104,10 @@ end
103104
@test all(sol[body.ω] .≈ ω)
104105

105106
test_points = [i / ω for i in 0:0.1:10]
107+
106108
# instantaneous linear velocity
107109
v_singal(t) = -ω^2 * sin.(ω .* t)
108-
@test all(v_singal.(test_points) .≈ sol.(test_points; idxs = body.vx))
110+
@test all(v_singal.(test_points) .≈ sol.(test_points; idxs = abs_v_sensor.v_x.u))
109111

110112
# instantaneous linear acceleration
111113
a_singal(t) = -ω^3 * cos.(ω .* t)

0 commit comments

Comments
 (0)