1+ @setup_workload begin
2+ @compile_workload begin
3+ # One full simulation
4+ origin = Origin ()
5+ body = Cylinder (0.1 , 1 , 1 )
6+ joint = JointConstraint (Revolute (origin, body, [1 ;0 ;0 ]; child_vertex= [0 ;0 ;1 / 2 ]))
7+ mechanism = Mechanism (origin, [body], [joint])
8+ controller! (mechanism, k) = set_input! (joint, [0 ])
9+ set_minimal_coordinates! (mechanism, joint, [pi / 4 ])
10+ set_minimal_velocities! (mechanism, joint, [0.2 ])
11+ storage = simulate! (mechanism, mechanism. timestep * 2 , controller!, record= true )
12+
13+ # Common shapes
14+ mesh = Mesh (" " , 1 , rand (3 ,3 ))
15+ box = Box (1 ,1 ,1 ,1.0 )
16+ capsule = Capsule (1 ,1 ,1.0 )
17+ cylinder = Cylinder (1 , 1 , 1.0 )
18+ sphere = Sphere (1 ,1.0 )
19+ pyramid = Pyramid (1 ,1 ,1.0 )
20+
21+ # Common joints
22+ joint_axis = [1 ;0 ;0 ]
23+ JointConstraint (Floating (origin, mesh))
24+ JointConstraint (Fixed (origin, box))
25+ JointConstraint (Prismatic (origin, capsule, joint_axis))
26+ JointConstraint (Planar (origin, cylinder, joint_axis))
27+ JointConstraint (FixedOrientation (origin, sphere))
28+ JointConstraint (Revolute (origin, pyramid, joint_axis))
29+ JointConstraint (Cylindrical (origin, mesh, joint_axis))
30+ JointConstraint (PlanarAxis (origin, box, joint_axis))
31+ JointConstraint (FreeRevolute (origin, capsule, joint_axis))
32+ JointConstraint (Orbital (origin, cylinder, joint_axis))
33+ JointConstraint (PrismaticOrbital (origin, sphere, joint_axis))
34+ JointConstraint (PlanarOrbital (origin, pyramid, joint_axis))
35+ JointConstraint (FreeOrbital (origin, mesh, joint_axis))
36+ JointConstraint (Spherical (origin, box))
37+ JointConstraint (CylindricalFree (origin, capsule, joint_axis))
38+ JointConstraint (PlanarFree (origin, cylinder, joint_axis))
39+ end
40+ end
0 commit comments