Comments (6)
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:
- Define a C function of type [
mjfAct
](gainprm = "0"
) that outputs the torque for a given actuator ID. - Assign your function to MuJoCo's global function pointer to
mjcb_act_bias
- In your model, create a
<general>
actuator withgainprm = "0"
andbiastype = '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.
from mujoco.
@MotorCityCobra I think this is it https://github.com/openai/mujoco-py
and https://github.com/deepmind/dm_control
from mujoco.
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. .
from mujoco.
- 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.
from mujoco.
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.
from mujoco.
Closing with the introducing of plugins.
from mujoco.
Related Issues (20)
- Contact Model for Human Walking Simulation
- How to get the xpos of the target with free joint HOT 1
- Issue with Real-time Visualization Update in MuJoCo Python API
- Issue with Real-time Visualization Update in MuJoCo Python API HOT 1
- Jacobian computation HOT 2
- MuJoCo 3.1.4 modifies the `MjModel.nbvh` value which is not reported in changelogs HOT 2
- MJX Python Version Compatibility
- Issues with Environment Reset by Loading New XML in MuJoCo for Reinforcement Learning HOT 3
- How to get Franka Panda Robot Arm seize objects tightly HOT 1
- Instability in simulation: `Got MuJoCo Warning: Nan, Inf or huge value in QACC at DOF 0. The simulation is unstable. ` HOT 5
- Problems on loading XML for V3.1.4 HOT 7
- Cannot create window when executing simulate binary in linux:22.04 container in m1 macbook pro
- I would like to get some ideas on how to measure the force and torque between body and body. HOT 11
- Geom Mesh Transform from local .obj coords to global coords HOT 4
- [question] How to interpret site_xmat HOT 4
- A resistiv torque on joint HOT 7
- flag sensornoise attribute deprecated? HOT 1
- Best practices for fast rendering with MJX
- Unable to create an XML model of a soft-body 'flexcomp' object with an STL file? HOT 1
- Exceeding Memory Limits: Cannot Simulate a Soft-Body/flexcomp object with 36624 voxels HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mujoco.