Expose mju resource functions to public header.
Many of these functions are useful when writing a custom decoder. PiperOrigin-RevId: 868321921 Change-Id: I7e0dd285e0559b6f486acf8cbf4376ff8d91943d
This commit is contained in:
committed by
Copybara-Service
parent
210cf86486
commit
6715a0ceaa
@@ -29,6 +29,7 @@ API function can be classified as:
|
||||
- :ref:`Printing<Printing>` of various quantities.
|
||||
- :ref:`Virtual file system<Virtualfilesystem>`, used to load assets from memory.
|
||||
- :ref:`Asset cache<Assetcache>`, used to speed up model compilation.
|
||||
- :ref:`Resources<Resources>`, interfacing with resource providers to load assets.
|
||||
- :ref:`Initialization<Initialization>` of data structures.
|
||||
- :ref:`Error and memory<Errorandmemory>`.
|
||||
- :ref:`Miscellaneous<Miscellaneous>` functions.
|
||||
|
||||
@@ -1551,6 +1551,77 @@ Get the internal asset cache used by the compiler.
|
||||
|
||||
Clear the asset cache.
|
||||
|
||||
.. _Resources:
|
||||
|
||||
Resources
|
||||
^^^^^^^^^
|
||||
|
||||
Resources are the interface between :ref:`resource providers <exProvider>` and MuJoCo model compilation code.
|
||||
These functions provide the means to query the resource provider and obtain resources.
|
||||
.. _mju_openResource:
|
||||
|
||||
`mju_openResource <#mju_openResource>`__
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. mujoco-include:: mju_openResource
|
||||
|
||||
Open a resource; if the name doesn't have a prefix matching a registered resource provider,
|
||||
then the OS filesystem is used.
|
||||
|
||||
*Nullable:* ``dir``, ``vfs``, ``error``
|
||||
|
||||
.. _mju_closeResource:
|
||||
|
||||
`mju_closeResource <#mju_closeResource>`__
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. mujoco-include:: mju_closeResource
|
||||
|
||||
Close a resource; no-op if resource is NULL.
|
||||
|
||||
.. _mju_readResource:
|
||||
|
||||
`mju_readResource <#mju_readResource>`__
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. mujoco-include:: mju_readResource
|
||||
|
||||
Set buffer to bytes read from the resource and return number of bytes in buffer;
|
||||
return negative value if error.
|
||||
|
||||
.. _mju_getResourceDir:
|
||||
|
||||
`mju_getResourceDir <#mju_getResourceDir>`__
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. mujoco-include:: mju_getResourceDir
|
||||
|
||||
For a resource with a name partitioned as {dir}{filename}, get the dir and ndir pointers.
|
||||
|
||||
.. _mju_isModifiedResource:
|
||||
|
||||
`mju_isModifiedResource <#mju_isModifiedResource>`__
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. mujoco-include:: mju_isModifiedResource
|
||||
|
||||
Compare resource timestamp to provided timestamp.
|
||||
|
||||
Return 0 if timestamps match, >0 if resource is newer, <0 if resource is older.
|
||||
|
||||
.. _mju_decodeResource:
|
||||
|
||||
`mju_decodeResource <#mju_decodeResource>`__
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. mujoco-include:: mju_decodeResource
|
||||
|
||||
Find the decoder for a resource and return the decoded spec.
|
||||
|
||||
The caller takes ownership of the spec and is responsible for cleaning it up.
|
||||
|
||||
*Nullable:* ``vfs``
|
||||
|
||||
.. _Initialization:
|
||||
|
||||
Initialization
|
||||
|
||||
@@ -816,3 +816,8 @@ Note that derivatives depend only on :math:`h` and :math:`v` (in fact, on :math:
|
||||
All outputs are optional.
|
||||
|
||||
*Nullable:* ``Dquat``, ``Dvel``, ``Dscale``
|
||||
|
||||
.. _Resources:
|
||||
|
||||
Resources are the interface between :ref:`resource providers <exProvider>` and MuJoCo model compilation code.
|
||||
These functions provide the means to query the resource provider and obtain resources.
|
||||
|
||||
Reference in New Issue
Block a user