Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML Error: unknown plugin 'mujoco.elasticity.cable'. #1488

Closed
Wangzihao12ous opened this issue Mar 8, 2024 · 4 comments
Closed

XML Error: unknown plugin 'mujoco.elasticity.cable'. #1488

Wangzihao12ous opened this issue Mar 8, 2024 · 4 comments
Labels
question Request for help or information

Comments

@Wangzihao12ous
Copy link

Wangzihao12ous commented Mar 8, 2024

I used follow code to load a model:
#include "mujoco.h"
#include "stdio.h"
#include <GLFW/glfw3.h>
#include <mjplugin.h>
#include <mjvisualize.h>
#include <mjxmacro.h>
#include <mjvisualize.h>
#include <mjmodel.h>
#include <mjui.h>
#include "iostream"
char error[1000];
mjModel* m;
mjData* d;
mjvCamera cam; // abstract camera
mjvOption opt; // visualization options
mjvScene scn; // abstract scene
mjrContext con; // custom GPU context
GLFWwindow *window;

int main(void)
{
char error[1000] = "Could not load binary model";
// load model from file and check for errors
m = mj_loadXML("../xml/cable.xml", NULL, error, 1000);
if( !m )
{
printf("%s\n", error);
return 1;
}
std::cout<<mj_versionString();
// make data corresponding to model
d = mj_makeData(m);

// run simulation for 10 seconds
while( d->time<10 )
{
mj_step(m, d);
}

// free model and data
mj_deleteData(d);
mj_deleteModel(m);

return 0;
}

But erro is XML Error: unknown plugin 'mujoco.elasticity.cable'.
However if I use simluate in the bin folder,it is work,like follow:

(base) wzh@wzhhh:~/mujoko/mujoco-3.1.1/bin$ ./simulate ../../mjcdemo/xml/trynew.xml
MuJoCo version 3.1.1
Plugins registered by library 'libactuator.so':
mujoco.pid
Plugins registered by library 'libsensor.so':
mujoco.sensor.touch_grid
Plugins registered by library 'libsdf.so':
mujoco.sdf.bolt
mujoco.sdf.bowl
mujoco.sdf.gear
mujoco.sdf.nut
mujoco.sdf.torus
mujoco.sdf.sdflib
Plugins registered by library 'libelasticity.so':
mujoco.elasticity.cable
mujoco.elasticity.membrane
mujoco.elasticity.shell
mujoco.elasticity.solid

@Wangzihao12ous Wangzihao12ous added the question Request for help or information label Mar 8, 2024
@Wangzihao12ous Wangzihao12ous changed the title XML Error: Could not open file '../xml/scene.xml' XML Error: Could not open file '../xml/cable.xml' Mar 9, 2024
@Wangzihao12ous Wangzihao12ous changed the title XML Error: Could not open file '../xml/cable.xml' XML Error: unknown plugin 'mujoco.elasticity.cable'. Mar 9, 2024
@Balint-H
Copy link
Collaborator

You have to load a plugin before it can be recognized by the xml loader. Simulate does this as well. See docs, and how its used in Simulate.

@traversaro
Copy link
Contributor

For a bit more of context on why plugins are not loaded by default in C++, differently from Python: #554 .

@Wangzihao12ous
Copy link
Author

You have to load a plugin before it can be recognized by the xml loader. Simulate does this as well. See docs, and how its used in Simulate.

Thank you very much! It works!

@Wangzihao12ous
Copy link
Author

For a bit more of context on why plugins are not loaded by default in C++, differently from Python: #554 .

Thank you very much!

@quagla quagla closed this as completed Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Request for help or information
Projects
None yet
Development

No branches or pull requests

4 participants