Skip to content

Commit ab4d9e4

Browse files
dbellicoso-bdaiexploy-bot
authored andcommitted
Exporter tutorial (#72)
# Pull Request ### What change is being made Add tutorial for exporter and update docs. ### Why this change is being made Documentation. ### Tested N/A GitOrigin-RevId: f8793fb8b3b01aa464feddf88c9247b3b722be44
1 parent 23b49d9 commit ab4d9e4

27 files changed

Lines changed: 1426 additions & 249 deletions

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ Authors: Dario Bellicoso, Annika Wollschläger
7171
pixi run -e controller test
7272
```
7373

74+
### Tutorials
75+
76+
- [**Exporter Tutorial**](docs/tutorial/exporter/exporter_tutorial.md) — Step-by-step guide to
77+
exporting an RL environment and policy to a self-contained ONNX file using `exploy.exporter.core`.
78+
7479
### Usage Examples
7580

7681
#### Exporting a Policy from IsaacLab
@@ -86,7 +91,10 @@ import exploy.exporter.core as exporter
8691
from exploy.exporter.frameworks.isaaclab.env import IsaacLabExportableEnvironment
8792

8893
# Create an environment.
89-
env = . . .
94+
env = ...
95+
96+
# Create an actor.
97+
actor = ...
9098

9199
# Create an exportable environment from a ManagerBasedRLEnv
92100
exportable_env = IsaacLabExportableEnvironment(env)
@@ -104,7 +112,7 @@ exporter.export_environment_as_onnx(
104112
session_wrapper = exporter.SessionWrapper(
105113
onnx_folder=onnx_export_dir,
106114
onnx_file_name=onnx_export_file,
107-
policy=policy,
115+
actor=actor,
108116
optimize=True,
109117
)
110118

docs/_static/custom.css

Lines changed: 90 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,95 @@
11
/* Copyright (c) 2026 Robotics and AI Institute LLC dba RAI Institute. All rights reserved. */
22

3-
/* Increase the maximum width of the content area */
4-
.wy-nav-content {
5-
max-width: 1200px !important;
3+
/* ── Layout ── */
4+
:root {
5+
--content-width: 1200px;
66
}
77

8-
/* Alternative: Use percentage-based width for more flexibility */
9-
/* Uncomment to use this instead:
10-
.wy-nav-content {
11-
max-width: 90% !important;
8+
/* ── API name colors (override default red) ── */
9+
body[data-theme="light"],
10+
body:not([data-theme="dark"]) {
11+
--color-api-name: #2962ff;
12+
--color-api-pre-name: #2962ff;
13+
}
14+
15+
body[data-theme="dark"] {
16+
--color-api-name: #82b1ff;
17+
--color-api-pre-name: #82b1ff;
18+
}
19+
20+
/* ── Typography ── */
21+
body {
22+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
23+
"Helvetica Neue", Arial, sans-serif;
24+
-webkit-font-smoothing: antialiased;
25+
-moz-osx-font-smoothing: grayscale;
26+
}
27+
28+
/* ── Headings ── */
29+
h1,
30+
h2,
31+
h3,
32+
h4,
33+
h5,
34+
h6 {
35+
font-weight: 600;
36+
letter-spacing: -0.01em;
37+
}
38+
39+
/* ── Code blocks ── */
40+
pre {
41+
border-radius: 8px !important;
42+
font-size: 0.85em;
43+
}
44+
45+
code.literal {
46+
border-radius: 4px;
47+
padding: 0.15em 0.4em;
48+
font-size: 0.875em;
49+
}
50+
51+
/* ── API signatures ── */
52+
dl.py dt,
53+
dl.cpp dt {
54+
border-radius: 6px;
55+
padding: 0.5em 0.75em;
56+
font-size: 0.9em;
57+
}
58+
59+
/* ── Parameter lists ── */
60+
dl.field-list>dt {
61+
font-weight: 600;
62+
font-size: 0.9em;
63+
margin-top: 0.75em;
64+
}
65+
66+
dl.field-list>dd {
67+
margin-left: 1em;
68+
margin-bottom: 0.5em;
69+
}
70+
71+
/* ── Admonitions ── */
72+
.admonition {
73+
border-radius: 8px;
74+
}
75+
76+
/* ── Tables ── */
77+
table.docutils {
78+
border-radius: 6px;
79+
overflow: hidden;
80+
}
81+
82+
table.docutils th {
83+
font-weight: 600;
84+
}
85+
86+
/* ── Sidebar ── */
87+
.sidebar-brand-text {
88+
font-weight: 700;
89+
letter-spacing: -0.02em;
90+
}
91+
92+
/* ── Smooth transitions ── */
93+
a {
94+
transition: color 0.15s ease;
1295
}
13-
*/

docs/_static/logo-dark.svg

Lines changed: 18 additions & 0 deletions
Loading

docs/_static/logo-light.svg

Lines changed: 18 additions & 0 deletions
Loading

docs/api/core/core.rst

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
Core Exporter Functionality
2+
===========================
3+
This section contains detailed API documentation for the core exporter functionality of exploy.
4+
5+
6+
7+
Actor
8+
-----
9+
10+
Abstract interface and utilities for exportable actors.
11+
12+
This module defines the ``ExportableActor`` base class for policy networks that can be
13+
exported to ONNX, along with helpers like ``make_exportable_actor`` and ``add_actor_memory``.
14+
15+
.. automodule:: exploy.exporter.core.actor
16+
:members:
17+
:undoc-members:
18+
:show-inheritance:
19+
20+
21+
Exportable Environment
22+
----------------------
23+
24+
Abstract base class for exportable environments.
25+
26+
This module defines the ``ExportableEnvironment`` base class that provides
27+
the standardized interface required by the exporter to trace observation
28+
computation, action processing, and simulation stepping.
29+
30+
.. automodule:: exploy.exporter.core.exportable_environment
31+
:members:
32+
:undoc-members:
33+
:show-inheritance:
34+
35+
36+
Components
37+
----------
38+
39+
Core building blocks for environment export.
40+
41+
This module defines the component abstractions (``Input``, ``Output``, ``Memory``, ``Group``, ``Connection``)
42+
used to structure and manage data flow during policy export.
43+
44+
.. automodule:: exploy.exporter.core.components
45+
:members:
46+
:undoc-members:
47+
:show-inheritance:
48+
49+
50+
Context Manager
51+
---------------
52+
53+
Manages components for environment export.
54+
55+
The ``ContextManager`` class organizes and manages all inputs, outputs, memory components,
56+
and connections needed during the ONNX export process.
57+
58+
.. automodule:: exploy.exporter.core.context_manager
59+
:members:
60+
:undoc-members:
61+
:show-inheritance:
62+
63+
64+
Evaluator
65+
---------
66+
67+
Validation and testing utilities for exported ONNX models.
68+
69+
This module provides the ``evaluate`` function to compare ONNX model outputs
70+
against the original environment and PyTorch policy for correctness verification.
71+
72+
.. automodule:: exploy.exporter.core.evaluator
73+
:members:
74+
:undoc-members:
75+
:show-inheritance:
76+
77+
78+
Exporter Module
79+
---------------
80+
81+
Core ONNX export functionality for RL policies.
82+
83+
This module provides the main entry point for exporting trained policies to ONNX format,
84+
including the ``export_environment_as_onnx`` function and the ``OnnxEnvironmentExporter`` class.
85+
86+
.. automodule:: exploy.exporter.core.exporter
87+
:members:
88+
:undoc-members:
89+
:show-inheritance:
90+
91+
92+
Session Wrapper
93+
---------------
94+
95+
ONNX Runtime inference session management.
96+
97+
The ``SessionWrapper`` class provides a convenient interface for loading and running
98+
ONNX models with ONNX Runtime, managing input/output handling and session configuration.
99+
100+
.. automodule:: exploy.exporter.core.session_wrapper
101+
:members:
102+
:undoc-members:
103+
:show-inheritance:
104+
105+
106+
Tensor Proxy
107+
------------
108+
109+
Tensor list abstraction for improved ONNX export.
110+
111+
The ``TensorProxy`` class manages lists of tensors and exposes them as a single stacked tensor,
112+
improving the structure of exported computational graphs.
113+
114+
.. automodule:: exploy.exporter.core.tensor_proxy
115+
:members:
116+
:undoc-members:
117+
:show-inheritance:

docs/api/cpp/index.rst

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,17 @@ Input and output components for data flow management.
8080
Data Types
8181
----------
8282

83-
Core data structures used throughout the controller.
83+
Core data structures and type aliases used throughout the controller.
8484

85-
.. doxygenstruct:: exploy::control::Position
86-
:members:
85+
.. doxygentypedef:: exploy::control::Position
8786

88-
.. doxygenstruct:: exploy::control::Quaternion
89-
:members:
87+
.. doxygentypedef:: exploy::control::Quaternion
9088

91-
.. doxygenstruct:: exploy::control::LinearVelocity
92-
:members:
89+
.. doxygentypedef:: exploy::control::LinearVelocity
9390

94-
.. doxygenstruct:: exploy::control::AngularVelocity
95-
:members:
91+
.. doxygentypedef:: exploy::control::AngularVelocity
9692

97-
.. doxygenstruct:: exploy::control::SE2Velocity
98-
:members:
93+
.. doxygentypedef:: exploy::control::SE2Velocity
9994

10095
.. doxygenstruct:: exploy::control::SE3Pose
10196
:members:
@@ -120,22 +115,22 @@ Metadata
120115

121116
Metadata structures for component configuration.
122117

123-
.. doxygenstruct:: exploy::control::JointMetadata
118+
.. doxygenstruct:: exploy::control::metadata::JointMetadata
124119
:members:
125120

126-
.. doxygenstruct:: exploy::control::JointOutputMetadata
121+
.. doxygenstruct:: exploy::control::metadata::JointOutputMetadata
127122
:members:
128123

129-
.. doxygenstruct:: exploy::control::SE2VelocityCommandMetadata
124+
.. doxygenstruct:: exploy::control::metadata::SE2VelocityCommandMetadata
130125
:members:
131126

132-
.. doxygenstruct:: exploy::control::HeightScanMetadata
127+
.. doxygenstruct:: exploy::control::metadata::HeightScanMetadata
133128
:members:
134129

135-
.. doxygenstruct:: exploy::control::RangeImageMetadata
130+
.. doxygenstruct:: exploy::control::metadata::RangeImageMetadata
136131
:members:
137132

138-
.. doxygenstruct:: exploy::control::DepthImageMetadata
133+
.. doxygenstruct:: exploy::control::metadata::DepthImageMetadata
139134
:members:
140135

141136
Matchers

docs/api/exporter/components.rst

Lines changed: 0 additions & 12 deletions
This file was deleted.

docs/api/exporter/context_manager.rst

Lines changed: 0 additions & 12 deletions
This file was deleted.

docs/api/exporter/evaluator.rst

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)