Skip to content

Commit 55bd11e

Browse files
committed
Update
1 parent 3d49f33 commit 55bd11e

File tree

8 files changed

+181
-145
lines changed

8 files changed

+181
-145
lines changed

assets/scss/_sidebar-tree.scss

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
color: #333333;
7474
text-decoration: none;
7575
width: 100%;
76+
padding-left: 0.5rem;
7677

7778
&:hover {
7879
color: $blue;

assets/scss/_styles_project.scss

+19-34
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ details[open] > .expand-label {
539539
border-bottom-left-radius: 4px;
540540
border-bottom-right-radius: 4px;
541541
padding: 1rem 1rem;
542-
overflow: hidden;
542+
overflow: auto;
543543
}
544544

545545
// First child is the anchor link
@@ -620,6 +620,11 @@ details summary::-webkit-details-marker {
620620

621621
/* START CSS for how-to paths */
622622

623+
.expand.howtoexpand {
624+
margin-bottom: 0.5rem;
625+
margin-top: 0.5rem;
626+
}
627+
623628
.expand.howtoexpand summary, .expand.howtoexpand .expand-content {
624629
background-color: #eaf9fb;
625630
}
@@ -1113,12 +1118,13 @@ td > ul, td > ol {
11131118

11141119
/* TAB CSS consistency START */
11151120

1116-
.nav-tabs {
1121+
.nav.nav-tabs {
11171122
border-bottom: none; // unset from inherited styles
11181123
gap: 1px;
11191124
display: flex;
11201125
flex-direction: row;
11211126
border-bottom: 1px solid #E4E4E6;
1127+
margin-left: 0rem;
11221128
}
11231129

11241130
.horizontalheaders > .nav-tabs, .horizontalheaders * .nav-tabs {
@@ -1175,6 +1181,7 @@ td > ul, td > ol {
11751181

11761182
.horizontalheaders * .nav-tabs > .nav-item, .horizontalheaders > .nav-tabs > .nav-item {
11771183
margin-bottom: 0rem;
1184+
margin-left: 0rem;
11781185
}
11791186

11801187
.horizontalheaders > .nav-tabs .nav-item > a {
@@ -1188,6 +1195,7 @@ td > ul, td > ol {
11881195

11891196
.td-content ol li.nav-item {
11901197
margin-bottom: 0 !important;
1198+
margin-left: 0 !important;
11911199
}
11921200

11931201
.tab-content {
@@ -2082,8 +2090,8 @@ a.ais-Pagination-link:hover {
20822090

20832091
#sideSearchBar {
20842092
display: unset;
2085-
margin-right: 0.5rem;
2086-
margin-left: 0rem;
2093+
margin-right: 0rem;
2094+
margin-left: 1rem;
20872095
margin-top: 0.5rem;
20882096
}
20892097

@@ -2100,30 +2108,23 @@ a.ais-Pagination-link:hover {
21002108
}
21012109

21022110
#mobile-search {
2103-
margin-left: 0.5rem;
2104-
margin-right: 1rem;
2111+
margin-left: auto;
2112+
margin-right: auto;
21052113
}
21062114

21072115
@media (max-width: 768px) {
21082116

2109-
#sideSearchBar {
2110-
padding-right: 0.25rem;
2111-
margin-left: 1rem;
2112-
}
21132117

21142118

21152119
#mobile-search {
21162120
margin-left: 0rem;
21172121
margin-right: 0rem;
21182122
}
2119-
}
2120-
2121-
2122-
@media (max-width: 768px) {
21232123

21242124
#sideSearchBar {
2125-
margin-right: 1.0rem;
2126-
margin-left: 0.75rem;
2125+
padding-right: 0rem;
2126+
margin-right: 0.75rem;
2127+
margin-left: 1.5rem;
21272128
}
21282129

21292130
.td-sidebar-nav > .td-sidebar-nav__section {
@@ -3264,32 +3265,16 @@ li.active-path.tutorial-heading > a {
32643265
list-style: none;
32653266
counter-reset: item;
32663267
padding-inline-start: 0px;
3267-
display: table;
32683268
list-style-position: outside;
32693269
margin-bottom: 1rem;
3270-
width: 100%;
3270+
width: calc(100% - 2.5rem);;
32713271
margin-left: 2.5rem;
32723272
}
32733273

32743274
.td-content > ol > li, .td-content > .table * ol > li {
32753275
counter-increment: item;
32763276
margin-bottom: 5px;
3277-
display: table-row;
3278-
}
3279-
3280-
.td-content > ol > li > p, .td-content > .table * ol > li > p,
3281-
.td-content * .table * ol > li > p,
3282-
.td-content > ol > li > .expand, .td-content > .table * ol > li > .expand,
3283-
.td-content > ol * li > .expand, .td-content * .table * ol > li > .expand,
3284-
.td-content > ol > li > div, .td-content > .table * ol > li > div,
3285-
.td-content * ol > li > div, .td-content * .table * ol > li > div,
3286-
.td-content > ol > li > picture, .td-content > .table * ol > li > picture,
3287-
.td-content * ol > li > picture, .td-content * .table * ol > li > picture,
3288-
.td-content > .table * ol > li > ul,
3289-
.td-content * ol > li > ul, .td-content * .table * ol > li > ul,
3290-
.td-content > ol > li > img, .td-content > .table * ol > li > img,
3291-
.td-content * ol > li > img, .td-content * .table * ol > li > img {
3292-
margin-left: 2.5rem;
3277+
display: block;
32933278
}
32943279

32953280
.td-content > ol > li > ul {

docs/operate/control/web-app.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Refer to the [Viam TypeScript SDK](https://ts.viam.dev/) documentation for avail
3838

3939
The following files create an example TypeScript web app that connects to a machine and displays the latest image from the machine's camera, and the latest sensor readings.
4040

41-
{{<imgproc src="/operate/ts-dashboard.png" resize="x1100" declaredimensions=true alt="A web browser displaying a dashboard with a camera feed and sensor readings." style="max-width:450px" class="imgzoom" >}}
41+
{{<imgproc src="/operate/ts-dashboard.png" resize="x1100" declaredimensions=true alt="A web browser displaying a dashboard with a camera feed and sensor readings." style="width:450px" class="imgzoom" >}}
4242

4343
{{< tabs >}}
4444
{{% tab name="main.ts" %}}

docs/operate/get-started/other-hardware/_index.md

+70-44
Original file line numberDiff line numberDiff line change
@@ -180,21 +180,31 @@ Edit the generated files to add your logic:
180180
{{< tabs >}}
181181
{{% tab name="Python" %}}
182182

183-
1. Open <file>/src/models/&lt;model-name&gt;.py</file> and add any necessary imports.
184-
1. **Edit the `validate_config` function** to do the following:
183+
{{< table >}}
184+
{{< tablestep number=1 >}}
185+
Open <file>/src/models/&lt;model-name&gt;.py</file> and add any necessary imports.
186+
{{% /tablestep %}}
187+
{{< tablestep number=2 >}}
188+
**Edit the `validate_config` function** to do the following:
189+
190+
- Check that the user has configured required attributes and return errors if they are missing.
191+
- Return a map of any dependencies.
185192

186-
- Check that the user has configured required attributes and return errors if they are missing.
187-
- Return a map of any dependencies.
188-
- For more information, see [Module dependencies](/operate/get-started/other-hardware/dependencies/).
193+
For more information, see [Module dependencies](/operate/get-started/other-hardware/dependencies/).
189194

190-
1. **Edit the `reconfigure` function**, which gets called when the user changes the configuration.
191-
This function should do the following:
195+
{{% /tablestep %}}
196+
{{< tablestep number=3 >}}
197+
198+
**Edit the `reconfigure` function**, which gets called when the user changes the configuration.
199+
This function should do the following:
192200

193-
- If you assigned any configuration attributes to global variables, get the values from the latest `config` object and update the values of the global variables.
194-
- Assign default values as necessary to any optional attributes if the user hasn't configured them.
195-
- If your module has dependencies, get the dependencies from the `dependencies` map and cast each resource according to which API it implements, as in [this <file>ackermann.py</file> example](https://github.com/mcvella/viam-ackermann-base/blob/main/src/ackermann.py).
201+
- If you assigned any configuration attributes to global variables, get the values from the latest `config` object and update the values of the global variables.
202+
- Assign default values as necessary to any optional attributes if the user hasn't configured them.
203+
- If your module has dependencies, get the dependencies from the `dependencies` map and cast each resource according to which API it implements, as in [this <file>ackermann.py</file> example](https://github.com/mcvella/viam-ackermann-base/blob/main/src/ackermann.py).
204+
{{% /tablestep %}}
205+
{{< tablestep number=4 >}}
196206

197-
<ol><li style="counter-reset: item 3"><strong>Edit the methods you want to implement</strong>:
207+
**Edit the methods you want to implement**:
198208

199209
For each method you want to implement, replace the body of the method with your relevant logic.
200210
Make sure you return the correct type in accordance with the function's return signature.
@@ -323,10 +333,11 @@ if __name__ == "__main__":
323333

324334
You can find more examples by looking at the source code GitHub repos linked from each module in the [Viam Registry](https://app.viam.com/registry).
325335

326-
</li></ol>
336+
{{% /tablestep %}}
337+
{{< tablestep number=5 >}}
327338

328-
<ol><li style="counter-reset: item 4"><strong>Add logging</strong> messages as desired.
329-
The following log severity levels are available for resource logs:
339+
**Add logging** messages as desired.
340+
The following log severity levels are available for resource logs:
330341

331342
```python {class="line-numbers linkable-line-numbers"}
332343
# Within some method, log information:
@@ -367,12 +378,14 @@ LOGGER.critical("critical info")
367378

368379
{{< /expand >}}
369380

370-
</li></ol>
381+
{{% /tablestep %}}
382+
{{< tablestep number=6 >}}
371383

372-
<ol><li style="counter-reset: item 5"><strong>Edit the generated <file>requirements.txt</file> file</strong> to include any packages that must be installed for the module to run.
373-
Depending on your use case, you may not need to add anything here beyond <code>viam-sdk</code> which is auto-populated.
384+
**Edit the generated <file>requirements.txt</file> file** to include any packages that must be installed for the module to run.
385+
Depending on your use case, you may not need to add anything here beyond <code>viam-sdk</code> which is auto-populated.
374386

375-
</li></ol>
387+
{{% /tablestep %}}
388+
{{< /table >}}
376389

377390
{{% /tab %}}
378391
{{% tab name="Go" %}}
@@ -382,35 +395,48 @@ LOGGER.critical("critical info")
382395
This error doesn't exist in the other SDKs, so `AlwaysRebuild` is not supported in those SDKs.
383396
{{% /hiddencontent %}}
384397

385-
1. Open <file>module.go</file> and add necessary imports.
398+
{{< table >}}
399+
{{< tablestep number=1 >}}
400+
Open <file>module.go</file> and add necessary imports.
401+
{{% /tablestep %}}
402+
{{< tablestep number=2 >}}
403+
**Add any configurable attributes to the `Config` struct.**
404+
{{% /tablestep %}}
405+
{{< tablestep number=3 >}}
406+
**Edit the `Validate` function** to do the following:
386407

387-
1. **Add any configurable attributes to the `Config` struct.**
408+
- Check that the user has configured required attributes and return errors if they are missing.
409+
- Return any dependencies.
388410

389-
1. **Edit the `Validate` function** to do the following:
411+
For more information, see [Module dependencies](/operate/get-started/other-hardware/dependencies/).
412+
{{% /tablestep %}}
413+
{{< tablestep number=4 >}}
414+
415+
**(Optional) Create and edit a `Reconfigure` function**:
390416

391-
- Check that the user has configured required attributes and return errors if they are missing.
392-
- Return any dependencies.
393-
- For more information, see [Module dependencies](/operate/get-started/other-hardware/dependencies/).<br><br>
417+
In most cases, you can omit this function and leave `resource.AlwaysRebuild` in the `Config` struct.
418+
This will cause `viam-server` to fully rebuild the resource each time the user changes the configuration.
394419

395-
1. **(Optional) Create and edit a `Reconfigure` function**:
420+
If you need to maintain the state of the resource, for example if you are implementing a board and need to keep the software PWM loops running, you should implement this function so that `viam-server` updates the configuration without rebuilding the resource from scratch.
421+
In this case, your `Reconfigure` function should do the following:
396422

397-
In most cases, you can omit this function and leave `resource.AlwaysRebuild` in the `Config` struct.
398-
This will cause `viam-server` to fully rebuild the resource each time the user changes the configuration.
423+
- If you assigned any configuration attributes to global variables, get the values from the latest `config` object and update the values of the global variables.
424+
- Assign default values as necessary to any optional attributes if the user hasn't configured them.
399425

400-
If you need to maintain the state of the resource, for example if you are implementing a board and need to keep the software PWM loops running, you should implement this function so that `viam-server` updates the configuration without rebuilding the resource from scratch.
401-
In this case, your `Reconfigure` function should do the following:
426+
For an example that implements the `Reconfigure` method, see [<file>mybase.go</file> on GitHub](https://github.com/viamrobotics/rdk/blob/main/examples/customresources/models/mybase/mybase.go).
402427

403-
- If you assigned any configuration attributes to global variables, get the values from the latest `config` object and update the values of the global variables.
404-
- Assign default values as necessary to any optional attributes if the user hasn't configured them.<br><br>
428+
{{% /tablestep %}}
429+
{{< tablestep number=5 >}}
405430

406-
For an example that implements the `Reconfigure` method, see [<file>mybase.go</file> on GitHub](https://github.com/viamrobotics/rdk/blob/main/examples/customresources/models/mybase/mybase.go).
431+
**Edit the constructor** to do the following:
407432

408-
1. **Edit the constructor** to do the following:
433+
- If you didn't create a `Reconfigure` function, use the constructor to assign default values as necessary to any optional attributes if the user hasn't configured them.
434+
- If you created a `Reconfigure` function, make your constructor call `Reconfigure`.
409435

410-
- If you didn't create a `Reconfigure` function, use the constructor to assign default values as necessary to any optional attributes if the user hasn't configured them.
411-
- If you created a `Reconfigure` function, make your constructor call `Reconfigure`.<br><br>
436+
{{% /tablestep %}}
437+
{{< tablestep number=6 >}}
412438

413-
<ol><li style="counter-reset: item 4"><strong>Edit the methods you want to implement</strong>:
439+
**Edit the methods you want to implement**:
414440

415441
For each method you want to implement, replace the body of the method with your relevant logic.
416442
Make sure you return the correct type in accordance with the function's return signature.
@@ -553,10 +579,9 @@ func (s *helloWorldHelloCamera) Close(context.Context) error {
553579
{{< /expand >}}
554580

555581
You can find more examples by looking at the source code GitHub repos linked from each module in the [Viam Registry](https://app.viam.com/registry).
556-
557-
</li></ol>
558-
559-
<ol><li style="counter-reset: item 5"><strong>Add logging</strong> messages as desired.
582+
{{% /tablestep %}}
583+
{{< tablestep number=7 >}}
584+
**Add logging** messages as desired.
560585

561586
You can add log messages with various levels of severity:
562587

@@ -573,7 +598,8 @@ fn (c *component) someFunction(ctx context.Context, a int) {
573598
}
574599
```
575600

576-
</li></ol>
601+
{{% /tablestep %}}
602+
{{< /table >}}
577603

578604
{{% alert title="Note" color="note" %}}
579605
In order to see debug logs when using your modular resource, you'll need to run `viam-server` with the `-debug` option.
@@ -738,7 +764,7 @@ viam module build local
738764
Then restart it in your machine's **CONFIGURE** tab in the Viam app.
739765
In upper right corner of the module's card, click the **...** menu, then click **Restart**.
740766

741-
{{<imgproc src="/registry/restart-module.png" resize="x600" declaredimensions=true alt="Module menu." style="max-width:300px" class="shadow" >}}
767+
{{<imgproc src="/registry/restart-module.png" resize="x600" declaredimensions=true alt="Module menu." style="width:300px" class="shadow" >}}
742768

743769
{{< /expand >}}
744770

@@ -792,7 +818,7 @@ Configure any required attributes using proper JSON syntax.
792818
Click the **TEST** bar at the bottom of your modular component configuration, and check whether it works as expected.
793819
For example, if you created a sensor component, check whether readings are displayed.
794820

795-
{{<imgproc src="/how-tos/sensor-test.png" resize="x1100" declaredimensions=true alt="The test section of an example modular sensor, with readings displayed." style="max-width:600px" class="shadow" >}}
821+
{{<imgproc src="/how-tos/sensor-test.png" resize="x1100" declaredimensions=true alt="The test section of an example modular sensor, with readings displayed." style="width:600px" class="shadow" >}}
796822

797823
{{% /tablestep %}}
798824
{{% tablestep number=5 %}}
@@ -825,7 +851,7 @@ viam module build local
825851
Then restart it in your machine's **CONFIGURE** tab in the Viam app.
826852
In upper right corner of the module's card, click **...** menu, then click **Restart**.
827853

828-
{{<imgproc src="/registry/restart-module.png" resize="x600" declaredimensions=true alt="Module menu." style="max-width:300px" class="shadow" >}}
854+
{{<imgproc src="/registry/restart-module.png" resize="x600" declaredimensions=true alt="Module menu." style="width:300px" class="shadow" >}}
829855

830856
{{% /tab %}}
831857
{{% tab name="Go" %}}

0 commit comments

Comments
 (0)