-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d9460c
commit 4940f11
Showing
7 changed files
with
116 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
@setup_workload begin | ||
mechanisms = [ | ||
:ant, | ||
:atlas, | ||
:block, | ||
:block2d, | ||
:cartpole, | ||
:dzhanibekov, | ||
:exoskeleton, | ||
:fourbar, | ||
:halfcheetah, | ||
:hopper, | ||
:humanoid, | ||
:npendulum, | ||
:nslider, | ||
:panda, | ||
:pendulum, | ||
:quadrotor, | ||
:quadruped, | ||
:raiberthopper, | ||
:slider, | ||
:snake, | ||
:sphere, | ||
:tippetop, | ||
:twister, | ||
:uuv, | ||
:walker, | ||
:youbot, | ||
] | ||
|
||
environments = [ | ||
:ant_ars, | ||
:cartpole_dqn, | ||
:pendulum, | ||
:quadruped_waypoint, | ||
:quadruped_sampling, | ||
:quadrotor_waypoint, | ||
:uuv_waypoint, | ||
:youbot_waypoint, | ||
] | ||
|
||
@compile_workload begin | ||
# Simulate all mechanisms | ||
for name in mechanisms | ||
mech = get_mechanism(name) | ||
initialize!(mech, name) | ||
simulate!(mech, mech.timestep * 2) | ||
end | ||
|
||
# Simulate all environments | ||
for name in environments | ||
env = get_environment(name; horizon=2) | ||
x = get_state(env) | ||
u = DojoEnvironments.input_map(env, nothing) | ||
set_input!(env, nothing) | ||
step!(env, x) | ||
step!(env, x, u) | ||
simulate!(env) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
@setup_workload begin | ||
@compile_workload begin | ||
# One full simulation | ||
origin = Origin() | ||
body = Cylinder(0.1, 1, 1) | ||
joint = JointConstraint(Revolute(origin, body, [1;0;0]; child_vertex=[0;0;1/2])) | ||
mechanism = Mechanism(origin, [body], [joint]) | ||
controller!(mechanism, k) = set_input!(joint, [0]) | ||
set_minimal_coordinates!(mechanism, joint, [pi/4]) | ||
set_minimal_velocities!(mechanism, joint, [0.2]) | ||
storage = simulate!(mechanism, mechanism.timestep * 2, controller!, record=true) | ||
|
||
# Common shapes | ||
mesh = Mesh("", 1, rand(3,3)) | ||
box = Box(1,1,1,1.0) | ||
capsule = Capsule(1,1,1.0) | ||
cylinder = Cylinder(1, 1, 1.0) | ||
sphere = Sphere(1,1.0) | ||
pyramid = Pyramid(1,1,1.0) | ||
|
||
# Common joints | ||
joint_axis = [1;0;0] | ||
JointConstraint(Floating(origin, mesh)) | ||
JointConstraint(Fixed(origin, box)) | ||
JointConstraint(Prismatic(origin, capsule, joint_axis)) | ||
JointConstraint(Planar(origin, cylinder, joint_axis)) | ||
JointConstraint(FixedOrientation(origin, sphere)) | ||
JointConstraint(Revolute(origin, pyramid, joint_axis)) | ||
JointConstraint(Cylindrical(origin, mesh, joint_axis)) | ||
JointConstraint(PlanarAxis(origin, box, joint_axis)) | ||
JointConstraint(FreeRevolute(origin, capsule, joint_axis)) | ||
JointConstraint(Orbital(origin, cylinder, joint_axis)) | ||
JointConstraint(PrismaticOrbital(origin, sphere, joint_axis)) | ||
JointConstraint(PlanarOrbital(origin, pyramid, joint_axis)) | ||
JointConstraint(FreeOrbital(origin, mesh, joint_axis)) | ||
JointConstraint(Spherical(origin, box)) | ||
JointConstraint(CylindricalFree(origin, capsule, joint_axis)) | ||
JointConstraint(PlanarFree(origin, cylinder, joint_axis)) | ||
end | ||
end |