Skip to content

Commit 46f3444

Browse files
authored
Merge pull request #411 from BYU-PCCL/develop
Release 0.3.1
2 parents 45aaaa3 + 70055f3 commit 46f3444

File tree

90 files changed

+2797
-424
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+2797
-424
lines changed

.dockerignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
*.pyc
2+
*.xml
3+
*.xmi
4+
.idea/
5+
.vscode/
6+
.tflogs/
7+
worlds/
8+
!docs/worlds
9+
build/
10+
env/
11+
venv/
12+
docs/_build
13+
dist/
14+
holodeck.egg-info/
15+
.tox
16+
.pytest_cache
17+
pip-wheel-metadata
18+
!tests/worlds
19+
docker
20+
.dockerignore
21+
.github

.github/workflows/dockerimages.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Docker build
2+
3+
on:
4+
push:
5+
branches: [ docker-improvement ]
6+
pull_request:
7+
branches: [ docker-improvement ]
8+
9+
jobs:
10+
11+
build-images:
12+
env:
13+
IMAGE_NAME: pccl/holodeck
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- name: Login to DockerHub registry
21+
run: |
22+
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
23+
env:
24+
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
25+
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
26+
27+
- name: Build base image
28+
working-directory: ./docker
29+
run: |
30+
docker build -t ${IMAGE_NAME}:base -f ./Dockerfile ..
31+
32+
- name: Build default worlds image
33+
working-directory: ./docker
34+
run: docker build -t ${IMAGE_NAME}:default-worlds -f ./Dockerfile_default_worlds ..
35+
36+
- name: Build dexterity image
37+
working-directory: ./docker
38+
run: docker build -t ${IMAGE_NAME}:dexterity -f ./Dockerfile_dexterity ..
39+
40+
- name: Push images
41+
run: |
42+
docker push ${IMAGE_NAME}:base
43+
docker push ${IMAGE_NAME}:default-worlds
44+
docker push ${IMAGE_NAME}:dexterity

README.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Holodeck is a high-fidelity simulator for reinforcement learning built on top of
2020
## Installation
2121
`pip install holodeck`
2222

23-
(requires Python 3)
23+
(requires >= Python 3.5)
2424

2525
See [Installation](https://holodeck.readthedocs.io/en/latest/usage/installation.html) for complete instructions (including Docker).
2626

@@ -66,9 +66,7 @@ If you want to access the data of a specific sensor, import sensors and
6666
retrieving the correct value from the state dictionary:
6767

6868
```python
69-
from holodeck.sensors import Sensors
70-
71-
print(state[Sensors.LOCATION_SENSOR])
69+
print(state["LocationSensor"])
7270
```
7371

7472
## Multi Agent-Environments
@@ -80,7 +78,10 @@ Calls to [`step`](https://holodeck.readthedocs.io/en/latest/holodeck/environment
8078
action has been provided, [`tick`](https://holodeck.readthedocs.io/en/latest/holodeck/environments.html#holodeck.environments.HolodeckEnvironment.tick) will advance the simulation forward. The action is persisted until another call to `act` provides a different action.
8179

8280
```python
83-
env = holodeck.make('CyberPunkCity-Follow')
81+
import holodeck
82+
import numpy as np
83+
84+
env = holodeck.make("CyberPunkCity-Follow")
8485
env.reset()
8586

8687
# Provide an action for each agent
@@ -89,16 +90,18 @@ env.act('nav0', np.array([0, 0, 0]))
8990

9091
# Advance the simulation
9192
for i in range(300):
92-
# The action provided above is repeated
93-
s = env.tick()
93+
# The action provided above is repeated
94+
states = env.tick()
9495
```
9596

9697
You can access the reward, terminal and location for a multi agent environment as follows:
9798

98-
``` python
99-
s['uav0'][Sensors.REWARD]
100-
s['uav0'][Sensors.TERMINAL]
101-
s['uav0'][Sensors.LOCATION_SENSOR]
99+
```python
100+
task = states["uav0"]["FollowTask"]
101+
102+
reward = task[0]
103+
terminal = task[1]
104+
location = states["uav0"]["LocationSensor"]
102105
```
103106

104107
(`uav0` comes from the [scenario configuration file](https://holodeck.readthedocs.io/en/latest/packages/docs/scenarios.html))

docker/Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM nvidia/cudagl:9.2-runtime-ubuntu18.04
2+
3+
RUN apt-get update && apt-get install -y --no-install-recommends \
4+
python3 python3-dev ipython3 module-init-tools curl build-essential python3-pip
5+
6+
# OpenCV's runtime dependencies
7+
RUN apt-get install -y libglib2.0-0 libsm6 libxrender-dev libxext6
8+
9+
RUN pip3 install -U pip setuptools wheel
10+
11+
RUN pip3 install numpy posix_ipc holodeck pytest opencv-python
12+
13+
RUN adduser --disabled-password --gecos "" holodeckuser
14+
15+
WORKDIR /home/holodeckuser/source/holodeck/
16+
17+
# This should be COPY ../ but docker doesn't allow copying files outside the context
18+
# To copy the project files either run the build command in this directory with the
19+
# previous directory as the context: docker build -t pccl/holodeck[:tag] -f ./Dockerfile ..
20+
# or run it from the parent directory and provide the docekr file location
21+
# docker build -t pccl/holodeck[:tag] -f ./docker/Dockerfile .
22+
COPY ./ .
23+
24+
USER holodeckuser
25+
26+
CMD ["/bin/bash"]

docker/Dockerfile_default_worlds

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM pccl/holodeck:base
2+
3+
RUN python3 -c 'import holodeck; holodeck.install("DefaultWorlds")'
4+
5+
CMD ["/bin/bash"]

docker/Dockerfile_dexterity

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM pccl/holodeck:base
2+
3+
RUN python3 -c 'import holodeck; holodeck.install("Dexterity")'
4+
5+
CMD ["/bin/bash"]

docker/build_and_tag.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docker build -t pccl/holodeck:base -f ./Dockerfile ..

docs/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
This folder contains holodeck's user-facing documentation (hosted at
2+
holodeck.readthedocs.io), and is compiled with [Sphinx](http://www.sphinx-doc.org/en/master/).
3+
4+
The documentation can be built locally to preview changes before pushing to
5+
GitHub.
6+
7+
### Prerequisites
8+
9+
`pip install sphinx autodocsumm sphinx_rtd_theme doc8`
10+
11+
### Building
12+
13+
From this directory,
14+
```console
15+
~/dev/holodeck/docs$ make clean && make html
16+
```
17+
18+
[This VSCode extension](https://marketplace.visualstudio.com/items?itemName=lextudio.restructuredtext)
19+
is useful since it allows you to preview the docs without needing to
20+
compile them.
21+
22+
### Style Note
23+
24+
Pay careful attention to the warnings when you build the docs. The expectation
25+
is that we have a clean build. This includes
26+
27+
Make sure to have the VSCode extension and doc8 installed you you get proper
28+
linting.

docs/agents/android-agent.rst

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,40 @@ Description
1717
An android agent that can be controlled via torques supplied to its joints.
1818
See :class:`~holodeck.agents.AndroidAgent` for more details.
1919

20+
Control Schemes
21+
---------------
22+
**Android Direct Torques** (``0``)
23+
A 94 dimensional vector of continuous values representing torques to be
24+
applied at each joint. See :ref:`android-joints` below for a description of
25+
the joint indicies.
26+
27+
**Android Max Scaled Torques** (``1``)
28+
A 94 dimensional vector of continuous values between [-1, 1] representing the
29+
scaled torques to be applied at each joint. See :ref:`android-joints` below
30+
for a description of the joint indicies.
31+
32+
1 represents the maximum forward torque and -1 the maximum torque in the
33+
opposite direction.
34+
2035
.. _`android-joints`:
2136

2237
Android Joints
2338
--------------
2439
The control scheme for the android and the
25-
:class:`~holodeck.sensors.JointRotationSensor` use a 94 length vector refer
26-
to 48 joints.
40+
:class:`~holodeck.sensors.JointRotationSensor` use a 94 length vector refer to
41+
48 joints.
2742

28-
To gain insight into these joints, refer to the table below, or use the
29-
:meth:`~holodeck.agents.AndroidAgent.joint_ind` helper method to convert a
30-
name (eg ``spine_02``) to and index (``6``).
43+
To gain insight into these joints, refer to the table below, or use the
44+
:meth:`~holodeck.agents.AndroidAgent.joint_ind` helper method to convert a name
45+
(eg ``spine_02``) to and index (``6``).
3146

3247
.. note::
3348
Note that the index given is the start index for the joint, see the section
3449
header for how many values after this index each joint has.
3550

36-
Example: ``neck_01`` starts at index 3, and has ``[swing1, swing2, twist]``, so index
37-
3 in the 94 length vector corresponds to ``swing1``, 4 corresponds to ``swing2``, and
38-
5 corresponds to ``twist`` for ``neck_01``
51+
Example: ``neck_01`` starts at index 3, and has ``[swing1, swing2, twist]``
52+
, so index 3 in the 94 length vector corresponds to ``swing1``, 4
53+
corresponds to ``swing2``, and 5 corresponds to ``twist`` for ``neck_01``.
3954

4055
Returned in the following order:
4156

@@ -161,8 +176,8 @@ Returned in the following order:
161176

162177
AndroidAgent Bones
163178
------------------
164-
The :class:`~holodeck.sensors.RelativeSkeletalPositionSensor` returns an
165-
array with four entries for each bone listed below.
179+
The :class:`~holodeck.sensors.RelativeSkeletalPositionSensor` returns an array
180+
with four entries for each bone listed below.
166181

167182
========= =======================
168183
Index Bone Name
@@ -229,20 +244,11 @@ array with four entries for each bone listed below.
229244
``236`` ``thigh_twist_01_r``
230245
========= =======================
231246

232-
233-
Control Schemes
234-
---------------
235-
236-
- Android Torques
237-
238-
See :class:`~holodeck.agents.AndroidAgent` for details on how this control scheme works.
239-
240247
.. TODO: Example code
241248
242249
Sockets
243250
---------------
244251

245252
- ``CameraSocket`` located in the middle of the android's face
246253
- ``Viewport`` located behind the agent
247-
- All of the joints may be used as sockets. See
248-
:ref:`android-joints`
254+
- All of the joints may be used as sockets. See :ref:`android-joints`.

docs/agents/hand-agent.rst

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,39 +18,42 @@ Control Schemes
1818
---------------
1919

2020
- **Raw Joint Torques** (``0``)
21-
21+
2222
23 length vector of raw torques to pass into the joints, in the order listed
2323
beow in :ref:`hand-joints`
2424

2525
- **Scaled Joint Torques** (``1``)
26-
26+
2727
23 length vector of scaled torques, between ``-1`` and ``1``. The strength
2828
finger each joint is scaled depending on the weight of the bone and if it is
2929
a finger or not. ``1`` represents the maximum power in the forward direction
3030

3131

3232
- **Scaled Joint Torques + Floating** (``2``)
33-
33+
3434
Same as above, but the vector is of length 26, with the last three values
3535
representing the amount of movement in the ``[x, y, z]`` directions (see
3636
:ref:`coordinate-system`), with a maximum of ``0.5`` meters of freedom.
3737

38+
The last coordinates allow the HandAgent to float around.
39+
40+
3841
.. _`hand-joints`:
3942

4043
HandAgent Joints
4144
----------------
4245
The control scheme for the HandAgent and the
43-
:class:`~holodeck.sensors.JointRotationSensor` use a 94 length vector refer
44-
to 48 joints.
46+
:class:`~holodeck.sensors.JointRotationSensor` use a 94 length vector refer
47+
to 48 joints.
4548

4649
To gain insight into these joints, refer to the table below.
4750

4851
.. note::
4952
Note that the index given is the start index for the joint, see the section
5053
header for how many values after this index each joint has.
5154

52-
Example: ``hand_r`` starts at index 0, and has ``[swing1, swing2, twist]``,
53-
so index 0 in the vector corresponds to ``swing1``, 1 corresponds to
55+
Example: ``hand_r`` starts at index 0, and has ``[swing1, swing2, twist]``,
56+
so index 0 in the vector corresponds to ``swing1``, 1 corresponds to
5457
``swing2``, and 2 corresponds to ``twist`` for ``hand_r``
5558

5659
Returned in the following order:
@@ -110,7 +113,7 @@ Returned in the following order:
110113

111114
HandAgent Bones
112115
---------------
113-
The :class:`~holodeck.sensors.RelativeSkeletalPositionSensor` returns an
116+
The :class:`~holodeck.sensors.RelativeSkeletalPositionSensor` returns an
114117
array with four entries for each of the 17 bones listed below.
115118

116119
========= ===============
@@ -141,5 +144,5 @@ Sockets
141144

142145
- ``CameraSocket`` located behind and above the wrist
143146
- ``Viewport`` located looking at the agent from the side
144-
- All of the joints may be used as sockets. See
147+
- All of the joints may be used as sockets. See
145148
:ref:`hand-joints`

docs/agents/nav-agent.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ attempt to intelligently navigate towards those coordinates.
1919

2020
Control Schemes
2121
---------------
22+
**Nav Target Location (``0``)**
23+
A 3-length floating point vector used to specify the x, y and z
24+
coordinates for the agent to navigate to.
2225

23-
See :class:`holodeck.agents.NavAgent` for specific details on the control scheme.
2426

2527
Sockets
2628
-------

docs/agents/sphere-agent.rst

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ See :class:`~holodeck.agents.SphereAgent` for more details.
2121
Control Schemes
2222
---------------
2323

24-
- Discrete
25-
- Continuous Control Scheme
24+
**Sphere discrete** (``0``)
25+
A single-length integer vector that accepts 1 of four
26+
possible numbers; 0: move forward, 1: move backward,
27+
2: turn right, 3: turn left
2628

27-
See :class:`~holodeck.agents.SphereAgent` for details on how to use
28-
the control schemes.
29-
30-
.. TODO: Example code?
29+
**Sphere continuous** (``1``)
30+
A 2-length floating point vector used to specify
31+
the agent's forward speed (index 0) and rotation speed (index 1).
3132

3233
Sockets
3334
---------------
@@ -36,4 +37,4 @@ Sockets
3637
- ``Viewport`` located behind the agent
3738

3839
.. image:: images/sphere-sockets.png
39-
:scale: 30%
40+
:scale: 30%

docs/agents/turtle-agent.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ TurtleAgent is subject to gravity and can climb ramps and slopes.
1717

1818
See :class:`~holodeck.agents.TurtleAgent` for more details.
1919

20+
Control Schemes
21+
---------------
22+
23+
**Sphere continuous** (``1``)
24+
A 2-length floating point vector used to specify
25+
the agent's forward force (index 0) and rotation force (index 1).
26+
2027
Sockets
2128
-------
2229

0 commit comments

Comments
 (0)