Skip to content

Commit 56da34c

Browse files
committed
load model from a string
1 parent 7729736 commit 56da34c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/main/java/org/mujoco/MuJoCoModelManager.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package org.mujoco;
22

33
import java.io.File;
4+
import java.io.IOException;
5+
import java.nio.file.Files;
6+
import java.nio.file.Paths;
47
import java.util.HashMap;
58
import java.util.Set;
69

@@ -31,6 +34,13 @@ public class MuJoCoModelManager {
3134
private boolean connected = false;
3235
private HashMap<String, Double> setEfforts = new HashMap<String, Double>();
3336
private HashMap<String, Double> positions = new HashMap<String, Double>();
37+
public MuJoCoModelManager(String xml) throws IOException {
38+
//File tempFile = File.createTempFile("mujoco-", ".xml");
39+
//tempFile.deleteOnExit();
40+
File tempFile = new File("/tmp/mujocoxmlTEST.XML");
41+
Files.write( Paths.get(tempFile.getAbsolutePath()), xml.getBytes());
42+
loadFromFile(tempFile);
43+
}
3444

3545
public MuJoCoModelManager(File config) {
3646
loadFromFile(config);

0 commit comments

Comments
 (0)