mathworks-robotics / mujoco-simulink-blockset

Blocks for accessing MuJoCo physics engine within Simulink
Other
49 stars 6 forks source link

Unable to load file error when running mj_gettingStarted example #5

Open LoreMoretti opened 1 year ago

LoreMoretti commented 1 year ago

Thanks a lot for the library!

I have tried to run the mj_gettingStarted but I get the following error:

Error in '[mj_gettingStarted/MuJoCo Plant](matlab:open_and_hilite_hyperlink ('mj_gettingStarted/MuJoCo Plant','error'))': Failed to evaluate mask initialization commands.
Caused by:
Unable to load file

I think it is caused by:

mj_initbus('dummy.xml')

and I checked that 'dummy.xml' actually exists and it it visible to Matlab (respectively with exists()and which()commands).

If I pass to mj_initbus() the fullpath of 'dummy.xml', I get:

Simulink.Bus.createObject reported the following error when processing the field 'PerspectiveCamera' in the input structure:
''Dimensions' must be a double vector consisting of positive elements. For signals with more than 2 dimensions, the trailing dimension must not be 1.'

Any idea why?

Thanks

vmanoj1996 commented 1 year ago

Hmm. Which MATLAB version are you using? Also are you using a different version of MuJoCo? Different from the one downloaded by install.m

I will try the same at my end

LoreMoretti commented 1 year ago

I have installed your library as follows running the install.m function from the Matlab Command Window:

>> install

Download URL is:
https://github.com/deepmind/mujoco/releases/download/2.3.5/mujoco-2.3.5-linux-x86_64.tar.gz

mujoco downloaded and extracted to this path:
/home/lomoretti/Downloads/mujoco_simulink_blockset/Release_glnxa64_2022b_2.3.5/lib/glnxa64/mujoco

MuJoCo block library and examples added to MATLAB path and saved
>> mujoco_interface_setup
'mujoco_interface_setup' is not found in the current folder or on the MATLAB path, but exists in:
    /home/lomoretti/Downloads/mujoco_simulink_blockset

Change the MATLAB current folder or add its folder to the MATLAB path.

>> mujoco_interface_setup

Download URL is:
https://github.com/deepmind/mujoco/releases/download/2.3.5/mujoco-2.3.5-linux-x86_64.tar.gz

folder exists already. it will be overwritten
Warning: Directory already exists. 
> In install/downloader (line 108)
In install (line 20)
In mujoco_interface_setup (line 11) 

mujoco downloaded and extracted to this path:
/home/lomoretti/Downloads/mujoco_simulink_blockset/Release_glnxa64_2022b_2.3.5/lib/glnxa64/mujoco

MuJoCo block library and examples added to MATLAB path and saved
>> mj_gettingStarted
>> 

I am using Matlab 2022b and I am on Ubuntu 22.04.

LoreMoretti commented 1 year ago

It seems the error is raised here:

https://github.com/mathworks-robotics/mujoco-simulink-blockset/blob/9d54a4b5b4e2550432828f716934119e968455b4/src/mj_initbus_mex.cpp#L55C1-L59C10

If I remove all the cameras elements from the xml which is being loaded, the xml file gets loaded successfully by the MujocoPlant block. But when starting the simulation, right after the compilation phase, Simulink crashes.

Is this helpful for your debugging?

Thanks a lot for your help!

vmanoj1996 commented 1 year ago

Hi Lorenzo, That's helpful. Thanks for trying out. About the crash, have you tried running load_sl_glibc_patch command before opening Simulink?

I do not have a Linux PC near me currently. I will try to set one up asap and debug. The error with init bus should not really be happening. I didnot see it earlier too.

LoreMoretti commented 1 year ago

Hi Manoj,

just tried to run load_sl_glibc_patch. But same crash occurs.

Thanks for investigating!

MohammadrezaDindarloo commented 1 year ago

hi, I had a problem like this, I didn't find the solution but I handle it by migrate to matlab 2023a version. It worked for me.