Skip to content

Commit 4a1452e

Browse files
committed
rename variables for consistency between components
1 parent cbc6e85 commit 4a1452e

File tree

4 files changed

+47
-47
lines changed

4 files changed

+47
-47
lines changed

src/components.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,17 +182,17 @@ Fixed translation followed by a fixed rotation of `frame_b` with respect to `fra
182182
# Relationships between quantities of frame_a and frame_b
183183

184184
if isroot
185-
R_rel = planar_rotation(n, angle, 0)
186-
eqs = [ori(frame_b) ~ absolute_rotation(frame_a, R_rel);
187-
zeros(3) ~ fa + resolve1(R_rel, fb);
188-
zeros(3) ~ taua + resolve1(R_rel, taub) - cross(r,
185+
Rrel = planar_rotation(n, angle, 0)
186+
eqs = [ori(frame_b) ~ absolute_rotation(frame_a, Rrel);
187+
zeros(3) ~ fa + resolve1(Rrel, fb);
188+
zeros(3) ~ taua + resolve1(Rrel, taub) - cross(r,
189189
fa)]
190190
else
191-
R_rel_inv = planar_rotation(n, -angle, 0)
192-
eqs = [ori(frame_a) ~ absolute_rotation(frame_b, R_rel_inv);
193-
zeros(3) ~ fb + resolve1(R_rel_inv, fa);
194-
zeros(3) ~ taub + resolve1(R_rel_inv, taua) +
195-
cross(resolve1(R_rel_inv, r), fb)]
191+
Rrel_inv = planar_rotation(n, -angle, 0)
192+
eqs = [ori(frame_a) ~ absolute_rotation(frame_b, Rrel_inv);
193+
zeros(3) ~ fb + resolve1(Rrel_inv, fa);
194+
zeros(3) ~ taub + resolve1(Rrel_inv, taua) +
195+
cross(resolve1(Rrel_inv, r), fb)]
196196
end
197197
eqs = collect(eqs)
198198
append!(eqs, collect(frame_b.r_0) .~ collect(frame_a.r_0) + resolve1(frame_a, r))

src/joints.jl

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ Joint with 3 constraints that define that the origin of `frame_a` and the origin
184184
dnum = d
185185
@named begin
186186
ptf = PartialTwoFrames()
187-
R_rel = NumRotationMatrix()
188-
R_rel_inv = NumRotationMatrix()
187+
Rrel = NumRotationMatrix()
188+
Rrel_inv = NumRotationMatrix()
189189
end
190190
pars = @parameters begin
191191
radius = radius, [description = "radius of the joint in animations"]
@@ -209,14 +209,14 @@ Joint with 3 constraints that define that the origin of `frame_a` and the origin
209209
else
210210
fric = d*w_rel
211211
eqs = [-fric .~ collect(frame_a.tau)
212-
fric .~ resolve1(R_rel, collect(frame_b.tau))
212+
fric .~ resolve1(Rrel, collect(frame_b.tau))
213213
collect(frame_b.r_0) .~ collect(frame_a.r_0)]
214214
end
215215

216216
if state
217217
if quat
218-
append!(eqs, nonunit_quaternion_equations(R_rel, w_rel))
219-
# append!(eqs, collect(w_rel) .~ angularVelocity2(R_rel))
218+
append!(eqs, nonunit_quaternion_equations(Rrel, w_rel))
219+
# append!(eqs, collect(w_rel) .~ angularVelocity2(Rrel))
220220
else
221221
@variables begin
222222
(phi(t)[1:3] = phi),
@@ -227,20 +227,20 @@ Joint with 3 constraints that define that the origin of `frame_a` and the origin
227227
[state_priority = 10, description = "3 angle second derivatives"]
228228
end
229229
append!(eqs,
230-
[R_rel ~ axes_rotations(sequence, phi, phi_d)
231-
collect(w_rel) .~ angular_velocity2(R_rel)
230+
[Rrel ~ axes_rotations(sequence, phi, phi_d)
231+
collect(w_rel) .~ angular_velocity2(Rrel)
232232
collect(phi_d .~ D.(phi))
233233
collect(phi_dd .~ D.(phi_d))])
234234
end
235235
if isroot
236236
append!(eqs,
237-
[connect_orientation(ori(frame_b), absolute_rotation(frame_a, R_rel); iscut)
238-
zeros(3) .~ collect(frame_a.f) + resolve1(R_rel, frame_b.f)])
237+
[connect_orientation(ori(frame_b), absolute_rotation(frame_a, Rrel); iscut)
238+
zeros(3) .~ collect(frame_a.f) + resolve1(Rrel, frame_b.f)])
239239
else
240240
append!(eqs,
241-
[connect_orientation(R_rel_inv, inverse_rotation(R_rel); iscut)
242-
ori(frame_a) ~ absolute_rotation(frame_b, R_rel_inv)
243-
zeros(3) .~ collect(frame_b.f) + resolve2(R_rel, frame_a.f)])
241+
[connect_orientation(Rrel_inv, inverse_rotation(Rrel); iscut)
242+
ori(frame_a) ~ absolute_rotation(frame_b, Rrel_inv)
243+
zeros(3) .~ collect(frame_b.f) + resolve2(Rrel, frame_a.f)])
244244
end
245245

246246
else
@@ -727,10 +727,10 @@ The relative position vector `r_rel_a` from the origin of `frame_a` to the origi
727727
(a_rel_a(t)[1:3] = a_rel_a), [description = "= der(v_rel_a)"]
728728
end
729729

730-
@named R_rel_f = Frame()
731-
@named R_rel_inv_f = Frame()
732-
R_rel = ori(R_rel_f)
733-
R_rel_inv = ori(R_rel_inv_f)
730+
@named Rrel_f = Frame()
731+
@named Rrel_inv_f = Frame()
732+
Rrel = ori(Rrel_f)
733+
Rrel_inv = ori(Rrel_inv_f)
734734

735735
eqs = [
736736
# Cut-forces and cut-torques are zero
@@ -747,22 +747,22 @@ The relative position vector `r_rel_a` from the origin of `frame_a` to the origi
747747
if state
748748
if isroot
749749
append!(eqs,
750-
connect_orientation(ori(frame_b), absolute_rotation(frame_a, R_rel); iscut))
750+
connect_orientation(ori(frame_b), absolute_rotation(frame_a, Rrel); iscut))
751751
else
752752
append!(eqs,
753-
[R_rel_inv ~ inverse_rotation(R_rel)
754-
connect_orientation(ori(frame_a), absolute_rotation(frame_b, R_rel_inv); iscut)])
753+
[Rrel_inv ~ inverse_rotation(Rrel)
754+
connect_orientation(ori(frame_a), absolute_rotation(frame_b, Rrel_inv); iscut)])
755755
end
756756

757757
if quat
758-
append!(eqs, nonunit_quaternion_equations(R_rel, w_rel_b))
758+
append!(eqs, nonunit_quaternion_equations(Rrel, w_rel_b))
759759

760760
else
761761
append!(eqs,
762762
[phi_d .~ D.(phi)
763763
phi_dd .~ D.(phi_d)
764-
R_rel ~ axes_rotations(sequence, phi, phi_d)
765-
w_rel_b .~ angular_velocity2(R_rel)])
764+
Rrel ~ axes_rotations(sequence, phi, phi_d)
765+
w_rel_b .~ angular_velocity2(Rrel)])
766766
end
767767

768768
else
@@ -774,9 +774,9 @@ The relative position vector `r_rel_a` from the origin of `frame_a` to the origi
774774
end
775775
end
776776
if state && !isroot
777-
compose(ODESystem(eqs, t; name), frame_a, frame_b, R_rel_f, R_rel_inv_f)
777+
compose(ODESystem(eqs, t; name), frame_a, frame_b, Rrel_f, Rrel_inv_f)
778778
else
779-
compose(ODESystem(eqs, t; name), frame_a, frame_b, R_rel_f, )
779+
compose(ODESystem(eqs, t; name), frame_a, frame_b, Rrel_f, )
780780
end
781781
end
782782

@@ -819,11 +819,11 @@ If a planar loop is present, e.g., consisting of 4 revolute joints where the joi
819819
@variables n(t)[1:3]
820820

821821

822-
# @named R_rel = NumRotationMatrix()
822+
# @named Rrel = NumRotationMatrix()
823823

824824
Rrel0 = planar_rotation(n, 0, 0)
825825
varw = false
826-
@named R_rel = NumRotationMatrix(; R = Rrel0.R, w = Rrel0.w, varw)
826+
@named Rrel = NumRotationMatrix(; R = Rrel0.R, w = Rrel0.w, varw)
827827

828828
n = collect(n)
829829
ey_a = collect(ey_a)
@@ -834,14 +834,14 @@ If a planar loop is present, e.g., consisting of 4 revolute joints where the joi
834834
Rb = ori(frame_b)
835835

836836
eqs = [
837-
R_rel ~ relative_rotation(ori(frame_a), ori(frame_b))
837+
Rrel ~ relative_rotation(ori(frame_a), ori(frame_b))
838838
r_rel_a .~ resolve2(ori(frame_a), collect(frame_b.r_0 - frame_a.r_0))
839839
0 ~ (ex_a'r_rel_a)[]
840840
0 ~ (ey_a'r_rel_a)[]
841841
collect(frame_a.tau) .~ zeros(3)
842842
collect(frame_b.tau) .~ zeros(3)
843843
collect(frame_a.f) .~ vec([ex_a ey_a]*f_c)
844-
collect(frame_b.f) .~ -resolve2(R_rel, frame_a.f)
844+
collect(frame_b.f) .~ -resolve2(Rrel, frame_a.f)
845845
collect(n) .~ n0
846846
]
847847
ODESystem(eqs, t; name, systems=[frame_a, frame_b])

src/orientation.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,19 +153,19 @@ function planar_rotation(axis, phi, der_angle)
153153
end
154154

155155
"""
156-
R2 = absolute_rotation(R1, R_rel)
156+
R2 = absolute_rotation(R1, Rrel)
157157
158158
- `R1`: `Orientation` object to rotate frame 0 into frame 1
159-
- `R_rel`: `Orientation` object to rotate frame 1 into frame 2
159+
- `Rrel`: `Orientation` object to rotate frame 1 into frame 2
160160
- `R2`: `Orientation` object to rotate frame 0 into frame 2
161161
"""
162-
function absolute_rotation(R1, R_rel)
163-
# R2 = R_rel.R*R1.R
164-
# w = resolve2(R_rel, R1.w) + R_rel.w
162+
function absolute_rotation(R1, Rrel)
163+
# R2 = Rrel.R*R1.R
164+
# w = resolve2(Rrel, R1.w) + Rrel.w
165165
# RotationMatrix(R2, w)
166166
R1 isa ODESystem && (R1 = ori(R1))
167-
R_rel isa ODESystem && (R_rel = ori(R_rel))
168-
R_rel * R1
167+
Rrel isa ODESystem && (Rrel = ori(Rrel))
168+
Rrel * R1
169169
end
170170

171171
function relative_rotation(R1, R2)

src/sensors.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ function RelativeAngles(; name, sequence = [1, 2, 3])
9999
frame_b = Frame()
100100
angles = Blocks.RealOutput(nout = 3)
101101
end
102-
@named R_rel = NumRotationMatrix()
102+
@named Rrel = NumRotationMatrix()
103103
eqs = [frame_a.f .~ zeros(3) |> collect
104104
frame_a.tau .~ zeros(3) |> collect
105105
frame_b.f .~ zeros(3) |> collect
106106
frame_b.tau .~ zeros(3) |> collect
107-
R_rel ~ relative_rotation(frame_a, frame_b)
108-
angles .~ axes_rotationangles(R_rel, sequence, guessAngle1)]
107+
Rrel ~ relative_rotation(frame_a, frame_b)
108+
angles .~ axes_rotationangles(Rrel, sequence, guessAngle1)]
109109
compose(ODESystem(eqs, t; name), frame_a, frame_b, angles)
110110
end
111111

0 commit comments

Comments
 (0)