Skip to content

Commit

Permalink
Merge pull request #299 from tkoolen/docs-fixes
Browse files Browse the repository at this point in the history
Minor doc fixes
  • Loading branch information
tkoolen authored Aug 20, 2017
2 parents 59f9880 + 4709589 commit cd58a54
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 21 deletions.
4 changes: 2 additions & 2 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Documenter, RigidBodyDynamics
using Documenter, RigidBodyDynamics, RigidBodyDynamics.OdeIntegrators

makedocs(
# options
modules = [RigidBodyDynamics],
modules = [RigidBodyDynamics, RigidBodyDynamics.OdeIntegrators],
format = :html,
sitename ="RigidBodyDynamics.jl",
authors = "Twan Koolen and contributors.",
Expand Down
9 changes: 5 additions & 4 deletions docs/src/joints.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ Pages = ["joint.jl"]

## `JointType`s

```@autodocs
Modules = [RigidBodyDynamics]
Order = [:type, :function]
Pages = ["joint_types.jl"]
```@docs
QuaternionFloating
Revolute
Prismatic
Fixed
```
10 changes: 9 additions & 1 deletion docs/src/simulation.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,16 @@ simulate
```

## Lower level ODE integration interface
```@docs
MuntheKaasIntegrator
ButcherTableau
OdeResultsSink
RingBufferStorage
ExpandingStorage
```

```@autodocs
Modules = [RigidBodyDynamics.OdeIntegrators]
Order = [:type, :function]
Order = [:function]
Pages = ["ode_integrators.jl"]
```
12 changes: 11 additions & 1 deletion src/frames.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,23 @@ quantities are expressed.
struct CartesianFrame3D
id::Int64

"""
$(SIGNATURES)
Create a `CartesianFrame3D` with the given name.
"""
function CartesianFrame3D(name::String)
ret = new(next_frame_id.x)
next_frame_id.x = Base.Checked.checked_add(next_frame_id.x, 1)
frame_names[ret.id] = name
ret
end

"""
$(SIGNATURES)
Create an anonymous `CartesianFrame3D`.
"""
function CartesianFrame3D()
ret = new(next_frame_id.x)
next_frame_id.x = Base.Checked.checked_add(next_frame_id.x, 1)
Expand All @@ -40,7 +50,7 @@ Base.show(io::IO, frame::CartesianFrame3D) = print(io, "CartesianFrame3D: \"$(na
"""
$(SIGNATURES)
Check that `f1` and `f2` are identical (when bounds checks are enabled).
Check that `CartesianFrame3D`s `f1` and `f2` are identical (when bounds checks are enabled).
Throws an `ArgumentError` if `f1` is not identical to `f2` when bounds checks
are enabled. `@framecheck` is a no-op when bounds checks are disabled.
Expand Down
12 changes: 6 additions & 6 deletions src/mechanism.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ mutable struct Mechanism{T}
environment::ContactEnvironment{T}
gravitationalAcceleration::FreeVector3D{SVector{3, T}} # TODO: consider removing

"""
$(SIGNATURES)
Create a new `Mechanism` containing only a root body, to which other bodies can
be attached with joints.
"""
function Mechanism(rootBody::RigidBody{T}; gravity::SVector{3, T} = SVector(zero(T), zero(T), T(-9.81))) where {T}
graph = DirectedGraph{RigidBody{T}, GenericJoint{T}}()
add_vertex!(graph, rootBody)
Expand All @@ -21,12 +27,6 @@ mutable struct Mechanism{T}
end
end

"""
$(SIGNATURES)
Create a new `Mechanism` containing only a root body, to which other bodies can
be attached with joints.
"""
Base.eltype(::Type{Mechanism{T}}) where {T} = T

"""
Expand Down
1 change: 1 addition & 0 deletions src/ode_integrators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ using DocStringExtensions

export runge_kutta_4,
MuntheKaasIntegrator,
ButcherTableau,
OdeResultsSink,
RingBufferStorage,
ExpandingStorage,
Expand Down
2 changes: 1 addition & 1 deletion src/simulate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Basic `Mechanism` simulation: integrate the state from time ``0`` to `finalTime`
starting from the initial state `state0`. Return a `Vector` of times, as well as
`Vector`s of configuration vectors and velocity vectors at these times.
Uses `MuntheKaasIntegrator`. See [`MuntheKaasIntegrator`](@ref) for a lower
Uses `MuntheKaasIntegrator`. See [`RigidBodyDynamics.OdeIntegrators.MuntheKaasIntegrator`](@ref) for a lower
level interface with more options.
"""
function simulate(state0::MechanismState, finalTime; Δt = 1e-4)
Expand Down
16 changes: 10 additions & 6 deletions src/spatial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,11 @@ to an inertial frame, achieve spatial acceleration ``\\dot{T}``.
This wrench is also equal to the rate of change of momentum of the body.
"""
function newton_euler(I::SpatialInertia, Ṫ::SpatialAcceleration, T::Twist)
function newton_euler(inertia::SpatialInertia, spatial_accel::SpatialAcceleration, twist::Twist)
I = inertia
T = twist
= spatial_accel

body =.body
base =.base # TODO: should assert that this is an inertial frame somehow
frame =.frame
Expand Down Expand Up @@ -775,14 +779,14 @@ $(SIGNATURES)
Compute the kinetic energy of a body with spatial inertia ``I``, which has
twist ``T`` with respect to an inertial frame.
"""
function kinetic_energy(I::SpatialInertia, twist::Twist)
@framecheck(I.frame, twist.frame)
function kinetic_energy(inertia::SpatialInertia, twist::Twist)
@framecheck(inertia.frame, twist.frame)
# TODO: should assert that twist.base is an inertial frame somehow
ω = twist.angular
v = twist.linear
J = I.moment
c = I.crossPart
m = I.mass
J = inertia.moment
c = inertia.crossPart
m = inertia.mass
(dot(ω, J * ω) + dot(v, m * v + 2 * cross(ω, c))) / 2
end

Expand Down

0 comments on commit cd58a54

Please sign in to comment.