Comments (13)
Hello! This is actually something I'm putting together right now. It should land in the next couple of days, with similar feature coverage to our MuJoCo converter. I'll add a comment here when it's ready for action.
from brax.
Alright, we've just uploaded a VERY rudimentary URDF loader. Feel free to ping this thread with further feature requests.
We don't yet support objs, but I suspect we'll eventually get around to adding mesh colliders, which will make it a bit easier.
from brax.
Will this include obj-support?
from brax.
@cdfreeman-google i tested the urdf_converter.py and it doesnt work with my urdf, because my config of a joint had another ordering. I put into https://github.com/google/brax/blob/main/brax/tools/urdf.py in the line 127 this code and then it worked with my urdf file.
for j in joint:
if j.tag == "child":
child = j.get('link')
print(f"child-name >{child}<")
if j.tag == "parent":
parent = j.get('link')
print(f"parent-name >{parent}<")
#parent = joint[0].get('link')
#child = joint[1].get('link')
hint for beginners:
Inside brax/tools you can run
python3 urdf_converter.py --help
And converting a urdf.xml file to brax config use:
python3 urdf_converter.py --xml_model_path=/home/ros2/Documents/myRobot.urdf.xml --config_path=/home/ros2/Documents/myRobot.txt
thanks for that tool
from brax.
i found out that it does not add capsule etc. to colliders{} . So i changed line 171 in https://github.com/google/brax/blob/main/brax/tools/urdf.py to
#colliders = self.links[node].findall('collision')
colliders = self.links[node]
from brax.
i got it, it uses the geometry inside the collision elements, my problem was i only got visual elements in my urdf file.
So to add "something" to see in brax, you need to specify collision with geometry elements inside your urdf.
from brax.
Ah yes, we don't have a difference between visuals and colliders, where urdf lets you set each separately. To be safe, I parsed the collider element because that's what matters most for simulation fidelity.
from brax.
Quick question -- is it possible to provide a state/velocity in minimal coordinates (aka joint angles and velocities)?
Also any idea why after importing a URDF the default position/velocity seems to be NaNs? Some code below:
# import URDF
URDF_FILE_DATA = files.upload()
brax_urdf_obj = urdf.UrdfConverter(list(URDF_FILE_DATA.values())[0], add_collision_pairs=False)
# set up CONFIG
_CONFIG = brax_urdf_obj.config
_CONFIG.bodies[0].frozen.all = True # fixed base
_CONFIG.gravity.z = -9.8 # set gravity
_CONFIG.collide_include.add() # ignore collisions
# set simulation config params
_CONFIG.dt = 0.1
_CONFIG.substeps: 10
# construct a system
sys = brax.System(_CONFIG)
qp = sys.default_qp() # THIS PRODUCES NaNs
# simulate
qp, _ = sys.step(qp, []) # GET A DIVIDE BY ZERO ERROR
from brax.
is it possible to provide a state/velocity in minimal coordinates (aka joint angles and velocities)?
Yes, you can use default angles in the config file. For example:
defaults {
qps {
name: "chassis"
pos {
x: 0, z: 2.5
}
}
}
defaults {
angles {
name: "RL_lower_leg_2_upper_leg_joint"
angle: { x: -35 }
}
angles {
name: "RR_lower_leg_2_upper_leg_joint"
angle: { x: -35 }
}
angles {
name: "FL_lower_leg_2_upper_leg_joint"
angle: { x: -35 }
}
angles {
name: "FR_lower_leg_2_upper_leg_joint"
angle: { x: -35 }
}
}
from brax.
Hi, is obj import functioning now? Regards
from brax.
Hi, was experimenting with the URDF converter. When converting box shapes for the collisions, the URDF format seems to specify the full dimensions of the box (http://wiki.ros.org/urdf/XML/link), while the brax config uses halfsize for the box shapes. I added a /2 to line 99 of the code as follows to fix this and tested that it comes up correctly rather than the original code for the converter:
return config_pb2.Collider(
box=config_pb2.Collider.Box(halfsize=_vec(size/2)),
rotation=_vec(euler.quat2euler(rot, 'rxyz'), scale=180 / np.pi),
position=_vec(pos))
from brax.
@limbryan great catch! Should be fixed in the next push we make.
from brax.
Since we have basic URDF conversion in Brax, closing for now. If there are specific features missing, please create a new issue (and attach zipped urdf file etc).
from brax.
Related Issues (20)
- Training Quadruped needs to be more stable HOT 1
- Apply external force to the agent HOT 2
- Discrepancy in Observation Dimension for Humanoid Environment HOT 2
- How do I load a pre-trained model? HOT 1
- Inconsistency in solved return for Humanoid environment HOT 1
- Manually Set Initial Pose of Agent in the Reset Function HOT 1
- Mesh-Mesh Collision Problems HOT 1
- gradient on trajectory vs sum of gradients on 1 step transitions. HOT 1
- Reacher Task and AutoResetWrapper HOT 1
- Programatic Action Specifications HOT 1
- Subsume part of System inside State; EDIT: Or add Options to reset HOT 11
- MjxEnv no where to be found HOT 2
- Broken links on Github's brax's main page HOT 2
- [MJX] Model loading errors in `brax.io`, for features supported by MJX HOT 1
- Rendering an image with brax.io.image HOT 6
- Dump to json fails if mj model contains no meshes HOT 2
- Collision of robot with solid object HOT 1
- How to access parameter values for each time-step with callback function policy_param? HOT 1
- Different behavior from gym.Mujoco: the walker body penetrate the ground HOT 1
- ValueError: vmap got inconsistent sizes for array axes to be mapped 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 brax.