Controlling the Model

Discussion in 'Simulation' started by Delay Lama, Feb 17, 2019.

  1. Hello everyone,

    i have managed to create a model with a few joints and actuators (motor).
    An if I adjust the controls during the simulation it actually moves.

    Now I want to write a short code that control my model. But I don't know how to do it. Does anybody has a link or some example code i can use to understand the technique. I wasn't able to find an explanation and I dont 't know if there is a constraint to a language.

    Edit:
    I guess I have to write my Code in C/C++.

    I hope you can help me out.

    With best wishes
    Delay Lama
     
    Last edited: Feb 17, 2019
  2. Just use the basic.cpp sample file.

    Replace mj_step(m, d);
    with

    mj_step1(m, d);
    // do sth. with d->ctrl
    mj_step2(m, d);

    or (mandatory when using RK4) use the control callback.
     
  3. Thank you, I found the place in he file basic file. but what do I have to do afterwards.
    Where are the methods mj_step1 and mj_step2 are defined.
    How do i compile the code, and where does the result end up.
    How are the Controll (cpp) files connected to the models.
    And most important how do I tell MuJoCo wich of the cpp files to use.

    I found a tutorial where an inverted pendulum is build, but i cant get it running. " https://github.com/atabakd/MuJoCo-Tutorials " there is a problem in the make process, witch i am not sure to follow.

    Maybe i am overthinking, but I have no clear starting point to understand what is happening, and what i have to do. Maybe you can help a noob, with this. Oh and yes, i am running linux, if it is important.