Skip to content

Commit 2eafcfe

Browse files
committed
mechanics, docs cleanup run_ci
1 parent 560d37f commit 2eafcfe

File tree

146 files changed

+751
-20146
lines changed

Some content is hidden

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

146 files changed

+751
-20146
lines changed

environments/atlas/methods/template.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ end
187187
################################################################################
188188
# Compute trajectory
189189
################################################################################
190-
# vis=visualizer()
190+
# vis= Visualizer()
191191
# open(vis)
192192

193193
# mech = get_mechanism(:atlas, timestep=0.05, model_type=:armless, damper=1000.0)

environments/rexhopper/methods/demo.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
vis=visualizer()
2+
vis= Visualizer()
33
open(vis)
44
include("env.jl")
55
include("initialize.jl")
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using PGFPlots
2+
const PGF = PGFPlots
3+
4+
color = ["magenta", "orange", "cyan"];
5+
p_energy = [PGF.Plots.Linear([j * timestep[i] for j = 1:length(e)], e .- e[1], legendentry="h=$(timestep[i])", mark="none",style="color="*color[i]*", line width=2pt, solid") for (i, e) in enumerate(me)]
6+
7+
a1 = Axis(vcat(p_energy...),
8+
xmin=0,
9+
xmax=10.0,
10+
hideAxis=false,
11+
ylabel="energy drift",
12+
xlabel="time (s)",
13+
legendPos="south east")
14+
dir = joinpath("/home/taylor/Downloads")
15+
PGF.save(joinpath(dir, "energy_drift.tikz"), a1)
16+
17+
##########
18+
# Visualization
19+
color = RGBA(255.0/255.0,0.0,255.0,1.0);
20+
z = get_maximal_state(storage)
21+
z = [[z[1] for t = 1:100]..., z..., [z[end] for t = 1:100]...]
22+
build_robot(mech, vis=vis, color=color)
23+
T = length(z)
24+
anim = MeshCat.Animation(convert(Int, floor(1.0 / timestep0)))
25+
for t = 1:T
26+
MeshCat.atframe(anim, t) do
27+
set_robot(vis, mech, z[t])
28+
end
29+
end
30+
MeshCat.setanimation!(vis, anim)
31+
setvisible!(vis["/Axes"], false)
32+
setvisible!(vis["/Grid"], false)
33+
34+
# Ghost
35+
t = 400 # 225, 150, 1
36+
set_robot(vis, mech, z[t])
37+
##########
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# PGFPlot
2+
using PGFPlotsX
3+
using LaTeXStrings
4+
5+
mj_plin_plot = @pgf PlotInc({thick, "color=orange", "mark options={orange}"}, Table(speed_mj, plin_mj))
6+
dj_plin_plot = @pgf PlotInc({thick, "color=cyan", "mark options={cyan}"}, Table(speed_dj, plin_dj))
7+
mj_pang_plot = @pgf PlotInc({thick, "color=orange", "mark options={orange}"}, Table(speed_mj, pang_mj))
8+
dj_pang_plot = @pgf PlotInc({thick, "color=cyan", "mark options={cyan}"}, Table(speed_dj, pang_dj))
9+
mj_legend = LegendEntry(raw"MuJoCo")
10+
dj_legend = LegendEntry(raw"Dojo")
11+
12+
axs1 = @pgf LogLogAxis({
13+
ymin=1e-15,
14+
ymax=1e1,
15+
title="linear momentum",
16+
xlabel=raw"$\times$ faster than real time",
17+
ylabel="N.s",
18+
},
19+
dj_plin_plot, dj_legend, mj_plin_plot, mj_legend,
20+
)
21+
22+
axs2 = @pgf LogLogAxis({
23+
ymin=1e-15,
24+
ymax=1e1,
25+
title="angular momentum",
26+
xshift=-20.0,
27+
# ticks="none",
28+
yticklabels={},
29+
xlabel=raw"$\times$ faster than real time",
30+
# ylabel="(N.s)",
31+
},
32+
dj_pang_plot, dj_legend, mj_pang_plot, mj_legend,
33+
)
34+
35+
gp = @pgf PGFPlotsX.GroupPlot(
36+
{group_style = {group_size="2 by 1"},
37+
legend_style = {nodes="{scale=0.70, transform shape}", anchor="east", at="{(0.95,0.35)}"},
38+
y_label_style={at="{(axis description cs:-0.00,.5)}", anchor="north"},
39+
# height = "6cm",
40+
# width = "6cm",
41+
# no_markers,
42+
# xlabel=raw"$\times$ faster than real time",
43+
# legend_pos="north west",
44+
},
45+
axs1, axs2)
46+
47+
filename = joinpath(@__DIR__, "figures/astronaut_momentum.tikz")
48+
pgfsave(filename, gp; include_preamble = true, dpi = 150)
49+
50+
51+
# PGFPlot
52+
using PGFPlotsX
53+
using LaTeXStrings
54+
55+
mj_ener_plot1 = @pgf PlotInc({very_thick, "color=orange", "mark options={orange}"},
56+
Table(range(0,stop=100,length=length(ener_traj_mj[1])),
57+
ener_traj_mj[1]))
58+
mj_ener_plot2 = @pgf PlotInc({very_thick, "color=orange", "mark options={orange}"},
59+
Table(range(0,stop=100,length=length(ener_traj_mj[2])),
60+
ener_traj_mj[2]))
61+
mj_ener_plot3 = @pgf PlotInc({very_thick, "color=orange", "mark options={orange}"},
62+
Table(range(0,stop=100,length=length(ener_traj_mj[3])),
63+
ener_traj_mj[3]))
64+
65+
dj_ener_plot1 = @pgf PlotInc({very_thick, "color=cyan", "mark options={orange}"},
66+
Table(range(0,stop=100,length=length(ener_traj_dj[1])),
67+
ener_traj_dj[1]))
68+
dj_ener_plot2 = @pgf PlotInc({very_thick, "color=cyan", "mark options={orange}"},
69+
Table(range(0,stop=100,length=length(ener_traj_dj[2])),
70+
ener_traj_dj[2]))
71+
dj_ener_plot3 = @pgf PlotInc({very_thick, "color=cyan", "mark options={orange}"},
72+
Table(range(0,stop=100,length=length(ener_traj_dj[3])),
73+
ener_traj_dj[3]))
74+
75+
mj_legend = LegendEntry(raw"MuJoCo")
76+
dj_legend = LegendEntry(raw"Dojo")
77+
78+
79+
axs1 = @pgf Axis({
80+
title=raw"simulation rate $10$ Hz",
81+
ylabel="energy J",
82+
xticklabels={},
83+
},
84+
dj_ener_plot1, dj_legend, mj_ener_plot1, mj_legend,
85+
)
86+
87+
axs2 = @pgf Axis({
88+
title=raw"simulation rate $100$ Hz",
89+
ylabel="energy J",
90+
yshift=13.0,
91+
xticklabels={},
92+
},
93+
dj_ener_plot2, dj_legend, mj_ener_plot2, mj_legend,
94+
)
95+
96+
axs3 = @pgf Axis({
97+
title=raw"simulation rate $1000$ Hz",
98+
xlabel="time s",
99+
ylabel="energy J",
100+
yshift=13.0,
101+
},
102+
dj_ener_plot3, dj_legend, mj_ener_plot3, mj_legend,
103+
)
104+
105+
gp = @pgf PGFPlotsX.GroupPlot(
106+
{group_style = {group_size="1 by 3"},
107+
legend_style = {nodes="{scale=0.70, transform shape}"},
108+
title_style={at="{(axis description cs:+0.5,0.95)}", anchor="south"},
109+
y_label_style={at="{(axis description cs:+0.05,0.5)}", anchor="north"},
110+
x_label_style={at="{(axis description cs:+0.5,0.15)}", anchor="north"},
111+
xmin=0,
112+
xmax=100,
113+
height = "3.5cm",
114+
width = "7.5cm",
115+
no_markers,
116+
# xlabel=raw"$\times$ faster than real time",
117+
legend_pos="north west",
118+
},
119+
axs1, axs2, axs3)
120+
121+
filename = joinpath(@__DIR__, "figures/astronaut_energy.tikz")
122+
pgfsave(filename, gp; include_preamble = true, dpi = 150)

examples/dev/2dofs_rotation.jl

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)