Skip to content

Commit f87504a

Browse files
committed
define environment
1 parent 69114b3 commit f87504a

File tree

17 files changed

+56
-25
lines changed

17 files changed

+56
-25
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ pkg> add Dojo#main
8585

8686
## Citing
8787
```
88-
@article{howell2022dojo,
88+
@article{howelllecleach2022dojo,
8989
title={Dojo: {A} {D}ifferentiable {S}imulator for {R}obotics},
9090
author={Howell, Taylor A. and Le Cleac'h, Simon and Kolter, J. Zico and Schwager, Mac and Manchester, Zachary},
9191
year={2022}

docs/make.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
push!(LOAD_PATH, "../src/")
22

3-
using Documenter#, Dojo
3+
using Documenter, Dojo
44

55
makedocs(
66
modules = [Dojo],

docs/src/citing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
If you find Dojo useful in your project, we kindly request that you cite the following paper:
44
```
5-
@article{howell2022dojo,
5+
@article{howelllecleach2022dojo,
66
title={Dojo: {A} {D}ifferentiable {S}imulator for {R}obotics},
77
author={Howell, Taylor A. and Le Cleac'h, Simon and and Kolter, J. Zico and Schwager, Mac and Manchester, Zachary},
88
year={2022}

docs/src/contact_models.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ Three contact models are implemented in Dojo:
1111
- [`LinearContact`](@ref) enforces contact with a linearized cone of friction (pyramidal cone).
1212
![linearized_cone](./assets/linearized_cone.png)
1313

14-
All 3 of these contact models implement hard contact i.e. no interpenetration. This means that for both the nonlinear and linearized cones, we concatenate the constraints resulting from friction with the impact constraints.
14+
All 3 of these contact models implement hard contact i.e., no interpenetration. This means that for both the nonlinear and linearized cones, we concatenate the constraints resulting from friction with the impact constraints.
1515

1616
### Implementation
17-
Dojo currently supports contact constraints occurring between a sphere and the ground i.e. a horizontal half-space of altitude 0.0. Each spherical contact is attached to a single [`Body`](@ref).
17+
Dojo currently supports contact constraints occurring between a sphere and the ground i.e., a horizontal half-space of altitude 0.0. Each spherical contact is attached to a single [`Body`](@ref).
1818

1919
To create a new point of contact, we need to define:
2020
- the [`Body`](@ref) to which the contact constraint is attached

docs/src/contributing.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
# Contributing
22

3-
Contributions are always welcome:
3+
Contributions are always welcome!
44

55
* If you want to contribute features, bug fixes, etc, please take a look at our __Code Style Guide__ below
66
* Please report any issues and bugs that you encounter in [Issues](https://github.com/dojo-sim/Dojo.jl/issues)
77
* As an open source project we are also interested in any projects and applications that use Dojo. Please let us know via email to: thowell@stanford.edu or simonlc@stanford.edu
88

9+
## Potentially Useful Contributions
10+
Here are a list of current to-do's that would make awesome contributions:
11+
12+
- improved parsing of URDF files
13+
- joint limits, friction coefficients
14+
- improved collision detection
15+
- body-to-body contact
16+
- general convex shapes
17+
- curved surfaces
18+
- GPU support
19+
- nice REPL interface
20+
- interactive GUI
21+
922
## Code Style Guide
1023

1124
The code in this repository follows the naming and style conventions of [Julia Base](https://docs.julialang.org/en/v1.0/manual/style-guide/#Style-Guide-1) with a few modifications. This style guide is heavily "inspired" by the guides of [John Myles White](https://github.com/johnmyleswhite/Style.jl), [JuMP](http://www.juliaopt.org/JuMP.jl/latest/style), and [COSMO](https://github.com/oxfordcontrol/COSMO.jl)

docs/src/define_controller.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Defining a Controller
22
Here, we explain how to write a controller and simulate its effect on a dynamical system
3-
i.e. a [`Mechanism`](@ref).
3+
i.e., a [`Mechanism`](@ref).
44
We focus on a simple pendulum swing-up.
55

66
Load Dojo and use the pendulum mechanism with desired simulation time step, desired gravity and desired damping at the joint.
@@ -16,12 +16,12 @@ mechanism = get_mechanism(:pendulum,
1616

1717
Define the controller. This is a method that takes 2 input arguments:
1818
- a [`Mechanism`](@ref),
19-
- an integer `k` indicating the current simulation step.
19+
- an integer `t` indicating the current simulation step.
2020
The controller computes the control inputs based on the current state `x`, the goal state `x_goal` and a proportional gain `K`.
2121

2222

2323
```julia
24-
function controller!(mechanism, k)
24+
function controller!(mechanism, t)
2525
## Target state
2626
x_goal = [1.0 * π; 0.0]
2727

docs/src/define_environment.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,4 +214,21 @@ Determine if simulation should terminate:
214214
function is_done(env::Environment{Ant}, x)
215215
!(all(isfinite.(env.state)) && (env.state[3] >= 0.2) && (env.state[3] <= 1.0))
216216
end
217-
```
217+
```
218+
219+
# Random controls
220+
221+
We apply random controls to the robot via the environment interface:
222+
```julia
223+
y = [copy(env.state)] # state trajectory
224+
for t = 1:100
225+
step(env, env.state, randn(env.num_inputs))
226+
push!(y, copy(env.state))
227+
end
228+
visualize(env, y)
229+
```
230+
231+
The result should be something like this:
232+
```@raw html
233+
<img src="./../../examples/animations/ant_random.gif" width="300"/>
234+
```

docs/src/define_simulation.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# Defining a Simulation
2-
Here, we explain how to simulate a dynamical system i.e. a [`Mechanism`](@ref) forward in time.
2+
Here, we explain how to simulate a dynamical system i.e., a [`Mechanism`](@ref) forward in time.
33
The example that we are trying to replicate the Dzhanibekov effect shown below.
44

55
![dzhanibekov](./assets/dzhanibekov_nasa.gif)
66

7-
87
Load the `Dojo` package.
98
```julia
109
using Dojo
@@ -25,13 +24,13 @@ mech = get_mechanism(:dzhanibekov,
2524

2625
We initialize the system with a given initial angular velocity.
2726
```julia
28-
initialize_dzhanibekov!(mech,
27+
initialize!(mech, :dzhanibekov,
2928
angular_velocity=[15.0; 0.01; 0.0])
3029
```
3130

32-
We simulate this system for 4 seconds, we record the resulting trajectory in `storage`,
31+
We simulate this system for 5 seconds, we record the resulting trajectory in `storage`,
3332
```julia
34-
storage = simulate!(mech, 4.00,
33+
storage = simulate!(mech, 5.0,
3534
record=true,
3635
verbose=false)
3736
```

docs/src/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ __Primary Development__
3232

3333
* [Zico Kolter](https://zicokolter.com/)
3434
* [Mac Schwager](https://web.stanford.edu/~schwager/)
35-
* [Zachary Manchester](https://www.ri.cmu.edu/ri-faculty/zachary-manchester/)
35+
* [Zachary Manchester](https://www.ri.cmu.edu/ri-faculty/zachary-manchester/) (principal investigator)
3636

3737
Development by the [Robotic Exploration Lab](https://roboticexplorationlab.org/).
3838

docs/src/linearized_friction.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ For a single contact point, this physical phenomenon can be modeled by the follo
77

88
```math
99
\begin{align*}
10-
\text{minimize}_{b} & \quad v^T b \\
10+
\underset{b}{\text{minimize}} & \quad v^T b \\
1111
\text{subject to} & \quad \|b\|_2 \leq \mu \gamma,
1212
\end{align*}
1313
```
@@ -19,7 +19,7 @@ This above problem is naturally a convex second-order cone program, and can be e
1919

2020
```math
2121
\begin{align*}
22-
\text{minimize}_{\beta} & \quad [v^T -v^T] \beta, \\
22+
\underset{\beta}{\text{minimize}} & \quad [v^T -v^T] \beta, \\
2323
\text{subject to} & \quad \beta^T \mathbf{1} \leq \mu \gamma, \\
2424
& \quad \beta \geq 0,
2525
\end{align*}

0 commit comments

Comments
 (0)