Giter Site home page Giter Site logo

Publish XML schema for MJCF about mujoco HOT 10 OPEN

deepmind avatar deepmind commented on September 17, 2024 5
Publish XML schema for MJCF

from mujoco.

Comments (10)

yuvaltassa avatar yuvaltassa commented on September 17, 2024 2

Would i be able to modify a body thats in the scene? Like switch a body from fixed to loose? Could I change the friction in joints simulating damage?

Yes you can do all of that; anything you want really. If you want a preview, take a look at the (currently private) C API in user_api.h and the corresponding tests. Note that the parser has already been rewritten to use this. WIP, quite a bit of missing functionality.

Per your question in #1511 I do have a preference for xsd.

Can you articulate more precisely why you prefer XSD to RNG? (not counting "I had an XSD starting point and this is what I already have working" 🙂)

I have put some time in updating the existing project adding the updates from 2.x to 3.x here: https://github.com/ronansgd/xml-schema-mjcf/pull/3/files

One of the things I don't love about this is the spreading out across multiple files. Presumably this is not a hard requirement but a choice.

from mujoco.

kevinzakka avatar kevinzakka commented on September 17, 2024 1

I want to highlight the following MIT-licensed schema: https://github.com/ronansgd/xml-schema-mjcf

from mujoco.

saran-t avatar saran-t commented on September 17, 2024 1

@madhephaestus we're close to releasing a compiler API for use cases like yours that allows for incremental modification of the model without having to go through an XML.

Perhaps it would be a good idea to wait for that and see what's the best way to proceed?

from mujoco.

wookayin avatar wookayin commented on September 17, 2024

It'd be great to have the schema file published so users can benefit from completion and static validation. Dear maintainers, any plans for publishing xml schema?

from mujoco.

yuvaltassa avatar yuvaltassa commented on September 17, 2024

@wookayin yes, we have such plans. We hope to complete this by the end of the year.

Do you have opinions about your preferred schema format? Options are:

  1. XSD
  2. relaxNG
  3. relaxNG compact format
  4. Schematron.

from mujoco.

graseln avatar graseln commented on September 17, 2024

Hi, any update on the XML Schema for the MJCF for the MuJoCo 3?

from mujoco.

yuvaltassa avatar yuvaltassa commented on September 17, 2024

No update unfortunately. Might happen in 2024.
Thanks for showing interest.

from mujoco.

madhephaestus avatar madhephaestus commented on September 17, 2024

@saran-t Per your question in #1511 I do have a preference for xsd. I am writing, what I intend to be, a feature complete set of Java Bindings and have been using an existing (but out of date) set of XSD files to generate the marshaling classes and associated builders. I has worked very well! see: https://github.com/CommonWealthRobotics/mujoco-java/blob/main/src/test/java/mujoco/java/XMLtest.java

It might be worth considering adopting https://github.com/ronansgd/xml-schema-mjcf as a starting place. @ronansgd
has made an excellent start to creating a full featured set of XSD files for the MuJoCo XML format.

I have put some time in updating the existing project adding the updates from 2.x to 3.x here: https://github.com/ronansgd/xml-schema-mjcf/pull/3/files

from mujoco.

madhephaestus avatar madhephaestus commented on September 17, 2024

@saran-t I look forward to seeing that, sounds like a neat way of making dynamic systems! Would i be able to modify a body thats in the scene? Like switch a body from fixed to loose? Could I change the friction in joints simulating damage?

For my use case I need to keep all of the pointers of the actual APi hidden from the user. One bad access to a pointer and the whole jvm crashes. I need to wrap the APi for users in java safe types. This does mean coming up with a lot of the internal types after importing the API by hand. Using the XMlL and the marshaling code that is generated by the xsd files, i get builders with types that enforce the correct structure from the generated code. These types, since they just map to the xsd, are memory safe for the user at all times, so building the model is automatically generated and safe for the user out of the box. I do look forward to dynamic editing, but it would be less good for my specific use case.

from mujoco.

madhephaestus avatar madhephaestus commented on September 17, 2024

There exists tooling (in fairness, that i am familiar with, so recomendations would be lovely!) to create the Java classes to marshal and unmarshal XML directly from the XSD descriptors. The tooling also generates memory safe builders for Java users. There is a also a nice intermediate byproduct of the XML that can be used for tweaking and sharing. I have spent a good part of my spring break using my Java code to generate an XML, and the simulate tool you provide to visualize and debug the generator.

My use case is procedurally generated, 3d printable robots that can be tested in simulation with user generated terrain and obstacles. See https://github.com/CommonWealthRobotics/BowlerStudio/#bowlerstudio . The hope is for as much of the MuJoCo API to be as readily accessible, and to do that the API and the marshaling code needs to come as automatically as i can make it from an upstream ground-truth. I only have the breaks in between teaching to work on this API and maintain it, so it is imperative for me that the workflow have as much automation as possible.

If you have some recommendation for a toolchain for generating marshaling, unmarshaling and builder Java code from RNG, I would be happy to take a look. In the meantime XSD -> JAXB -> jaxb2-rich-contract-plugin->[code-gen] is my tested and known path.

One of the things I don't love about this is the spreading out across multiple files. Presumably this is not a hard requirement but a choice.

Yeah, adopting just means that you have a working starting place. you could certainly make the official repo a monolith file. I would happily retool my auto-builders if there was an officially supported version.


EDIT: Ok, i admit this argument is basically "I had an XSD starting point and this is what I already have working", but in fairness, i really do not have any idea how i would make it work with RNG, and googling it just brings up random number generator code >.<

from mujoco.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.