-
Notifications
You must be signed in to change notification settings - Fork 6
/
documentation_instructions.html
336 lines (256 loc) · 15.3 KB
/
documentation_instructions.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta name="msapplication-config" content="/browserconfig.xml"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta charset="utf-8"/>
<link rel="apple-touch-icon" type="image/png" href="/apple-touch-icon.png"/>
<link rel="manifest" type="application/manifest+json" href="/site.webmanifest"/>
<link rel="mask-icon" type="image/svg+xml" href="/mask-icon.svg" color="#990000"/>
<link rel="shortcut icon" type="image/png" href="/favicon.png"/>
<title>Drake: Documentation Generation Instructions</title>
<meta
name="description"
content="Drake ("dragon" in Middle English) is a C++ toolbox started by the Robot
Locomotion Group at the MIT Computer Science and Artificial Intelligence
Lab (CSAIL). The development team has now grown significantly, with core
development led by the Toyota Research Institute. It is a collection of
tools for analyzing the dynamics of our robots and building control
systems for them, with a heavy emphasis on optimization-based design/
analysis.
"/>
<!--
The "Work Sans" font is licensed under the SIL Open Font License (OFL). For
more information, see:
- https://fonts.google.com/specimen/Work+Sans?preview.text_type=custom#about
- https://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL
-->
<link href="https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Work+Sans:wght@300;400;600;700;800&display=swap" rel="stylesheet"/>
<link rel="stylesheet" href="/third_party/github-styling/github-markdown.css"/>
<link rel="stylesheet" href="/third_party/dracula/syntax.css"/>
<link rel="stylesheet" href="/third_party/pylons/pylons.css"/>
<link rel="stylesheet" href="/assets/css/main.css"/>
</head>
<body>
<header class="site-header">
<div class="site-header-inner contain">
<a href="/" class="drake-logo">
<img src="/images/drake-logo-white.svg">
</a>
<div class="menu-mobile-toggle">
<span></span>
</div>
<nav class="site-menu">
<ul>
<li class="site-menu-item site-menu-item-main">
<a href="/" class="site-menu-item">Home</a>
</li>
<li class="site-menu-item site-menu-item-main">
<a href="/installation.html" class="site-menu-item">Installation</a>
</li>
<li class="site-menu-item site-menu-item-main">
<a href="/gallery.html" class="site-menu-item">Gallery</a>
</li>
<li class="site-menu-item site-menu-item-main">
API Documentation
<div class="sub">
<a href="/doxygen_cxx/index.html" class="site-menu-item">C++</a>
<a href="/pydrake/index.html" class="site-menu-item">Python</a>
</div>
</li>
<li class="site-menu-item site-menu-item-main">
Resources
<div class="sub">
<a href="/getting_help.html" class="site-menu-item">Getting Help</a>
<a href="https://deepnote.com/workspace/Drake-0b3b2c53-a7ad-441b-80f8-bf8350752305/project/Tutorials-2b4fc509-aef2-417d-a40d-6071dfed9199/%2Findex.ipynb" class="site-menu-item">Tutorials</a>
<a href="/python_bindings.html" class="site-menu-item">Python Bindings</a>
<a href="/developers.html" class="site-menu-item">For Developers</a>
<a href="/credits.html" class="site-menu-item">Credits</a>
</div>
</li>
<li class="search">
<div class="search-icon">
<!-- This is an inline SVG image of a magnifying glass. -->
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 374.9 374.84">
<path d="M235 270a148.74 148.74 0 1 1 35-35l97.74 97.74a24.37 24.37 0 0 1 0 34.58l-.4.4a24.47 24.47 0 0 1-34.58 0L235 270Zm-86.22-7.47A113.75 113.75 0 1 0 35 148.75 113.75 113.75 0 0 0 148.75 262.5Z"/>
</svg>
</div>
<div class="search-bar">
<form id="search_form" action="https://google.com/search" method="get">
<input type="text" name="q" placeholder="Search all of Drake…" />
<input type="hidden" name="q" value="site:drake.mit.edu OR site:underactuated.csail.mit.edu OR site:manipulation.csail.mit.edu" />
</form>
<div class="search-close">
<!-- This is an inline SVG image of an "X". -->
<svg height="20" width="20" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 373.61 373.57">
<path d="M219.71 186.77 366.71 40a23.43 23.43 0 1 0-33.13-33.13l-146.77 147-146.77-147A23.43 23.43 0 0 0 6.9 40l147 146.77-147 146.77a23.43 23.43 0 1 0 33.14 33.13l146.77-147 146.77 147a23.43 23.43 0 1 0 33.13-33.13Z"/>
</svg>
</div>
</div>
<ul id="results-container"></ul>
</li>
<li class="github-link">
<a href="https://github.com/RobotLocomotion/drake" class="site-menu-item">GitHub <img src="/third_party/images/GitHub-Mark-Light-64px.png" /></a>
</li>
</ul>
</nav>
</div>
</header>
<div class="page">
<div class="content">
<div class="drake-page">
<header class="drake-page-header">
<div class="contain">
<h1>Documentation Generation Instructions</h1>
</div>
</header>
<section class="padding">
<div class="contain">
<article class="markdown-body">
<p>This page contains instructions on how to locally regenerate Drake’s website.</p>
<p>The website infrastructure uses a combination of
<a href="https://jekyllrb.com/">Jekyll</a> for the
<a href="https://drake.mit.edu/">main site</a> and
<a href="https://drake.mit.edu/styleguide/cppguide.html">Style Guide</a>,
<a href="https://www.doxygen.nl/">Doxygen</a> for the
<a href="https://drake.mit.edu/doxygen_cxx/">C++ API reference</a>, and
<a href="http://www.sphinx-doc.org/en/stable/">Sphinx</a> for the
<a href="https://drake.mit.edu/pydrake/">Python API reference</a>.</p>
<h1 id="prerequisites">Prerequisites</h1>
<p>Documentation generation and preview as described in this document are
supported on Ubuntu <strong>22.04</strong> only.</p>
<p>Before getting started, install Drake’s prerequisites with the additional
<code class="language-plaintext highlighter-rouge">--with-doc-only</code> command line option, i.e.:</p>
<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">sudo </span>setup/ubuntu/install_prereqs.sh <span class="nt">--with-doc-only</span>
</code></pre></div></div>
<h1 id="previewing-changes">Previewing changes</h1>
<p>To easily preview your changes, run the <code class="language-plaintext highlighter-rouge">//doc:build --serve</code> command.</p>
<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Read the usage message.</span>
<span class="nv">$ </span>bazel run //doc:build <span class="nt">--</span> <span class="nt">--help</span>
<span class="c"># Preview the entire site, exactly how it will appear online.</span>
<span class="nv">$ </span>bazel run //doc:build <span class="nt">--</span> <span class="nt">--serve</span>
<span class="c"># Speed up the preview by only processing certain tool(s):</span>
<span class="nv">$ </span>bazel run //doc:pages <span class="nt">--</span> <span class="nt">--serve</span> <span class="c"># Only the main site.</span>
<span class="nv">$ </span>bazel run //doc/doxygen_cxx:build <span class="nt">--</span> <span class="nt">--serve</span> <span class="c"># Only the C++ API reference.</span>
<span class="nv">$ </span>bazel run //doc/pydrake:build <span class="nt">--</span> <span class="nt">--serve</span> <span class="c"># Only the Python API reference.</span>
<span class="nv">$ </span>bazel run //doc/styleguide:build <span class="nt">--</span> <span class="nt">--serve</span> <span class="c"># Only the Style Guide.</span>
<span class="c"># Further speed up preview generating only some API modules, e.g., math:</span>
<span class="nv">$ </span>bazel run //doc/doxygen_cxx:build <span class="nt">--</span> <span class="nt">--serve</span> drake.math <span class="c"># C++ math API.</span>
<span class="nv">$ </span>bazel run //doc/pydrake:build <span class="nt">--</span> <span class="nt">--serve</span> pydrake.math <span class="c"># Python math API.</span>
<span class="nv">$ </span>bazel run //doc:build <span class="nt">--</span> <span class="nt">--serve</span> <span class="o">{</span>drake,pydrake<span class="o">}</span>.math <span class="c"># Both at once.</span>
<span class="c"># Further speed up preview by omitting expensive `dot` graphs (C++ API only):</span>
<span class="nv">$ </span>bazel run //doc/doxygen_cxx:build <span class="nt">--</span> <span class="nt">--serve</span> <span class="nt">--quick</span> drake.math
</code></pre></div></div>
<p>To preview using a local branch of the styleguide instead of our pinned
revision, be sure to set the
<a href="https://github.com/RobotLocomotion/drake/blob/master/tools/workspace/README.md#exploring-github_archive-changes-from-a-local-clone">local_repository_override</a>
option in <code class="language-plaintext highlighter-rouge">drake/tools/workspace/styleguide/repository.bzl</code> before running
the preview command.</p>
<h1 id="testing-locally">Testing locally</h1>
<p>The website is not part of Drake’s default local build nor tests, because it
requires heavy prerequisites to be installed (see <code class="language-plaintext highlighter-rouge">--with-doc-only</code> above).
Therefore, a simple <code class="language-plaintext highlighter-rouge">bazel test //...</code> will not provide any feedback about
local documentation edits.</p>
<p>To check locally that documentation changes pass all build and test rules, run:</p>
<!-- Don't use "sh" literal mode here; it mis-colors the "test" non-keyword. -->
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ bazel test //doc/... //doc:manual_tests
</code></pre></div></div>
<h1 id="testing-in-ci">Testing in CI</h1>
<p>Only the Jenkins builds whose name ends with <code class="language-plaintext highlighter-rouge">-documentation</code> will run the
documentation build steps and related tests. By default, those builds run on
the Continuous (i.e., post-merge) and Nightly schedules, not on pull requests.
If you would like to check Jenkins results on a pull request, you need to
<a href="/jenkins.html#scheduling-an-on-demand-build">schedule an on-demand build</a>
by posting a comment</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>@drake-jenkins-bot linux-jammy-unprovisioned-gcc-bazel-experimental-documentation please
</code></pre></div></div>
<h1 id="advanced-building">Advanced Building</h1>
<p>This section contains details aimed at documentation infrastructure
maintainers.</p>
<p>There are in fact five available commands:</p>
<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>bazel run //doc:build <span class="c"># Entire website (i.e., all of the below).</span>
<span class="nv">$ </span>bazel run //doc:pages <span class="c"># Main site only.</span>
<span class="nv">$ </span>bazel run //doc/doxygen_cxx:build <span class="c"># C++ API reference subdir only.</span>
<span class="nv">$ </span>bazel run //doc/pydrake:build <span class="c"># Python API reference subdir only.</span>
<span class="nv">$ </span>bazel run //doc/styleguide:build <span class="c"># Style Guide subdir only.</span>
</code></pre></div></div>
<p>The first command provides options to rebuild subsets of the website, and so
offers one-stop shopping for developers, as explained in the prior section.
The latter commands are used for focused regression testing, and might be
more convenient while modifying the documentation tooling, or to avoid
spurious Bazel dependencies.</p>
<p>Each build command can be run in either “generate” mode (writing the files into
a scratch folder) or “serve” mode (http serving for web browser preview). The
automated website deployment pipeline uses the former; most developers will use
the latter.</p>
<p>Each build command has a corresponding test defined as part of the
<code class="language-plaintext highlighter-rouge">//doc:manual_tests</code> test suite.</p>
<h1 id="custom-markup">Custom markup</h1>
<p>Drake has a few local conventions for adding markup to documentation strings.</p>
<h2 id="experimental">@experimental</h2>
<p>The <code class="language-plaintext highlighter-rouge">@experimental</code> command generates a documentation paragraph that opts-out
of the <a href="/stable.html">Stable API</a>.</p>
<h2 id="python_detail_">@python_detail_…</h2>
<p>In Drake Doxygen, we can collapse Python example code under an “accordion”, so
that it only appears when the user clicks to expand it. Use the Drake-specific
custom commands <code class="language-plaintext highlighter-rouge">@python_details_begin</code> and <code class="language-plaintext highlighter-rouge">@python_details_end</code>.
Here’s an example:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>/** Some overview.
A code example in C++:
@code{.cpp}
int foo = 123;
fmt:print("foo={}", foo);
@endcode
A code example in Python:
@python_details_begin
@code{.py}
foo = 123
print(f"foo={foo}")
@endcode
@python_details_end
See also https://fmt.dev/.
*/
</code></pre></div></div>
<h2 id="tparam_">@tparam_…</h2>
<p><code class="language-plaintext highlighter-rouge">@tparam</code> is a built-in Doxygen command to describe a template argument. In
Drake, for code templated on the “scalar type”, writing out the description of
the scalar type template in every class would be onerous boilerplate. Instead,
we have a few custom abbreviations for the common cases:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>@tparam_default_scalar
@tparam_nonsymbolic_scalar
@tparam_double_only
</code></pre></div></div>
<p>See the <a href="/doxygen_cxx/group__default__scalars.html">C++ API documentation</a>
for a full description.</p>
</article>
</div>
</section>
</div>
<footer class="site-footer padding">
<div class="contain">
<a href="/" class="drake-logo">
<img src="/images/drake-logo.svg">
</a>
<div class="footer-menu">
<ul>
<li>
<a href="/doxygen_cxx/index.html" class="site-menu-item">C++</a>
</li>
<li>
<a href="/pydrake/index.html" class="site-menu-item">Python</a>
</li>
<li class="github-link">
<a href="https://github.com/RobotLocomotion/drake" class="site-menu-item">GitHub <img src="/third_party/images/GitHub-Mark-64px.png" /></a>
</li>
</ul>
</div>
</div>
<!-- TODO(eric.cousineau): Consider placing copyright here. -->
</footer>
</div>
</div>
<script src="/assets/js/mobile.js"></script>
<!-- Search -->
<script src="/assets/js/search.js"></script>
</body>
</html>