Closed MotorCityCobra closed 11 months ago
@MotorCityCobra I think this is it https://github.com/openai/mujoco-py and https://github.com/deepmind/dm_control
Interesting. I knew about MuJoCo-py, but not the other. Still, I want the source files in C++ for MuJoCo. These both look like they’re in Python. .
You can actually already do this without needing to touch MuJoCo's source code at all. If your goal is to provide your own actuation model (e.g. by training a neural network to model real motors from logged data), the best way to proceed is by using actuator callbacks. More specifically:
mjfAct
](gainprm = "0"
) that outputs the torque for a given actuator ID.mjcb_act_bias
<general>
actuator with gainprm = "0"
and biastype = 'user'
.See here for more detail on how actuator bias, gain, and activation translate to torque.
We still commit to fully open sourcing MuJoCo next year as originally announced. There are a number of technical action items on our side that we need to complete before we can open source. In the meantime, we will continue to release new binaries under permissive license terms that tackle some of the issues that we've posted on GitHub.
I'll go ahead and change the title of this issue to reflect the technical question in your OP. If there are other specific issues that you feel require source access, please continue to reach out to us via new GitHub issues or discussions. Often, MuJoCo's existing API already offer the feature you need, and we can point you in the right direction. If that's not the case, we can work with you to see what we can do to help.
- outputs the torque for a given actuator ID.
Thank you for the reply. Very enlightening.
I haven't had a chance to get too far with the steps you laid out, and I thank you for the spoon feeding. I need it. But I might be picturing something a bit more elaborate.
I'll try to ask the pinitol question before going into excruciating detail...
Can the user controlled bias be reset to a new value at every singe time frame? Or is it timestep? That's what I need.
Does something need to be compiled after a bias value is reset?
In the docs for some of the functions you posted I'm seeing "bias for specified actuator", but I can't set a single bias for specific actuators individually for my model. The current state of every sensor and input to every motor has to set the bias at every timestep in the simulation. I want inputs from all data about the robot inputted to my trained model inside the simulation. I want this trained model to set the bias.
Can these biases be changed at every timestep? Maybe then I can work with them. But I think I might need more than bias. I want the trained model to do all the actuator predictions and the simulator to handle gravity and collisions.
I'll say it other ways just to be clear. When training on the physical robot the neural net will have an input of every sensor on the robot. Accelerometers, gyros, and encoders. Other inputs to the neural net will be the torque, or torque called for into every actuator. Final inputs will be voltage, or something to factor battery power. Other data will be inputted, but let's leave those worms canned.
The bias for every actuator will depend on the state of every sensor and the action of every motor and this will vary at every time step. What's the word? Dynamic, wholistic? In my vision no simulator estimates the next state of a limb without inputting all current actions and positions. The actuators will have specific biases but they will always be in flux because I want the simulator sending all actions and states into my trained model in order to get the output for the prediction of where that force put the limbs.
I repeated myself many times, but redundancy goes hand in hand with being precise.
The model architecture:
Inputs will be the current position and current demands made for force from actuators.
Outputs will be the positions of every limb.
@saran-t
Here's what I have so far.
Modified from the humanoid.xml sample model.
<actuator>
<motor name="abdomen_y" gear="200" joint="abdomen_y" />
<general gaintype="user" gear="100" biastype="user" joint="abdomen_z" name="abdomen_z"/>
<motor name="abdomen_x" gear="200" joint="abdomen_x" />
Create a my callback function
mjtNum my_callback(const mjModel *m, const mjData *d, int ssid)
{
return 10000;
}
Inside the main function after the window is rendered.
if (m)
{
int ssid = m->name_actuatoradr[1];
mjcb_act_bias = my_callback;
m->actuator_biasprm[1] = 2000;
I've tried changing a few things, but the model doesn't seem to be affected.
Closing with the introducing of plugins.
From the Read Me...
Why can't you just put it up now?
In case you have any thoughts I'll tell you what I want it for... My goal is to replace the torque and the output code with a neural network trained on my real life, physical robot. A neural network trained to predict the state depending on the torque and last state.
So, while I'm on the topic, any general advice how to proceed? Maybe where to begin? Like a more bite sized project before I tackle this?