Skip to content

Commit eefa372

Browse files
committed
Switch from Rotations.kl to Quaternions.jl
1 parent 12c8330 commit eefa372

File tree

62 files changed

+411
-351
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+411
-351
lines changed

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Meshing = "e6723b4c-ebff-59f1-b4b7-d97aa5274f73"
1818
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
1919
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
2020
Polyhedra = "67491407-f73d-577b-9b50-8179a7c68029"
21+
Quaternions = "94ee1d12-ae83-5a48-8b1c-48b8ff168ae0"
2122
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
2223
Rotations = "6038ab10-8711-5258-84ad-4b1120ba62dc"
2324
Scratch = "6c6a2e73-6563-6170-7368-637461726353"
@@ -39,7 +40,7 @@ MeshCat = "<0.14.0, 0.14.0"
3940
Meshing = "<0.5.7, 0.5.7"
4041
Parameters = "<0.12.0, 0.12.0"
4142
Polyhedra = "<0.7.1, 0.7.1"
42-
Rotations = "1.1"
43+
Quaternions = "<0.5.3, 0.5.3"
4344
Scratch = "1.1"
4445
StaticArrays = "1.2"
4546
julia = "1.6, 1.7"

environments/box/methods/initialize.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ end
6060

6161
function initialize_box!(mechanism::Mechanism{T};
6262
x=[0.0, 0.0, 1.0],
63-
q=UnitQuaternion(1.0, 0.0, 0.0, 0.0),
63+
q=Quaternion(1.0, 0.0, 0.0, 0.0),
6464
v=[1.0, 0.3, 0.2],
6565
ω=[2.5, -1.0, 2.0]) where T
6666

environments/box2D/methods/initialize.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function initialize_box2D!(mechanism::Mechanism{T};
7474

7575
set_maximal_configurations!(body,
7676
x=[0.0; position] + [0.0, 0.0 , z],
77-
q=UnitQuaternion(RotX(orientation)))
77+
q=Quaternion(RotX(orientation)))
7878
set_maximal_velocities!(body,
7979
v=[0.0; linear_velocity],
8080
ω=[angular_velocity, 0.0, 0.0])

environments/cartpole/methods/env.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ function ghost(env::Environment{Cartpole}, z_sol;
158158
for (i, xt) in enumerate(z_sol)
159159
z_pendulum = xt[13 .+ (1:13)]
160160
x = z_pendulum[1:3]
161-
q = UnitQuaternion(z_pendulum[6 .+ (1:4)]...)
161+
q = Quaternion(z_pendulum[6 .+ (1:4)]...)
162162
k = x + vector_rotate([0.0; 0.0; -0.5], q)
163163

164164
push!(points, Point(k[1], k[2], k[3]))

environments/cartpole/methods/initialize.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function get_cartpole(;
1717
# Links
1818
origin = Origin{Float64}()
1919
slider = Capsule(1.5 * radius, slider_length, slider_mass,
20-
axis_offset=UnitQuaternion(RotX(0.5 * π)),
20+
axis_offset=Quaternion(RotX(0.5 * π)),
2121
color=RGBA(0.7, 0.7, 0.7, 1.0))
2222
pendulum = Capsule(radius, pendulum_length, pendulum_mass,
2323
color=RGBA(0.7, 0.7, 0.7, 1.0))
@@ -56,14 +56,14 @@ function initialize_cartpole!(mech::Mechanism{T,Nn,Ne,Nb};
5656
if mode == :down
5757
set_maximal_configurations!(mech.bodies[1], mech.bodies[2],
5858
Δx=[0.0; 0.0; -0.5 * pendulum_length],
59-
Δq=UnitQuaternion(RotX(π)))
59+
Δq=Quaternion(RotX(π)))
6060
set_maximal_velocities!(mech.bodies[2],
6161
v=zeros(3),
6262
ω=zeros(3))
6363
elseif mode == :up
6464
set_maximal_configurations!(mech.bodies[1], mech.bodies[2],
6565
Δx=[0.0; 0.0; 0.5 * pendulum_length],
66-
Δq=UnitQuaternion(RotX(π)))
66+
Δq=Quaternion(RotX(π)))
6767
set_maximal_velocities!(mech.bodies[2],
6868
v=zeros(3),
6969
ω=zeros(3))

environments/dzhanibekov/methods/initialize.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function get_dzhanibekov(;
1111
main_body = Capsule(radius, body_length, body_mass,
1212
color=color, name=:main)
1313
side_body = Capsule(0.5 * radius, 0.35 * body_length, 0.5 * body_mass,
14-
axis_offset=UnitQuaternion(RotY(0.5 * π)),
14+
axis_offset=Quaternion(RotY(0.5 * π)),
1515
color=color, name=:side)
1616
links = [main_body, side_body]
1717

environments/humanoid/methods/initialize.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ function get_humanoid(;
2525

2626
aa = -0.43000 * [-0.44721, 0.00000, 0.89442]
2727
ql = axis_angle_to_quaternion(aa)
28-
qll = ql * UnitQuaternion(RotXYZ(roll=-1.57080, pitch=1.47585, yaw=-1.47585)) # roll pitch yaw
29-
qlr = ql * UnitQuaternion(RotXYZ(roll=+1.57080, pitch=1.47585, yaw=+1.47585)) # roll pitch yaw
28+
qll = ql * Quaternion(RotXYZ(roll=-1.57080, pitch=1.47585, yaw=-1.47585)) # roll pitch yaw
29+
qlr = ql * Quaternion(RotXYZ(roll=+1.57080, pitch=1.47585, yaw=+1.47585)) # roll pitch yaw
3030

3131
pfll = vector_rotate([ 0.5 * left_foot.shape.shape[1].rh[2] + 0.03500; -0.03; 0.0], qll)
3232
pbll = vector_rotate([-0.5 * left_foot.shape.shape[1].rh[2] + 0.03500; -0.03; 0.0], qll)

environments/orbital/methods/initialize.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function initialize_orbital!(mechanism::Mechanism{T};
5555
# set position and velocities
5656
set_maximal_configurations!(mechanism.origin, pbody,
5757
child_vertex=vert11,
58-
Δq=UnitQuaternion(RotX(0.0)))
58+
Δq=Quaternion(RotX(0.0)))
5959

6060
set_minimal_coordinates!(mechanism, mechanism.joints[2], orientation)
6161

environments/pendulum/methods/initialize.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function get_pendulum(;
66
spring=0.0,
77
damper=0.0,
88
spring_offset=szeros(1),
9-
axis_offset=one(UnitQuaternion),
9+
axis_offset=one(Quaternion),
1010
T=Float64)
1111

1212
# Parameters
@@ -106,7 +106,7 @@ function initialize_npendulum!(mechanism::Mechanism{T};
106106
# set position and velocities
107107
set_maximal_configurations!(mechanism.origin, pbody,
108108
child_vertex=vert11,
109-
Δq=UnitQuaternion(RotX(base_angle)))
109+
Δq=Quaternion(RotX(base_angle)))
110110
set_maximal_velocities!(pbody,
111111
ω=base_angular_velocity)
112112

environments/raiberthopper/methods/initialize.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ function initialize_raiberthopper!(mech::Mechanism{T,Nn,Ne,Nb};
9191
# body to foot
9292
set_maximal_configurations!(pbody, cbody,
9393
Δx=[0.0; 0.0; -leg_length],
94-
Δq=UnitQuaternion(RotX(0.0)))
94+
Δq=Quaternion(RotX(0.0)))
9595
set_maximal_velocities!(pbody, cbody,
9696
parent_vertex=tra2.vertices[1],
9797
child_vertex=tra2.vertices[2],

0 commit comments

Comments
 (0)