Skip to content

Commit d72135e

Browse files
authored
Merge pull request #10 from dojo-sim/compat_for_1_7
Compat for Julia 1.7 and switch from Rotations.jl to Quaternions.jl
2 parents efab5f2 + 8ef741e commit d72135e

Some content is hidden

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

71 files changed

+421
-376
lines changed

Project.toml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,28 @@ 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"
22-
Rotations = "6038ab10-8711-5258-84ad-4b1120ba62dc"
2323
Scratch = "6c6a2e73-6563-6170-7368-637461726353"
2424
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
2525
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
2626
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
2727
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2828

2929
[compat]
30-
Colors = "<0.12.6, 0.12.6"
31-
DocStringExtensions = "<0.8.3, 0.8.3"
30+
Colors = "<0.12.8, 0.12.8"
31+
DocStringExtensions = "<0.8.6, 0.8.6"
3232
FFMPEG = "0.4.1"
33-
GeometryBasics = "0.3"
34-
JLD2 = "0.4.21"
35-
LaTeXStrings = "1.3.0"
36-
LightGraphs = "1.3.5"
33+
GeometryBasics = "<0.4.0, 0.4.0"
34+
JLD2 = "<0.4.22, 0.4.22"
35+
LaTeXStrings = "1.3"
36+
LightGraphs = "1.3"
3737
LightXML = "<0.9.0, 0.9.0"
38-
MeshCat = "0.14"
39-
Meshing = "0.5.7"
40-
Parameters = "0.12"
41-
Polyhedra = "0.6.18"
42-
Rotations = "1.0.2 - 1.0.2"
38+
MeshCat = "<0.14.0, 0.14.0"
39+
Meshing = "<0.5.7, 0.5.7"
40+
Parameters = "<0.12.0, 0.12.0"
41+
Polyhedra = "<0.7.1, 0.7.1"
42+
Quaternions = "<0.5.3, 0.5.3"
4343
Scratch = "1.1"
44-
StaticArrays = "1.4"
45-
julia = "1.6"
44+
StaticArrays = "1.2"
45+
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=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=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=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=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=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 * RotX(-1.57080)*RotY(1.47585)*RotZ(-1.47585) # Quaternion(RotXYZ(roll=-1.57080, pitch=1.47585, yaw=-1.47585)) # roll pitch yaw
29+
qlr = ql * RotX(+1.57080)*RotY(1.47585)*RotZ(+1.47585) # 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=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=RotX(base_angle))
110110
set_maximal_velocities!(pbody,
111111
ω=base_angular_velocity)
112112

environments/raiberthopper/methods/env.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ function visualize(env::Environment{RaibertHopper}, traj::Vector{Vector{T}};
142142
name=name)
143143
step = range(0.0, stop=norm(dir), length=n_leg)
144144
for i = 1:n_leg
145-
MeshCat.settransform!(env.vis["leg$i"], MeshCat.compose(MeshCat.Translation(step[i] .* dir_norm + x_foot), MeshCat.LinearMap(Rotations.RotY(0.0))))
145+
MeshCat.settransform!(env.vis["leg$i"], MeshCat.compose(MeshCat.Translation(step[i] .* dir_norm + x_foot), MeshCat.LinearMap(Dojo.RotY(0.0))))
146146
end
147147
end
148148
end

0 commit comments

Comments
 (0)