Hello, I am playing with the example code which is simulate.cpp. After I mj_step, I would like to get jacobian of body with mj_jacBody(m, d, jacp, jacr, 1), and it returns Bus error: 10 code looks like in simulate.cpp in main function. render(window); mjtNum * jacp; mjtNum * jacr; mj_jacBody(m, d, jacp, jacr, 1);
Did you allocate jacp and jacr? They must point to user-supplied memory buffers of size 3*nv*sizeof(mjtNum).
Thanks for the reply! I should have allocate first. I am also comparing the CoM velocity of each links by printing out data->cvel and J_com*qdot and I found little difference between them. I get j_com from mj_jacBodyCom. Is it supposed to be?
cvel is a 6D spatial velocity vector that has somewhat unusual meaning; read Featherstone's notes on spatial algebra if you are interested. J_com*qvel is what you need.