Changing the coordinates of a model and saving as xml file

Discussion in 'Simulation' started by Gokce Guven, Nov 27, 2018.

  1. Hi,
    I am totally new to c++. I solve my problem by reading and implementing the tutorials until I stuck at mj_saveLastXML function. I even tried to change XML by hand but I am not sure whether it is save to change the parameters by hand or not. I want to get a squat position humanoid xml file for my starting point of reinforcement learning schema. I was able to change the joint angles, but I could not use mj_saveLastXML function. I compile my cpp file with no error but I could neither create an xml file, nor could write to an existing empty xml file. I changed the coordinates via mujoco forum :

    int id_right_knee = mj_name2id(m, mjOBJ_JOINT, "right_knee");

    and then tried to save the new xml model with:
    mj_saveLastXML("filename.xml", m, error, 1000);
    Could you help me regarding this issue?

    Thanks in advance
    Last edited: Nov 27, 2018
  2. Ok, I solved this issue somehow. I did not know why i could not in the first place but I solved it. Thanks, have a nice day
  3. Hi, I thought that I solved my problem, mj_saveLastXML function worked and produced a xml file but, that was not what I wanted to produce. I want to change the starting position, angle of the joints in humanoid file, I will also change the size of the geometries later. I have 10 realistic subjects (humans), and I would like to create xml file for each subject. I tried to change the xml file directly, but I could not clearly understand body, joint position values, and other xml values with their relationship to each other so I started to change the values via mujoco API. Here, I could change the joint angles but I could not save the squat position xml for one subject. How should I do it? From previous talk, I saw that mju_copy is suggested as a solution but I did not understand how and where to use mju_copy, and save my xml after that. Also how should I select my keyframenumber if I have to use mju_copy?
    Thanks in advance :)