Skip to content

Commit d00b603

Browse files
committed
Updates the names used to access fields of QuatRotation
1 parent 86dbb63 commit d00b603

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

src/joint_types/quaternion_floating.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ end
3434
@propagate_inbounds function set_rotation!(q::AbstractVector, jt::QuaternionFloating, rot::Rotation{3})
3535
T = eltype(rot)
3636
quat = convert(QuatRotation{T}, rot)
37-
q[1] = quat.w
38-
q[2] = quat.x
39-
q[3] = quat.y
40-
q[4] = quat.z
37+
q[1] = quat.q.s
38+
q[2] = quat.q.v1
39+
q[3] = quat.q.v2
40+
q[4] = quat.q.v3
4141
nothing
4242
end
4343

src/joint_types/quaternion_spherical.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ end
3030
@propagate_inbounds function set_rotation!(q::AbstractVector, jt::QuaternionSpherical, rot::Rotation{3})
3131
T = eltype(rot)
3232
quat = convert(QuatRotation{T}, rot)
33-
q[1] = quat.w
34-
q[2] = quat.x
35-
q[3] = quat.y
36-
q[4] = quat.z
33+
q[1] = quat.q.s
34+
q[2] = quat.q.v1
35+
q[3] = quat.q.v2
36+
q[4] = quat.q.v3
3737
nothing
3838
end
3939

src/spatial/util.jl

+7-7
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ function angular_velocity_in_body end
126126

127127
@inline function velocity_jacobian(::typeof(quaternion_derivative), q::QuatRotation)
128128
(@SMatrix [
129-
-q.x -q.y -q.z;
130-
q.w -q.z q.y;
131-
q.z q.w -q.x;
132-
-q.y q.x q.w]) / 2
129+
-q.q.v1 -q.q.v2 -q.q.v3;
130+
q.q.s -q.q.v3 q.q.v2;
131+
q.q.v3 q.q.s -q.q.v1;
132+
-q.q.v2 q.q.v1 q.q.s ]) / 2
133133
end
134134

135135
@inline function velocity_jacobian(::typeof(spquat_derivative), q::ModifiedRodriguesParam)
@@ -141,9 +141,9 @@ end
141141

142142
@inline function velocity_jacobian(::typeof(angular_velocity_in_body), q::QuatRotation)
143143
2 * @SMatrix [
144-
-q.x q.w q.z -q.y;
145-
-q.y -q.z q.w q.x;
146-
-q.z q.y -q.x q.w]
144+
-q.q.v1 q.q.s q.q.v3 -q.q.v2;
145+
-q.q.v2 -q.q.v3 q.q.s q.q.v1;
146+
-q.q.v3 q.q.v2 -q.q.v1 q.q.s ]
147147
end
148148

149149
@inline function velocity_jacobian(::typeof(angular_velocity_in_body), q::ModifiedRodriguesParam)

src/util.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ end
4444
## VectorSegment: type of a view of a vector
4545
const VectorSegment{T} = SubArray{T,1,Array{T, 1},Tuple{UnitRange{Int64}},true} # TODO: a bit too specific
4646

47-
quatnorm(quat::QuatRotation) = sqrt(quat.w^2 + quat.x^2 + quat.y^2 + quat.z^2)
47+
quatnorm(quat::QuatRotation) = sqrt(quat.q.s^2 + quat.q.v1^2 + quat.q.v2^2 + quat.q.v3^2)
4848

4949

5050
## Modification count stuff

test/test_mechanism_algorithms.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ end
906906
rot_orig = rotation(joint_type_k, q_orig)
907907
rot_prin = rotation(joint_type_k, q_prin)
908908
@test isapprox(rot_orig, rot_prin)
909-
@test rot_prin.w > 0
909+
@test rot_prin.s > 0
910910
else
911911
@test q_orig == q_prin
912912
end

0 commit comments

Comments
 (0)