1414import org .mujoco .MuJoCoLib .mjData_ ;
1515import org .mujoco .MuJoCoLib .mjModel ;
1616import org .mujoco .MuJoCoLib .mjModel_ ;
17+ import org .mujoco .MuJoCoLib .mjOption_ ;
1718import org .mujoco .MuJoCoLib .mjVFS ;
1819import org .mujoco .MuJoCoModelManager ;
1920
2021public class MuJoColibTest {
2122 @ Test
2223 public void managerTest () throws InterruptedException {
24+ System .out .println ("managerTest" );
2325 String filename = "model/humanoid/humanoid.xml" ;
2426 File file = new File (filename );
2527 if (!file .exists ()) {
@@ -28,18 +30,19 @@ public void managerTest() throws InterruptedException {
2830 MuJoCoModelManager m = new MuJoCoModelManager (file );
2931 mjModel_ model = m .getModel ();
3032 mjData_ data = m .getData ();
31- System .out .println ("Run model for 10 seconds" );
33+ System .out .println ("Run ModelManager for 10 seconds" );
3234 while (data .time () < 10 ) {
3335 m .stepOne ();
3436 //apply controls
3537 m .stepTwo ();
3638 // sleep
37- Thread .sleep (1 );
39+ Thread .sleep (m . getTimestepMilliSeconds () );
3840 }
3941 m .close ();
4042 }
4143 @ Test
4244 public void mujocoJNILoadTest () {
45+ System .out .println ("mujocoJNILoadTest" );
4346 System .out .println (System .getProperty ("org.bytedeco.javacpp.logger.debug" ));
4447 System .setProperty ("org.bytedeco.javacpp.logger.debug" , "true" );
4548 MuJoCoLib lib = new MuJoCoLib ();
@@ -70,7 +73,8 @@ public void mujocoJNILoadTest() {
7073 System .out .println ("Run model for 10 seconds" );
7174 while (accessable .time () < 10 ) {
7275 MuJoCoLib .mj_step (m , d );
73- Thread .sleep (1 );
76+ double timestep = new mjOption_ (Maccessable .opt ()).timestep ()*1000 ;
77+ Thread .sleep ((long ) timestep );
7478
7579 }
7680
0 commit comments