Run MuJoCo Simulation Visual Studio 2017

Discussion in 'Bug Reports' started by Taha Shafa, Jul 18, 2019.

  1. Hello,

    I'm a graduate student candidate that specializes in control systems learning to use Mujoco. Here's my code to run a basic humanoid.xml file:

    Code:
    #include "mujoco.h"
    #include "stdio.h"
    
    char error[1000];
    mjModel* m;
    mjData* d;
    
    int main(void)
    {
        // activate MuJoCo Pro
        mj_activate("mjkey.txt");
    
        // load model from file and check for errors
        m = mj_loadXML("humanoid.xml", NULL, error, 1000);
        if (!m)
        {
            printf("%s\n", error);
            return 1;
        }
    
        // 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, deactivate
        mj_deleteData(d);
        mj_deleteModel(m);
        mj_deactivate();
    
        return 0;
    }
    Here's the output:

    Capture.PNG

    No video pops up. Has anyone starting with MuJoCo (I'm using Visual Studio 2017) encountered an issue like this? Any help would be greatly appreciated.
     
    Last edited: Jul 18, 2019
  2. So I've narrowed it down to being an issue with the file path being invalid or not being able to be opened by MuJoCo. When running simulate.exe, I can drag and drop the xml file, but I cannot open the xml file using the command prompt. I can, however, use the command prompt to open simulate. The issue only happens when MuJoCo tries to open the file at the location. Here's my file path:

    Capture.PNG

    Here's what happens when copy and pasting this file path into Visual Studio Command prompt:

    Capture.PNG

    Is my file path not MuJoCo friendly or something?
     

    Attached Files:

  3. Alright I figured it out. For those of you like me who are good at controls but basic in terms of knowledge when it comes to programming and troubleshooting, turns out that entering the path like that does not work, however, entering ..\ signifies the parent directory. It states that in the programming instructions on MuJoCo's website, however, I thought that ".." signified your custom path to enter, and did not assume to enter ..\ in a literal sense to run the program.