Skip to content

Commit

Permalink
deploy: e8d7b60
Browse files Browse the repository at this point in the history
  • Loading branch information
brentyi committed May 24, 2024
1 parent 45c9c1a commit e30ffe2
Show file tree
Hide file tree
Showing 154 changed files with 102,423 additions and 0 deletions.
4 changes: 4 additions & 0 deletions latest/.buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 374c96257dbeedf1698794afe349bc7e
tags: d77d1c0d9ca2f4c8421862c7c5a0d620
Binary file added latest/.doctrees/client_handles.doctree
Binary file not shown.
Binary file added latest/.doctrees/conventions.doctree
Binary file not shown.
Binary file added latest/.doctrees/development.doctree
Binary file not shown.
Binary file added latest/.doctrees/environment.pickle
Binary file not shown.
Binary file added latest/.doctrees/events.doctree
Binary file not shown.
Binary file not shown.
Binary file added latest/.doctrees/examples/01_image.doctree
Binary file not shown.
Binary file added latest/.doctrees/examples/02_gui.doctree
Binary file not shown.
Binary file not shown.
Binary file added latest/.doctrees/examples/04_camera_poses.doctree
Binary file not shown.
Binary file not shown.
Binary file added latest/.doctrees/examples/06_mesh.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added latest/.doctrees/examples/10_realsense.doctree
Binary file not shown.
Binary file not shown.
Binary file added latest/.doctrees/examples/12_click_meshes.doctree
Binary file not shown.
Binary file added latest/.doctrees/examples/13_theming.doctree
Binary file not shown.
Binary file added latest/.doctrees/examples/14_markdown.doctree
Binary file not shown.
Binary file added latest/.doctrees/examples/15_gui_in_scene.doctree
Binary file not shown.
Binary file added latest/.doctrees/examples/16_modal.doctree
Binary file not shown.
Binary file not shown.
Binary file added latest/.doctrees/examples/18_splines.doctree
Binary file not shown.
Binary file added latest/.doctrees/examples/19_get_renders.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added latest/.doctrees/examples/22_games.doctree
Binary file not shown.
Binary file added latest/.doctrees/examples/23_plotly.doctree
Binary file not shown.
Binary file added latest/.doctrees/extras.doctree
Binary file not shown.
Binary file added latest/.doctrees/gui_handles.doctree
Binary file not shown.
Binary file added latest/.doctrees/icons.doctree
Binary file not shown.
Binary file added latest/.doctrees/index.doctree
Binary file not shown.
Binary file added latest/.doctrees/infrastructure.doctree
Binary file not shown.
Binary file added latest/.doctrees/scene_handles.doctree
Binary file not shown.
Binary file added latest/.doctrees/server.doctree
Binary file not shown.
Binary file added latest/.doctrees/transforms.doctree
Binary file not shown.
Empty file added latest/.nojekyll
Empty file.
319 changes: 319 additions & 0 deletions latest/_modules/index.html

Large diffs are not rendered by default.

1,064 changes: 1,064 additions & 0 deletions latest/_modules/viser/_gui_handles/index.html

Large diffs are not rendered by default.

4,617 changes: 4,617 additions & 0 deletions latest/_modules/viser/_icons_enum/index.html

Large diffs are not rendered by default.

641 changes: 641 additions & 0 deletions latest/_modules/viser/_scene_handles/index.html

Large diffs are not rendered by default.

1,017 changes: 1,017 additions & 0 deletions latest/_modules/viser/_viser/index.html

Large diffs are not rendered by default.

447 changes: 447 additions & 0 deletions latest/_modules/viser/extras/_record3d/index.html

Large diffs are not rendered by default.

462 changes: 462 additions & 0 deletions latest/_modules/viser/extras/_urdf/index.html

Large diffs are not rendered by default.

764 changes: 764 additions & 0 deletions latest/_modules/viser/infra/_infra/index.html

Large diffs are not rendered by default.

487 changes: 487 additions & 0 deletions latest/_modules/viser/infra/_messages/index.html

Large diffs are not rendered by default.

487 changes: 487 additions & 0 deletions latest/_modules/viser/infra/_typescript_interface_gen/index.html

Large diffs are not rendered by default.

670 changes: 670 additions & 0 deletions latest/_modules/viser/transforms/_base/index.html

Large diffs are not rendered by default.

605 changes: 605 additions & 0 deletions latest/_modules/viser/transforms/_se2/index.html

Large diffs are not rendered by default.

570 changes: 570 additions & 0 deletions latest/_modules/viser/transforms/_se3/index.html

Large diffs are not rendered by default.

492 changes: 492 additions & 0 deletions latest/_modules/viser/transforms/_so2/index.html

Large diffs are not rendered by default.

833 changes: 833 additions & 0 deletions latest/_modules/viser/transforms/_so3/index.html

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions latest/_sources/client_handles.md.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Client Handles

A handle is created for each client that connects to a server. Handles can be
used to communicate with just one client, as well as for reading and writing of
camera state.

<!-- prettier-ignore-start -->

.. autoclass:: viser.ClientHandle
:members:
:undoc-members:
:inherited-members:

.. autoclass:: viser.CameraHandle
:members:
:undoc-members:
:inherited-members:

<!-- prettier-ignore-end -->
62 changes: 62 additions & 0 deletions latest/_sources/conventions.md.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Frame Conventions

In this note, we describe the coordinate frame conventions used in `viser`.

## Scene tree naming

Each object that we add to the scene in viser is instantiated as a node in a
scene tree. The structure of this tree is determined by the names assigned to
the nodes.

If we add a coordinate frame called `/base_link/shoulder/wrist`, it signifies
three nodes: the `wrist` is a child of the `shoulder` which is a child of the
`base_link`.

If we set the transformation of a given node like `/shoulder`, both it and all
of its children will move. Its parent, `/base_link`, will be unaffected.

## Poses

Poses in `viser` are defined using a pair of fields:

- `wxyz`, a unit quaternion orientation term. This should always be 4D.
- `position`, a translation term. This should always be 3D.

These correspond to a transformation from coordinates in the local frame to the
parent frame:

<!-- prettier-ignore-start -->

.. math::

p_\mathrm{parent} = \begin{bmatrix} R \mid t \end{bmatrix}p_\mathrm{local}

<!-- prettier-ignore-end -->

where `wxyz` is the quaternion form of the :math:`\mathrm{SO}(3)` matrix
:math:`R` and `position` is the translation term :math:`t`.

## World coordinates

In the world coordinate space, +Z points upward by default. This can be
overridden with :func:`viser.ViserServer.set_up_direction()` or
:func:`viser.ClientHandle.set_up_direction()`.

## Cameras

All camera parameters exposed to the Python API use the COLMAP/OpenCV
convention:

- Forward: +Z
- Up: -Y
- Right: +X

Confusingly, this is different from Nerfstudio, which adopts the OpenGL/Blender
convention:

- Forward: -Z
- Up: +Y
- Right: +X

Note that conversion between the two is a simple 180 degree rotation around the
X-axis.
118 changes: 118 additions & 0 deletions latest/_sources/development.md.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# Development

In this note, we outline current practices, tools, and workflows for `viser`
development. We assume that the repository is cloned to `~/viser`.

## Python install

We recommend an editable install for Python development, ideally in a virtual
environment (eg via conda).

```bash
# Install package.
cd ~/viser
pip install -e .

# Install example dependencies.
pip install -e .[examples]
```

After installation, any of the example scripts (`~/viser/examples`) should be
runnable. A few of them require downloading assets, which can be done via the
scripts in `~/viser/examples/assets`.

**Linting, formatting, type-checking.**

First, install developer tools:

```bash
# Using pip.
pip install -e .[dev]
pre-commit install
```

It would be hard to write unit tests for `viser`. We rely on static typing for
robustness. To check your code, you can run the following:

```bash
# runs linting, formatting, and type-checking
viser-dev-checks
```

## Message updates

The `viser` frontend and backend communicate via a shared set of message
definitions:

- On the server, these are defined as Python dataclasses in
`~/viser/viser/_messages.py`.
- On the client, these are defined as TypeScript interfaces in
`~/viser/viser/client/src/WebsocketMessages.tsx`.

Note that there is a 1:1 correspondence between the dataclasses message types
and the TypeScript ones.

The TypeScript definitions should not be manually modified. Instead, changes
should be made in Python and synchronized via the `sync_message_defs.py` script:

```
cd ~/viser
python sync_message_defs.py
```

## Client development

For client development, we can start by launching a relevant Python script. The
examples are a good place to start:

```
cd ~/viser/examples
python 05_camera_commands.py
```

When a `viser` script is launched, two URLs will be printed:

- An HTTP URL, like `http://localhost:8080`, which can be used to open a
_pre-built_ version of the React frontend.
- A websocket URL, like `ws://localhost:8080`, which client applications can
connect to.

If changes to the client source files are detected on startup, `viser` will
re-build the client automatically. This is okay for quick changes, but for
faster iteration we can also launch a development version of the frontend, which
will reflect changes we make to the client source files
(`~/viser/viser/client/src`) without a full build. This requires a few more
steps.

**Installing dependencies.**

1. [Install nodejs.](https://nodejs.dev/en/download/package-manager)
2. [Install yarn.](https://yarnpkg.com/getting-started/install)
3. Install dependencies.
```
cd ~/viser/viser/client
yarn install
```

**Launching client.**

To launch the client, we can run:

```
cd ~/viser/viser/client
yarn start
```

from the `viser/viser/client` directory. After opening the client in a web
browser, the websocket server address typically needs to be updated in the
"Server" tab.

**Formatting.**

We use [prettier](https://prettier.io/docs/en/install.html). This can be run via
one of:

- `prettier -w .`
- `npx prettier -w .`

from `~/viser/client`.
14 changes: 14 additions & 0 deletions latest/_sources/events.md.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Events

We define a small set of event types, which are passed to callback functions
when events like clicks or GUI updates are triggered.

<!-- prettier-ignore-start -->

.. autoclass:: viser.ScenePointerEvent()

.. autoclass:: viser.SceneNodePointerEvent()

.. autoclass:: viser.GuiEvent()

<!-- prettier-ignore-end -->
47 changes: 47 additions & 0 deletions latest/_sources/examples/00_coordinate_frames.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
.. Comment: this file is automatically generated by `update_example_docs.py`.
It should not be modified manually.
Coordinate frames
==========================================


In this basic example, we visualize a set of coordinate frames.

Naming for all scene nodes are hierarchical; /tree/branch, for example, is defined
relative to /tree.



.. code-block:: python
:linenos:
import random
import time
import viser
server = viser.ViserServer()
while True:
# Add some coordinate frames to the scene. These will be visualized in the viewer.
server.add_frame(
"/tree",
wxyz=(1.0, 0.0, 0.0, 0.0),
position=(random.random() * 2.0, 2.0, 0.2),
)
server.add_frame(
"/tree/branch",
wxyz=(1.0, 0.0, 0.0, 0.0),
position=(random.random() * 2.0, 2.0, 0.2),
)
leaf = server.add_frame(
"/tree/branch/leaf",
wxyz=(1.0, 0.0, 0.0, 0.0),
position=(random.random() * 2.0, 2.0, 0.2),
)
time.sleep(5.0)
# Remove the leaf node from the scene.
leaf.remove()
time.sleep(0.5)
65 changes: 65 additions & 0 deletions latest/_sources/examples/01_image.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
.. Comment: this file is automatically generated by `update_example_docs.py`.
It should not be modified manually.
Images
==========================================


Example for sending images to the viewer.

We can send backgrond images to display behind the viewer (useful for visualizing
NeRFs), or images to render as 3D textures.



.. code-block:: python
:linenos:
import time
from pathlib import Path
import imageio.v3 as iio
import numpy as onp
import viser
def main() -> None:
server = viser.ViserServer()
# Add a background image.
server.set_background_image(
iio.imread(Path(__file__).parent / "assets/Cal_logo.png"),
format="png",
)
# Add main image.
server.add_image(
"/img",
iio.imread(Path(__file__).parent / "assets/Cal_logo.png"),
4.0,
4.0,
format="png",
wxyz=(1.0, 0.0, 0.0, 0.0),
position=(2.0, 2.0, 0.0),
)
while True:
server.add_image(
"/noise",
onp.random.randint(
0,
256,
size=(400, 400, 3),
dtype=onp.uint8,
),
4.0,
4.0,
format="jpeg",
wxyz=(1.0, 0.0, 0.0, 0.0),
position=(2.0, 2.0, -1e-2),
)
time.sleep(0.2)
if __name__ == "__main__":
main()
Loading

0 comments on commit e30ffe2

Please sign in to comment.