-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
243 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Differentiation API | ||
```@meta | ||
CurrentModule = RobotDynamics | ||
``` | ||
RobotDynamics allows users to define different methods for obtaining derivatives of their | ||
functions. This is accomplished via the [`DiffMethod`](@ref) trait, which by default | ||
has three options: | ||
* `ForwardAD`: forward-mode automatic differentiation using | ||
[ForwardDiff.jl](https://github.com/JuliaDiff/ForwardDiff.jl) | ||
* `FiniteDifference`: finite difference approximation using | ||
[FiniteDiff.jl](https://github.com/JuliaDiff/FiniteDiff.jl) | ||
* `UserDefined`: analytical function defined by the user. | ||
|
||
Almost every Jacobian is queried using the same form: | ||
|
||
jacobian!(sig, diff, fun, J, y, z) | ||
|
||
where `sig` is a [`FunctionSignature`](@ref), `diff` is a [`DiffMethod`](@ref), `fun` is | ||
an [`AbstractFunction`](@ref), `J` is the Jacobian, `y` is a vector the size of the | ||
output of the function, and `z` is an [`AbstractKnotPoint`]. Users are free to add more | ||
[`DiffMethod`](@ref) types to dispatch on their own differentiation method. | ||
|
||
By default, no differentiation methods are provided for an [`AbstractFunction`](@ref), | ||
allowing the user to choose what methods they want defined, and to allow customization | ||
of the particular method to their function. However, we do provide the following macro | ||
to provide efficient implementations for `ForwardAD` and `FiniteDifference`: | ||
|
||
```@docs | ||
@autodiff | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# The Rotation State | ||
```@meta | ||
CurrentModule = RobotDynamics | ||
``` | ||
As mentioned in [AbstractFunction](@ref AbstractFunction), RobotDynamics can work | ||
with non-Euclidean state vectors, or state vectors whose composition rule is not | ||
simple addition. The most common example of non-Euclidean state vectors in robotics | ||
is that of 3D rotations. Frequently our state vectors include a 3D rotation together | ||
with normal Euclidean states such as position, linear or angular velocities, etc. | ||
The [`RotationState`](@ref) [`StateVectorType`](@ref) represents this type of state vector. | ||
In general, this represents a state vector of the following form: | ||
|
||
```math | ||
\begin{bmatrix} | ||
x_1 \\ | ||
q_1 \\ | ||
x_2 \\ | ||
q_2 \\ | ||
\vdots \\ | ||
x_{N-1} \\ | ||
q_N \\ | ||
x_N | ||
\end{bmatrix} | ||
``` | ||
where ``x_k \in \mathbb{R}^{n_k}`` and ``q_k \in SO(3)``. Any of the ``n_k`` can be zero. | ||
|
||
This state is described by the [`LieState`](@ref) struct: | ||
```@docs | ||
LieState | ||
QuatState | ||
``` | ||
|
||
## The `LieGroupModel` type | ||
To simplify the definition of models whose state vector is a [`RotationState`](@ref), we | ||
provide the abstract [`LieGroupModel`](@ref) type: | ||
|
||
```@docs | ||
LieGroupModel | ||
``` | ||
|
||
## Single rigid bodies | ||
A lot of robotic systems, such as airplanes, quadrotors, underwater vehicles, satellites, | ||
etc., can be described as a single rigid body subject to external forces and actuators. | ||
RobotDynamics provides the [`RigidBody`](@ref) model type for this type of system: | ||
|
||
```@docs | ||
RigidBody | ||
Base.position(::RBState) | ||
orientation | ||
linear_velocity | ||
angular_velocity | ||
build_state | ||
parse_state | ||
gen_inds | ||
flipquat | ||
``` | ||
|
||
## The `RBState` type | ||
When working with rigid bodies, the rotation can be represented a variety of methods and | ||
dealing with this ambiguity can be tedious. We provide the [`RBState`](@ref) type which | ||
represents a generic state for a rigid body, representing the orietation as a quaternion. | ||
It provides easy methods to convert to and from the state vector for a given `RigidBody{R}`. | ||
|
||
```@docs | ||
RBState | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Scalar Functions | ||
```@meta | ||
CurrentModule = RobotDynamics | ||
``` | ||
Instead of working with vector-valued functions like dynamics functions, we often need | ||
to define scalar functions that accept our state and control vectors, such as cost / | ||
objective / reward functions. This page provides the API for working with these | ||
types of functions, represented by the abstract [`ScalarFunction`](@ref) type, which | ||
is a specialization of an [`AbstractFunction`](@ref) with an output dimension of 1. | ||
|
||
```@docs | ||
ScalarFunction | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.