Skip to content

API Reference

This page lists the main APIs of Rible by functional module, auto-generated from docstrings.

Coordinates

Rible.add_joint_forces_jacobian! Function
julia
add_joint_forces_jacobian!(jacobian, coords, ...)

Get joint forces jacobian.

source
Rible.build_joint_cache Function
julia
build_joint_cache(coords, ...)

Build joint cache for coordinate system.

source
Rible.cartesian_frame2coords Method

Convert Cartesian frame to coordinates.

julia
cartesian_frame2coords(coords, frame) -> Tuple{Any, Any}
source
Rible.find_angular_velocity Method

Find angular velocity from coordinates and velocities.

julia
find_angular_velocity(coords, q, q̇) -> Any
source
Rible.find_independent_free_idx Method
julia
find_independent_free_idx(coords, ...)

Find independent free indices.

source
Rible.find_local_angular_velocity Method
julia
find_local_angular_velocity(coords, q, q̇)

Find local angular velocity from coordinates and velocities.

source
Rible.find_rotation Method

Find rotation matrix from coordinates.

julia
find_rotation(coords, q) -> Any
source
Rible.get_cstr_idx Method

Return the indices of intrinsic constraints for the given coordinates.

julia
get_cstr_idx(coords) -> Vector{Int64}
source
Rible.get_deform Method

Get deformation parameters.

julia
get_deform(coords) -> Any
source
Rible.get_joint_jacobian! Function
julia
get_joint_jacobian!(jacobian, coords, ...)

Get joint constraint jacobian.

source
Rible.get_joint_velocity_jacobian! Function
julia
get_joint_velocity_jacobian!(jacobian, coords, ...)

Get joint velocity jacobian.

source
Rible.get_joint_violations! Function
julia
get_joint_violations!(violations, coords, ...)

Get joint constraint violations.

source
Rible.get_num_of_local_dims Method

Return the number of local dimensions.

julia
get_num_of_local_dims(coords) -> Any
source
Rible.kinetic_energy_coords Function
julia
kinetic_energy_coords(coords, ...)

Calculate kinetic energy from coordinates.

source
Rible.nullspace_mat Method
julia
nullspace_mat(coords, ...)

Get nullspace matrix.

source
Rible.to_local_coords Method

Transform global coordinates to local coordinates.

julia
to_local_coords(coords, r̄) -> Any
source
Rible.to_position Method

Get position from coordinates and local parameters.

julia
to_position(coords, q, c) -> Any
source
Rible.to_position_jacobian Method

Get position Jacobian with respect to coordinates.

julia
to_position_jacobian(coords, q, c) -> Any
source
Rible.to_velocity_jacobian Method

Get velocity Jacobian with respect to coordinates and velocities.

julia
to_velocity_jacobian(coords, q, q̇, c) -> Any
source
Rible.CoordinatesState Type

Coordinates State Type.

julia
mutable struct CoordinatesState{T, qT, sT, pT, cT} <: Rible.AbstractCoordinatesState
source
Rible.PresFreeCoordinates Type

PresFreeCoordinates wrapper.

julia
struct PresFreeCoordinates{N, T} <: Rible.AbstractCoordinates{N, T}
source
Rible.PresFreeCoordinatesState Type

Nonminimal Coordinates State Type.

julia
mutable struct PresFreeCoordinatesState{T, qT, qviewT, pT, sT} <: Rible.AbstractCoordinatesState
source
Rible.get_free_idx Method

Return free indices of natural coordinates.

julia
get_free_idx(nmcs, pres_idx) -> Any
source
Rible.InnerContactCoordinatesState Type

ContactState Type.

julia
struct InnerContactCoordinatesState{S<:Rible.AbstractCoordinatesState, CT} <: Rible.AbstractCoordinatesState
source
Rible.MonoContactCoordinatesState Type

ContactState Type.

julia
struct MonoContactCoordinatesState{S<:Rible.AbstractCoordinatesState, CT} <: Rible.AbstractCoordinatesState
source
Rible.Anchor Type

Anchor — geometric attachment point for joints.

Holds the resolved position and axes for translation/rotation constraints, independent of loci indexing.

julia
struct Anchor{bodyType, posType, trlAxesType, rotAxesType}

  • body::Any: Body

  • position::Any: Position of the anchor in body-local frame

  • trl_axes::Any: Translational constraint axes

  • rot_axes::Any: Rotational constraint axes

source
Rible.Anchor Method
julia
Anchor(body, position, axes)

Direct geometry — same axes for translation and rotation.

source
Rible.Anchor Method
julia
Anchor(body, position_pid::Integer, axes_pid::Integer)

Resolve position and axes from potentially different loci.

source
Rible.Anchor Method
julia
Anchor(body, pid::Integer)

Construct from a single locus — position and axes all come from body.prop.loci[pid].

source
Rible.Anchor Method
julia
Anchor(sig::Signifier)

Bridge from a Signifier — resolve geometry from the locus it identifies.

source
Rible.Hen2Egg Type

Hen 2 Egg

julia
struct Hen2Egg{henType, eggType}

  • hen::Any: hen/parent/predecessor

  • egg::Any: egg/child/successor

source
Rible.Signifier Type

Signifier — identity of a measurement point on a body.

Used by gauges/capta to index into body.state.loci_states[pid].

julia
struct Signifier{bodyType}

  • body::Any: Signifier of body

  • pid::Int64: Index of the locus

source
Rible.skew Method
julia
skew(w::AbstractVector)

Return the skew-symmetric matrix (also known as cross product matrix) corresponding to the 3D vector w.

The skew-symmetric matrix S satisfies S*v = w × v for any vector v, where × denotes the cross product.

Arguments

  • w::AbstractVector: A 3D vector [w₁, w₂, w₃]

Returns

  • A 3×3 skew-symmetric matrix of the form:

    [  0  -w₃   w₂]
    [ w₃    0  -w₁]
    [-w₂   w₁    0]
source
Rible.swapcols! Method

Swap two columns

julia
swapcols!(X::AbstractMatrix, i::Integer, j::Integer)
source
Rible.swaprows! Method

Swap two rows

julia
swaprows!(X::AbstractMatrix, i::Integer, j::Integer)
source
Rible.cartesian_to_angular_velocity Method
julia
cartesian_to_angular_velocity(x, y, vx, vy)

Computes angular velocity ω = dθ/dt given Cartesian position and velocity. Assumes θ = atan(y, x). Formula: ω = (x_vy - y_vx) / (x^2 + y^2)

source
Rible.NCF.LNCData Type

Data for local natural coordinates.

julia
struct LNCData{N, M, T, L}
source
Rible.NCF.NC Type

Natural Coordinates

N: dimension of space M: local dimension of natural coordinates T: floating point type L: number of coordinates

julia
struct NC{N, M, T, L, NCOORDS, NCOORDS2} <: Rible.AbstractNonminimalCoordinates{N, T}
source
Rible.NCF.NC2D Type

2D Natural Coordinates.

julia
struct NC{2, M, T, L, NCOORDS, NCOORDS2} <: Rible.AbstractNonminimalCoordinates{2, T}
source
Rible.NCF.NC2D2C Type

2D 2-component (point-like) Natural Coordinates.

julia
struct NC{2, 0, T, 0, 2, 4} <: Rible.AbstractNonminimalCoordinates{2, T}
source
Rible.NCF.NC2D4C Type

2D 4-component (bar-like) Natural Coordinates.

julia
struct NC{2, 1, T, 2, 4, 16} <: Rible.AbstractNonminimalCoordinates{2, T}
source
Rible.NCF.NC2D6C Type

2D 6-component (rigid body) Natural Coordinates.

julia
struct NC{2, 2, T, 4, 6, 36} <: Rible.AbstractNonminimalCoordinates{2, T}
source
Rible.NCF.NC3D Type

3D Natural Coordinates.

julia
struct NC{3, M, T, L, NCOORDS, NCOORDS2} <: Rible.AbstractNonminimalCoordinates{3, T}
source
Rible.NCF.NC3D12C Type

3D 12-component (rigid body) Natural Coordinates.

julia
struct NC{3, 3, T, 9, 12, 144} <: Rible.AbstractNonminimalCoordinates{3, T}
source
Rible.NCF.NC3D3C Type

3D 3-component (point-like) Natural Coordinates.

julia
struct NC{3, 0, T, 0, 3, 9} <: Rible.AbstractNonminimalCoordinates{3, T}
source
Rible.NCF.NC3D6C Type

3D 6-component (bar-like) Natural Coordinates.

julia
struct NC{3, 1, T, 3, 6, 36} <: Rible.AbstractNonminimalCoordinates{3, T}
source
Rible.get_num_of_coords Method

Return the number of coordinates.

julia
get_num_of_coords(_::LNCData{N, M, T, L}) -> Any
source
Rible.get_num_of_dims Method

Return the dimension of space.

julia
get_num_of_dims(_::LNCData{N, M, T, L}) -> Any
source
Rible.get_num_of_dof Method

Return the number of degrees of freedom

julia
get_num_of_dof(nmcs::NC) -> Any
source
Rible.get_num_of_intrinsic_cstr Method

Return the number of constraints.

julia
get_num_of_intrinsic_cstr(
    _::NC{2, 0, T, 0, 2, 4} where T
) -> Int64
source
Rible.get_num_of_local_dims Method

Return local dimension of natural coordinates.

julia
get_num_of_local_dims(_::LNCData{N, M, T, L}) -> Any
source
Rible.NCF.NC1P2V Method

Return 2D rigid bodies natural coordinates, using 1 basic point and 2 base vectors.

julia
NC1P2V(ri::AbstractArray{T, 1}; ...) -> NC
NC1P2V(ri::AbstractArray{T, 1}, origin_position; ...) -> NC
NC1P2V(
    ri::AbstractArray{T, 1},
    origin_position,
    α;
    cstr_idx
) -> NC
source
Rible.NCF.NC1P3V Method

Return 3D rigid bodies natural coordinates, using 1 basic point and 3 base vectors

julia
NC1P3V(ri::AbstractArray{T, 1}; ...) -> NC
NC1P3V(ri::AbstractArray{T, 1}, origin_position; ...) -> NC
NC1P3V(
    ri::AbstractArray{T, 1},
    origin_position,
    R;
    cstr_idx
) -> NC
source
Rible.NCF.NC1P3V Method

Return 3D rigid bodies natural coordinates, using 1 basic point and 3 base vectors.

julia
NC1P3V(
    ri::AbstractArray{T, 1},
    u::AbstractArray{T, 1},
    v::AbstractArray{T, 1},
    w::AbstractArray{T, 1};
    ...
) -> NC
NC1P3V(
    ri::AbstractArray{T, 1},
    u::AbstractArray{T, 1},
    v::AbstractArray{T, 1},
    w::AbstractArray{T, 1},
    origin_position;
    ...
) -> NC
NC1P3V(
    ri::AbstractArray{T, 1},
    u::AbstractArray{T, 1},
    v::AbstractArray{T, 1},
    w::AbstractArray{T, 1},
    origin_position,
    R;
    cstr_idx
) -> NC
source
Rible.NCF.NC2D1P Method

Return 2D point mass natural coordinates.

julia
NC2D1P(ri::AbstractArray{T, 1}; cstr_idx) -> NC
source
Rible.NCF.NC2D1P1V Method

Return 2D rigid bar natural coordinates, using 1 basic point and 1 base vector.

julia
NC2D1P1V(
    ri::AbstractArray{T, 1},
    u::AbstractArray{T, 1};
    ...
) -> NC
NC2D1P1V(
    ri::AbstractArray{T, 1},
    u::AbstractArray{T, 1},
    origin_position;
    ...
) -> NC
NC2D1P1V(
    ri::AbstractArray{T, 1},
    u::AbstractArray{T, 1},
    origin_position,
    α;
    cstr_idx
) -> NC
source
Rible.NCF.NC2D2P Method

Return 2D rigid bar natural coordinates, starting from two points.

julia
NC2D2P(
    ri::AbstractArray{T, 1},
    rj::AbstractArray{T, 1};
    ...
) -> NC
NC2D2P(
    ri::AbstractArray{T, 1},
    rj::AbstractArray{T, 1},
    origin_position;
    ...
) -> NC
NC2D2P(
    ri::AbstractArray{T, 1},
    rj::AbstractArray{T, 1},
    origin_position,
    α;
    cstr_idx
) -> NC
source
Rible.NCF.NC2P1V Method

Return 2D rigid bodies natural coordinates, using 2 basic points and 1 base vector.

julia
NC2P1V(
    ri::AbstractArray{T, 1},
    rj::AbstractArray{T, 1};
    ...
) -> NC
NC2P1V(
    ri::AbstractArray{T, 1},
    rj::AbstractArray{T, 1},
    origin_position;
    ...
) -> NC
NC2P1V(
    ri::AbstractArray{T, 1},
    rj::AbstractArray{T, 1},
    origin_position,
    α;
    cstr_idx
) -> NC
source
Rible.NCF.NC2P2V Method

Return 3D rigid bodies natural coordinates, using 2 basic points and 2 base vectors.

julia
NC2P2V(
    ri::AbstractArray{T, 1},
    rj::AbstractArray{T, 1},
    v::AbstractArray{T, 1},
    w::AbstractArray{T, 1};
    ...
) -> NC
NC2P2V(
    ri::AbstractArray{T, 1},
    rj::AbstractArray{T, 1},
    v::AbstractArray{T, 1},
    w::AbstractArray{T, 1},
    origin_position;
    ...
) -> NC
NC2P2V(
    ri::AbstractArray{T, 1},
    rj::AbstractArray{T, 1},
    v::AbstractArray{T, 1},
    w::AbstractArray{T, 1},
    origin_position,
    R;
    cstr_idx
) -> NC
source
Rible.NCF.NC2P2V Method

Return 3D rigid bodies natural coordinates, using 2 basic points and 2 base vectors.

julia
NC2P2V(
    ri::AbstractArray{T, 1},
    rj::AbstractArray{T, 1};
    ...
) -> NC
NC2P2V(
    ri::AbstractArray{T, 1},
    rj::AbstractArray{T, 1},
    origin_position;
    ...
) -> NC
NC2P2V(
    ri::AbstractArray{T, 1},
    rj::AbstractArray{T, 1},
    origin_position,
    R;
    cstr_idx
) -> NC
source
Rible.NCF.NC3D1P Method

Return 3D point mass natural coordinates.

julia
NC3D1P(ri::AbstractArray{T, 1}; cstr_idx) -> NC
source
Rible.NCF.NC3D1P1V Method

Return 3D rigid bar natural coordinates.

julia
NC3D1P1V(
    ri::AbstractArray{T, 1},
    u::AbstractArray{T, 1};
    ...
) -> NC
NC3D1P1V(
    ri::AbstractArray{T, 1},
    u::AbstractArray{T, 1},
    origin_position;
    ...
) -> NC
NC3D1P1V(
    ri::AbstractArray{T, 1},
    u::AbstractArray{T, 1},
    origin_position,
    R;
    cstr_idx
) -> NC
source
Rible.NCF.NC3D2P Method

Return 3D rigid bar natural coordinates, starting from two points.

julia
NC3D2P(
    ri::AbstractArray{T, 1},
    rj::AbstractArray{T, 1};
    ...
) -> NC
NC3D2P(
    ri::AbstractArray{T, 1},
    rj::AbstractArray{T, 1},
    origin_position;
    ...
) -> NC
NC3D2P(
    ri::AbstractArray{T, 1},
    rj::AbstractArray{T, 1},
    origin_position,
    R;
    cstr_idx
) -> NC
source
Rible.NCF.NC3P Method

Return 2D rigid bodies natural coordinates, using 3 basic points

julia
NC3P(
    ri::AbstractArray{T, 1},
    rj::AbstractArray{T, 1},
    rk::AbstractArray{T, 1};
    ...
) -> NC
NC3P(
    ri::AbstractArray{T, 1},
    rj::AbstractArray{T, 1},
    rk::AbstractArray{T, 1},
    origin_position;
    ...
) -> NC
NC3P(
    ri::AbstractArray{T, 1},
    rj::AbstractArray{T, 1},
    rk::AbstractArray{T, 1},
    origin_position,
    α;
    cstr_idx
) -> NC
source
Rible.NCF.NC3P1V Method

Return 3D rigid bodies natural coordinates, using 3 basic points and 1 base vector.

julia
NC3P1V(
    ri::AbstractArray{T, 1},
    rj::AbstractArray{T, 1},
    rk::AbstractArray{T, 1};
    ...
) -> NC
NC3P1V(
    ri::AbstractArray{T, 1},
    rj::AbstractArray{T, 1},
    rk::AbstractArray{T, 1},
    origin_position;
    ...
) -> NC
NC3P1V(
    ri::AbstractArray{T, 1},
    rj::AbstractArray{T, 1},
    rk::AbstractArray{T, 1},
    origin_position,
    R;
    cstr_idx
) -> NC
source
Rible.NCF.NC4P Method

Return 3D rigid bodies natural coordinates, using 4 basic points

julia
NC4P(
    ri::AbstractArray{T, 1},
    rj::AbstractArray{T, 1},
    rk::AbstractArray{T, 1},
    rl::AbstractArray{T, 1};
    ...
) -> NC
NC4P(
    ri::AbstractArray{T, 1},
    rj::AbstractArray{T, 1},
    rk::AbstractArray{T, 1},
    rl::AbstractArray{T, 1},
    origin_position;
    ...
) -> NC
NC4P(
    ri::AbstractArray{T, 1},
    rj::AbstractArray{T, 1},
    rk::AbstractArray{T, 1},
    rl::AbstractArray{T, 1},
    origin_position,
    R;
    cstr_idx
) -> NC
source
Rible.NCF.get_conversion_core Method

!!!!!!!!!

julia
get_conversion_core(np, nv) -> Matrix{Int64}
source
Rible.NCF.get_conversion_to_std Method

!!!!!!!!!

julia
get_conversion_to_std(ndim, np, nv) -> Any
source
Rible.cartesian_frame2coords Method

Return rigid body natural coordinates

julia
cartesian_frame2coords(
    nmcs::Union{NC2D2C, NC3D3C, NC2D{0, T, 0, 2, 4} where T, NC3D{0, T, 0, 3, 9} where T},
    origin_frame
) -> Tuple{Any, Any}
source
Rible.to_local_coords Method

Return transformation matrix。

julia
to_local_coords(nmcs::NC, r̄) -> Any
source
Rible.NCF.make_∂Aq̇∂q_forwarddiff Method

Return the ForwardDiff results for ∂Aq̇∂q

julia
make_∂Aq̇∂q_forwarddiff(
    Φq,
    nq,

) -> Rible.NCF.var"#∂Aq̇∂q#make_∂Aq̇∂q_forwarddiff##0"
source
Rible.cstr_function! Function

Return 2D or 3D intrinsic cstr(s) for point mass.

julia
cstr_function!(
    ret,
    nmcs::Union{NC2D2C, NC3D3C, NC2D{0, T, 0, 2, 4} where T, NC3D{0, T, 0, 3, 9} where T},
    q::AbstractVector
)
cstr_function!(
    ret,
    nmcs::Union{NC2D2C, NC3D3C, NC2D{0, T, 0, 2, 4} where T, NC3D{0, T, 0, 3, 9} where T},
    q::AbstractVector,
    deforms
)
source
Rible.cstr_function! Method

Return 2D or 3D intrinsic cstr(s) for rigid bars.

julia
cstr_function!(
    ret::AbstractArray{T, 1},
    nmcs::NC{2, 1, T, 2, 4, 16},
    q::AbstractArray{T, 1}
) -> Any
cstr_function!(
    ret::AbstractArray{T, 1},
    nmcs::NC{2, 1, T, 2, 4, 16},
    q::AbstractArray{T, 1},
    d::StaticArraysCore.SArray{Tuple{1}, T, 1, 1}
) -> Any
source
Rible.cstr_function! Method

Return 2D intrinsic cstr(s) , for rigid bodies.

julia
cstr_function!(
    ret::AbstractArray{T, 1},
    nmcs::NC{2, 2, T, 4, 6, 36} where T,
    q::AbstractArray{T, 1}
) -> Any
cstr_function!(
    ret::AbstractArray{T, 1},
    nmcs::NC{2, 2, T, 4, 6, 36} where T,
    q::AbstractArray{T, 1},
    d::StaticArraysCore.SArray{Tuple{3}, T, 1, 3}
) -> Any
source
Rible.cstr_function! Method

Return 3D intrinsic cstr(s) , for rigid bodies.

julia
cstr_function!(
    ret::AbstractArray{T, 1},
    nmcs::NC{3, 3, T, 9, 12, 144} where T,
    q::AbstractArray{T, 1}
) -> Any
cstr_function!(
    ret::AbstractArray{T, 1},
    nmcs::NC{3, 3, T, 9, 12, 144} where T,
    q::AbstractArray{T, 1},
    d::StaticArraysCore.SArray{Tuple{6}, T, 1, 6}
) -> Any
source
Rible.cstr_jacobian! Method

Return 2D or 3D Jacobian matrix for point mass.

julia
cstr_jacobian!(
    ret,
    nmcs::Union{NC2D2C, NC3D3C, NC2D{0, T, 0, 2, 4} where T, NC3D{0, T, 0, 3, 9} where T},
    jac,
    q::AbstractVector
)
source
Rible.cstr_jacobian! Method

Return 2D or 3D Jacobian matrix for rigid bars.

julia
cstr_jacobian!(
    ret::AbstractArray{T, 2},
    nmcs::NC{2, 1, T, 2, 4, 16},
    jac::AbstractArray{T, 2},
    q::AbstractArray{T, 1}
) -> AbstractMatrix
source
Rible.cstr_jacobian! Method

Return 2D Jacobian matrix , for rigid bodies.

julia
cstr_jacobian!(
    ret::AbstractArray{T, 2},
    nmcs::NC{2, 2, T, 4, 6, 36} where T,
    jac::AbstractArray{T, 2},
    q::AbstractArray{T, 1}
) -> AbstractMatrix
source
Rible.cstr_jacobian! Method

Return 2D or 3D Jacobian matrix for rigid bars.

julia
cstr_jacobian!(
    ret::AbstractArray{T, 2},
    nmcs::NC{3, 1, T, 3, 6, 36},
    jac::AbstractArray{T, 2},
    q::AbstractArray{T, 1}
) -> AbstractMatrix
source
Rible.cstr_jacobian! Method

Return 3D Jacobian matrix , for rigid bodies.

julia
cstr_jacobian!(
    ret::AbstractArray{T, 2},
    nmcs::NC{3, 3, T, 9, 12, 144} where T,
    jac::AbstractArray{T, 2},
    q::AbstractArray{T, 1}
) -> AbstractMatrix
source
Rible.nullspace_mat Method

Return nullspace matrix

julia
nullspace_mat(nmcs::NC{2, 1, T, 2, 4, 16} where T, q) -> Any
source

Bodies

Rible.AbstractBody Type

Abstract interface for bodies.

source
Rible.AbstractBodyCache Type

Abstract interface for body caches.

source
Rible.AbstractBodyProperty Type

Abstract interface for body properties.

source
Rible.AbstractBodyState Type

Abstract interface for body states.

julia
abstract type AbstractBodyState{N, T}
source
Rible.AbstractFeaturizer Type
julia
AbstractFeaturizer

Transforms the extracted state x into a feature vector φ.

source
Rible.AbstractParamFun Type
julia
AbstractParamFun

Maps features φ to control actions u.

source
Rible.AbstractStateExtractor Type
julia
AbstractStateExtractor

Extracts specific quantities of interest (x) from the robot state.

source
Rible.AbstractTimeBasis Type
julia
AbstractTimeBasis

Abstract type for time-dependent basis functions.

source
Rible.InertiaCache Type

Inertia cache for storing mass matrices and related quantities.

julia
mutable struct InertiaCache{MType, JType, GType}
source
Rible.add_cstr_forces_jacobian! Function
julia
add_cstr_forces_jacobian!(ret, coords, λ)

Get constraint forces jacobian.

source
Rible.apply_field! Function
julia
apply_field!(F, body, field, q)

Apply field forces to the body.

source
Rible.clear_forces! Function
julia
clear_forces!(body)

Clear all forces and torques on the body.

source
Rible.cstr_forces_jacobian Function
julia
cstr_forces_jacobian(coords, λ)

Get constraint forces jacobian.

source
Rible.cstr_forces_jacobian! Function
julia
cstr_forces_jacobian!(ret, coords, λ)

Get constraint forces jacobian.

source
Rible.cstr_function Function
julia
cstr_function(coords, q, d)

Evaluate constraint functions.

source
Rible.cstr_function! Function
julia
cstr_function(ret, coords, q, d)

Evaluate constraint functions.

source
Rible.cstr_hessians Function
julia
cstr_hessians(coords)

Get constraint hessians.

source
Rible.cstr_jacobian Function
julia
cstr_jacobian(coords, q)

Evaluate constraint jacobian.

source
Rible.cstr_jacobian! Function
julia
cstr_jacobian!(ret, coords, q)

Evaluate constraint jacobian.

source
Rible.cstr_velocity_jacobian Function
julia
cstr_velocity_jacobian(coords, q̇)

Get constraint velocity jacobian.

source
Rible.cstr_velocity_jacobian! Function
julia
cstr_velocity_jacobian!(ret, coords, q̇)

Get constraint velocity jacobian.

source
Rible.field_jacobian! Function
julia
field_jacobian!(∂F̌∂q̌, body, field, q)

Calculate field force jacobian.

source
Rible.get_num_of_coords Function
julia
get_num_of_coords(coords)

Return the total number of coordinates.

source
Rible.get_num_of_cstr Function
julia
get_num_of_cstr(coords)

Return the number of constraints.

source
Rible.get_num_of_dims Function
julia
get_num_of_dims(coords)

Return the spatial dimension of the coordinate system.

source
Rible.get_num_of_dof Function
julia
get_num_of_dof(coords)

Return the number of degrees of freedom.

source
Rible.get_num_of_intrinsic_cstr Function
julia
get_num_of_intrinsic_cstr(coords)

Return the number of intrinsic constraints.

source
Rible.has_constant_mass_matrix Function

Check if coordinate system has constant mass matrix.

source
Rible.make_cstr_function Function
julia
make_cstr_function(coords, ...)

Make constraint function.

source
Rible.make_cstr_jacobian Function
julia
make_cstr_jacobian(coords, ...)

Make constraint jacobian.

source
Rible.reset! Function
julia
reset!(body)

Reset body state including contact states.

source
Rible.RigidBody Type

Rigid Body Type

julia
struct RigidBody{N, M, T, L, coordsType, cacheType, meshType} <: Rible.AbstractRigidBody{N, T}

  • prop::RigidBodyProperty: Rigid Body Property

  • state::RigidBodyState: Rigid Body State

  • coords::Any: Coordinates State

  • cache::Any: Cache

  • mesh::Any: Rigid Body Mesh

source
Rible.RigidBodyCache Type

Rigid Body Cache Type.

julia
struct RigidBodyCache{CType, cacheType, jacType} <: Rible.AbstractBodyCache

  • Co::Any

  • Cg::Any

  • Cps::Vector

  • inertia_cache::Any

  • jac_cache::Any

source
Rible.RigidBodyProperty Type

Rigid Body Property Type

julia
struct RigidBodyProperty{N, T, L} <: Rible.AbstractRigidBodyProperty{N, T}

  • contactable::Bool: Is able to make contact with?

  • visible::Bool: Is visible?

  • id::Int64: id. Unique in a system

  • type::Symbol: Type or name.

  • mass::Any: Mass

  • inertia::StaticArraysCore.SMatrix{N, N} where N: Inertia

  • mass_locus::Locus: Centroid in local frame

  • loci::Array{Locus{N, T, L}, 1} where {N, T, L}: Anchor points in local frame

source
Rible.RigidBodyProperty Method

Rigid Body Property Constructor

julia
RigidBodyProperty(
    id::Integer,
    contactable::Bool,
    mass,
    inertia_input,
    mass_locus::Locus{N, T, L};
    ...
) -> RigidBodyProperty
RigidBodyProperty(
    id::Integer,
    contactable::Bool,
    mass,
    inertia_input,
    mass_locus::Locus{N, T, L},
    loci::Vector{<:Locus};
    visible,
    type
) -> RigidBodyProperty
source
Rible.RigidBodyState Type

Rigid Body State Mutable Type.

julia
mutable struct RigidBodyState{N, M, T, L} <: Rible.AbstractRigidBodyState{N, T}

  • origin_frame::Rible.CartesianFrame: Origin of local frame

  • mass_locus_state::Rible.LocusState: Position of mass center in global frame

  • loci_states::Array{Rible.LocusState{N, M, T, L}, 1} where {N, M, T, L}: Positions of anchor points in global frame

source
Rible.RigidBodyState Method

Rigid Body State Constructor

julia
RigidBodyState(
    prop::RigidBodyProperty{N, T},
    origin_position_input,
    rotation_input,
    origin_velocity_input,
    angular_velocity_input
) -> RigidBodyState

source
Rible.body_state2coords_state Function
julia
body_state2coords_state(state, coords)

Convert body state to coordinate state.

source
Rible.get_inertia Function
julia
get_inertia(body)

Get inertia tensor of the body.

source
Rible.get_mass Function
julia
get_mass(body)

Get mass of the body.

source
Rible.kinetic_energy Function
julia
kinetic_energy(body, inst_state)

Calculate kinetic energy of the body.

source
Rible.lazy_update_state! Function
julia
lazy_update_state!(state, coords, cache, prop, inst_state)

Update only position and velocity (lazy update).

source
Rible.potential_energy_field Function
julia
potential_energy_field(body, field, inst_state)

Calculate potential energy from field.

source
Rible.potential_energy_strain Function
julia
potential_energy_strain(body)

Calculate strain potential energy.

source
Rible.strain! Function
julia
strain!(F, prop, coords, state, cache)

Calculate strain from body state.

source
Rible.stretch_loci! Function
julia
stretch_loci!(coords, cache, prop, inst_state)

Update transformation matrices from deformation parameters.

source
Rible.update_inertia_cache! Function
julia
update_inertia_cache!(cache, coords, prop, inst_state)

Update inertia-related cache.

source
Rible.update_loci_states! Function
julia
update_loci_states!(state, coords, cache, prop, inst_state)

Update loci states using cached transformation matrices.

source
Rible.update_state! Function
julia
update_state!(state, coords, cache, prop, inst_state)

Update full state including rotation and angular velocity.

source
Rible.update_transformations! Function
julia
update_transformations!(coords, cache, state, prop, inst_state)

Update transformation matrices from coordinates.

source
Rible.clear_forces! Method

Clear Rigid Body Forces and torques.

julia
clear_forces!(body::Rible.AbstractRigidBody) -> Any
source
Rible.kinetic_energy Method

Return Rigid Body kinetic energy.

julia
kinetic_energy(body::Rible.AbstractRigidBody{2, T}) -> Any
source
Rible.kinetic_energy Method

Return Rigid Body kinetic energy.

julia
kinetic_energy(body::Rible.AbstractRigidBody{3, T}) -> Any
source
Rible.potential_energy_field Method

Return Rigid Body gravity potential energy.

julia
potential_energy_field(
    body::RigidBody,
    field::Rible.Gravity,
    q
) -> Any
source
Rible.potential_energy_strain Method

Return Rigid Body Strain potential energy.

julia
potential_energy_strain(
    body::Rible.AbstractRigidBody
) -> Any
source

Structure, Constraints, and Connectivity

Rible.get_accels Method

Return system generalized accelerations.

julia
get_accels(st::Rible.AbstractStructure) -> Any
source
Rible.get_auxiliary Method

Return system auxiliary variables.

julia
get_auxiliary(st::Rible.AbstractStructure) -> Any
source
Rible.get_coords Method

Return system generalized coordinates.

julia
get_coords(st::Rible.AbstractStructure) -> Any
source
Rible.get_d Method

Return the violation vector (deformations or joint violations) for the entire structure.

julia
get_d(st::Rible.AbstractStructure) -> Any
source
Rible.get_free_accels Method

Return system free accelerations.

julia
get_free_accels(st::Rible.AbstractStructure) -> Any
source
Rible.get_free_coords Method

Return system free coordinates.

julia
get_free_coords(st::Rible.AbstractStructure) -> Any
source
Rible.get_free_velocs Method

Return system free velocities.

julia
get_free_velocs(st::Rible.AbstractStructure) -> Any
source
Rible.get_gravity Method

Return gravity

julia
get_gravity(st::Rible.AbstractStructure) -> Any
source
Rible.get_initial Method

Return the initial state of the structure, including coordinates, velocities, and parameters.

julia
get_initial(st::Rible.AbstractStructure)
source
Rible.get_multipliers Method

Return system Lagrange multipliers.

julia
get_multipliers(st::Rible.AbstractStructure) -> Any
source
Rible.get_num_of_cstr Method

Return the system's number of constraints.

julia
get_num_of_cstr(st::Rible.AbstractStructure) -> Any
source
Rible.get_num_of_dims Method

Return System dimensions

julia
get_num_of_dims(st::Rible.AbstractStructure) -> Any
source
Rible.get_params Method

Build the system parameters vector from bodies and apparatuses.

julia
get_params(
    bodies,
    appars,
    cnt::Rible.AbstractConnectivity
) -> Any
source
Rible.get_params Method

Get the parameters of a specific locus (identified by body ID and locus ID) from the structure.

julia
get_params(st::Rible.AbstractStructure, bodyid, pid) -> Any
source
Rible.get_params Method

Return system parameters (e.g., loci coordinates).

julia
get_params(st::Rible.AbstractStructure) -> Any
source
Rible.get_pres_accels Method

Return system prescribed accelerations.

julia
get_pres_accels(st::Rible.AbstractStructure) -> Any
source
Rible.get_pres_coords Method

Return system prescribed coordinates.

julia
get_pres_coords(st::Rible.AbstractStructure) -> Any
source
Rible.get_pres_velocs Method

Return system prescribed velocities.

julia
get_pres_velocs(st::Rible.AbstractStructure) -> Any
source
Rible.get_velocs Method

Return system generalized velocities.

julia
get_velocs(st::Rible.AbstractStructure) -> Any
source
Rible.Structure Type

Structure Type.

julia
struct Structure{BodyType, TenType, CntType, StateType, CRType, CacheType} <: Rible.AbstractStructure{BodyType, TenType, CntType}
source
Rible.Structure Method

Structure Constructor.

julia
Structure(
    bodies,
    apparatuses,
    cnt::Rible.AbstractConnectivity
) -> Structure{_A, _B, CntType, StateType, CRType, CacheType} where {_A, _B, CntType<:Union{Connectivity, Rible.PresFreeConnectivity}, StateType<:Union{Rible.StructureState{sysT, msT} where {sysT<:CoordinatesState, msT<:(Vector)}, Rible.StructureState{sysT, msT} where {sysT<:Rible.PresFreeCoordinatesState, msT<:(Vector)}}, CRType<:(NamedTuple{(:activated_bits, :persistent_bits, :friction_coefficients, :restitution_coefficients, :gaps), <:Tuple{BitVector, BitVector, Any, Any, Vector}}), CacheType<:Union{Rible.StructureCache{InertiaCache{MType, JType, SparseArrays.SparseMatrixCSC{Float64, Int64}}} where {MType<:(SparseArrays.SparseMatrixCSC{Tv, Int64} where Tv), JType<:(SparseArrays.SparseMatrixCSC{Tv, Int64} where Tv)}, Rible.StructureCache{InertiaCache{MType, JType, GType}} where {MType<:(SparseArrays.SparseMatrixCSC{Tv, Int64} where Tv), JType<:(SparseArrays.SparseMatrixCSC{Tv, Int64} where Tv), GType<:(SparseArrays.SparseVector{Tv, Int64} where Tv)}}}
source
Rible.StructureState Type

StructureState Type.

julia
struct StructureState{sysT, msT} <: Rible.AbstractStructureState
source
Rible.StructureState Method

State Constructor.

julia
StructureState(
    bodies,
    apparatuses,
    cnt::Connectivity
) -> Rible.StructureState{sysT, msT} where {sysT<:CoordinatesState, msT<:(Vector)}
source
Rible.VizStructure Type

VizStructure Type.

julia
struct VizStructure{BodyType, TenType, CntType, StateType, CacheType} <: Rible.AbstractStructure{BodyType, TenType, CntType}
source
Rible.check_jacobian_singularity Method

check constraints jacobian singularity

julia
check_jacobian_singularity(
    st::Rible.AbstractStructure
) -> Any
source
Rible.kinetic_energy Method

Return System Kinetic energy

julia
kinetic_energy(st::Rible.AbstractStructure) -> Any
source
Rible.mechanical_energy Function

Return System mechanical_energy

julia
mechanical_energy(
    st::Rible.AbstractStructure
) -> NamedTuple{(:T, :V, :E), <:Tuple{Any, Any, Any}}
mechanical_energy(
    st::Rible.AbstractStructure,
    field
) -> NamedTuple{(:T, :V, :E), <:Tuple{Any, Any, Any}}
source
Rible.potential_energy_field Function

Return System potential energy

julia
potential_energy_field(st::Rible.AbstractStructure) -> Any
potential_energy_field(
    st::Rible.AbstractStructure,
    field
) -> Any
source
Rible.Connectivity Type

Constructor for the standard Connectivity type.

julia
Connectivity(
    bodies;
    ...
) -> Connectivity{Vector{Vector{Int64}}}
Connectivity(
    bodies,
    apparatuses;
    sharing_matrix
) -> Connectivity{Vector{Vector{Int64}}}
source
Rible.Connectivity Type

Standard Rigid Body Connectivity Type.

julia
struct Connectivity{id2idxType} <: Rible.AbstractConnectivity
  • num_of_bodies::Int64

  • num_of_apparatuses::Int64

  • num_of_joint_apparatuses::Int64

  • num_of_force_apparatuses::Int64

  • num_of_full_coords::Int64

  • num_of_intrinsic_cstr::Int64

  • num_of_extrinsic_cstr::Int64

  • num_of_cstr::Int64

  • num_of_dof_unconstrained::Int64

  • num_of_dof::Int64

  • num_of_aux_var::Int64

  • sys_full_coords_idx::Vector{Int64}

  • bodyid2sys_full_coords::Any

  • bodyid2sys_intrinsic_cstr_idx::Any

  • bodyid2sys_dof_idx::Any

  • apparid2sys_extrinsic_cstr_idx::Any

  • apparid2sys_aux_var_idx::Any

  • bodyid2sys_locus_id::Vector{Vector{Int64}}: body's loci' idx to System's loci' idx

  • sys_locus_id2sig::Vector{Signifier{Int64}}: System's loci' idx to Signifier

  • sys_locus_id2coords_idx::Vector{Vector{Int64}}: System's loci' idx to System's loci' coords' idx

  • bodyid2sys_loci_coords_idx::Vector{Vector{Int64}}: body's loci' idx to System's loci' coords' idx

  • num_of_sys_loci::Int64: Number of the System's loci

  • num_of_sys_loci_coords::Int64: Number of the System's loci' coords

  • num_of_body_params::Int64

  • num_of_appar_params::Int64

  • num_of_params::Int64

  • apparid2params_idx::Vector{Vector{Int64}}

  • apparid2sys_full_coords_idx::Vector{Vector{Int64}}

source
Rible.build_mass_matrices Method

Return System mass matrices

julia
build_mass_matrices(
    structure::Rible.AbstractStructure
) -> NamedTuple{(:M, :M⁻¹, :M̌, :M̌⁻¹, :Ḿ, :M̄), <:NTuple{6, Any}}
source
Rible.find_nullspace Method
julia
find_nullspace(c) -> Any
source
Rible.gen_force_para_jacobian! Function
julia
gen_force_para_jacobian!(∂Q∂c,appar::Apparatus,st,q,q̇,t, s=nothing)

Compute the Jacobian of the generalized force w.r.t. the structual parameters.

source
Rible.auxi_function! Method

Compute and store the auxiliary variables of the entire structure into ret.

julia
auxi_function!(
    ret,
    structure::Rible.AbstractStructure,
    inst_state::Rible.AbstractCoordinatesState
)
source
Rible.auxi_function Method

Return the auxiliary variables of the entire structure.

julia
auxi_function(
    structure::Rible.AbstractStructure,
    inst_state::Rible.AbstractCoordinatesState
) -> Any
source
Rible.auxi_jacobian! Method

Compute and store the Jacobian matrices of the structure's auxiliary function.

julia
auxi_jacobian!(
    ∂S∂q,
    ∂S∂s,
    structure::Rible.AbstractStructure,
    inst_state::Rible.AbstractCoordinatesState
) -> Any
source
Rible.auxi_jacobian! Method
julia
auxi_jacobian!(
    ∂S∂q,
    ∂S∂s,
    appar::Rible.Apparatus,
    cnt::Rible.AbstractConnectivity,
    q,
    s
) -> Any

Compute and store the Jacobian matrices w.r.t. the free coordinates and auxiliary variables of the auxiliary function of an apparatus.

Arguments

  • ∂S∂q: Output matrix for partial derivatives w.r.t. free coordinates

  • ∂S∂s: Output matrix for partial derivatives w.r.t. auxiliary variables

  • appar: The apparatus

  • structure: The mechanical structure

  • q: Current generalized coordinates

  • s: Current auxiliary variables

source
Rible.switch! Method
julia
switch!(st::AbstractStructure, inst_state::AbstractCoordinatesState)

Switch the representation of a structure's apparatuses based on the current configuration q and auxiliary variables s.

The representation include the auxilary functions and hyper parameters of the apparatuses, but does not include the state of the apparatuses.

This function is usually used to prepare the structure for the next time step.

Arguments

  • st::AbstractStructure: The structure to update

  • q: Current configuration coordinates

  • s: Current auxiliary variables

source
Rible.switch! Method
julia
switch!(appar::Apparatus, structure::AbstractStructure, q, s)

Switch the representation of an apparatus based on the current configuration q and auxiliary variables s.

The representation include the auxilary functions and hyper parameters of the apparatuses, but does not include the state of the apparatuses.

This function is usually used to prepare the structure for the next time step.

Arguments

  • appar::Apparatus: The apparatus to update

  • structure::AbstractStructure: The parent structure

  • q: Current configuration coordinates

  • s: Current auxiliary variables for this apparatus

source
Rible.apply_field! Method
julia
apply_field!(
    structure::Rible.AbstractStructure,
    field::Rible.AbstractField
) -> Any
source
Rible.assemble_forces! Method
julia
assemble_forces!(structure::Rible.AbstractStructure) -> Any
source
Rible.field_jacobian! Method
julia
field_jacobian!(
    ∂F∂q,
    structure::Rible.AbstractStructure,
    field::Rible.AbstractField
) -> Any
source
Rible.update_apparatuses! Method

Update apparatuses of a structure

julia
update_apparatuses!(
    structure::Rible.AbstractStructure,
    s::AbstractArray{T, 1}
) -> Any
source
Rible.PresFreeConnectivity Type

Constructor for the PresFreeConnectivity type.

julia
PresFreeConnectivity(
    bodies;
    ...
) -> Rible.PresFreeConnectivity{Vector{Int64}, Vector{Vector{Int64}}}
PresFreeConnectivity(
    bodies,
    apparatuses;
    sharing_matrix
) -> Rible.PresFreeConnectivity{Vector{Int64}, Vector{Vector{Int64}}}
source
Rible.PresFreeConnectivity Type

Prescribed-Free Rigid Body Connectivity Type.

julia
struct PresFreeConnectivity{idxType, id2idxType} <: Rible.AbstractConnectivity
  • num_of_bodies::Int64

  • num_of_apparatuses::Int64

  • num_of_joint_apparatuses::Int64

  • num_of_force_apparatuses::Int64

  • num_of_full_coords::Int64

  • num_of_free_coords::Int64

  • num_of_pres_coords::Int64

  • num_of_intrinsic_cstr::Int64

  • num_of_extrinsic_cstr::Int64

  • num_of_cstr::Int64

  • num_of_dof_unconstrained::Int64

  • num_of_dof::Int64

  • num_of_aux_var::Int64

  • sys_free_coords_idx::Any

  • sys_pres_coords_idx::Any

  • bodyid2sys_full_coords::Any

  • bodyid2sys_free_coords::Any

  • bodyid2sys_pres_coords::Any

  • bodyid2sys_intrinsic_cstr_idx::Any

  • bodyid2sys_dof_idx::Any

  • apparid2sys_extrinsic_cstr_idx::Any

  • apparid2sys_full_coords_idx::Any

  • apparid2sys_aux_var_idx::Any

  • bodyid2sys_locus_id::Vector{Vector{Int64}}: body's loci' idx to System's loci' idx

  • sys_locus_id2sig::Vector{Signifier{Int64}}: System's loci' idx to Signifier

  • sys_locus_id2coords_idx::Vector{Vector{Int64}}: System's loci' idx to System's loci' coords' idx

  • bodyid2sys_loci_coords_idx::Vector{Vector{Int64}}: body's loci' idx to System's loci' coords' idx

  • num_of_sys_loci::Int64: Number of the System's loci

  • num_of_sys_loci_coords::Int64: Number of the System's loci' coords

  • num_of_body_params::Int64

  • num_of_appar_params::Int64

  • num_of_params::Int64

  • apparid2params_idx::Vector{Vector{Int64}}

source
Rible.StructureState Method

Build a StructureState from bodies, apparatuses, and a PresFreeConnectivity.

julia
StructureState(
    bodies,
    apparatuses,
    cnt::Rible.PresFreeConnectivity
) -> Rible.StructureState{sysT, msT} where {sysT<:Rible.PresFreeCoordinatesState, msT<:(Vector)}
source

Force Elements, Joints, and Generalized Forces

Rible.proto_joint_apparatus Method

A prototype joint is defined for a Hen2Egg.

Translation uses either the axis on Hen or on Egg.

Rotation uses the axis on Egg, because the local angular velocity is defined relative to Egg.

The order of translation and rotation matters!

julia
proto_joint_apparatus(
    id,
    hen2egg,
    force,
    joint_type::Symbol
) -> Rible.Apparatus{jointType, forceType, cacheType} where {jointType<:(Rible.PrototypeJoint{_A, Vector{Int64}, _B, cacheType} where {_A, _B, cacheType<:(NamedTuple{(:relative_core, :transformations, :halves, :hessians, :joint_q, :joint_work, :trf_work, :num_of_coords_hen, :num_of_coords_egg), <:Tuple{Any, Any, Vector, Vector, Any, Any, Vector, Any, Any}})}), forceType<:Rible.AbstractForce, cacheType<:(Rible.ApparatusCache{_A, AType, _B, FType, _C, _D, _E, cacheType} where {_A, AType<:(SparseArrays.SparseMatrixCSC{Tv, Int64} where Tv), _B, FType<:(SparseArrays.SparseMatrixCSC{Tv, Int64} where Tv), _C, _D, _E, cacheType<:(NamedTuple{(:J, :DJ), <:Tuple{Any, Any}})})}
source
Rible.DistanceSpringDamper Type
julia
struct DistanceSpringDamper{N, T} <: Rible.AbstractForce
source
Rible.DistanceSpringDamperState Type
julia
mutable struct DistanceSpringDamperState{N, T}
source
Rible.DistanceSpringDamperState Method
julia
DistanceSpringDamperState(
    restlen,
    direction
) -> Rible.DistanceSpringDamperState
source
Rible.TorsionalSpringDamper Type
julia
struct TorsionalSpringDamper{T} <: Rible.AbstractForce
source
Rible.TorsionalSpringDamper Method
julia
TorsionalSpringDamper(
    rest_angle,
    k;
    ...
) -> Rible.TorsionalSpringDamper
TorsionalSpringDamper(
    rest_angle,
    k,
    c;
    slack
) -> Rible.TorsionalSpringDamper

Create a torsional spring damper with specified rest angle, stiffness k, and optional damping coefficient c.

Arguments

  • rest_angle::T: The rest angle of the spring in radians

  • k::T: Spring stiffness coefficient

  • c=zero(k): Optional damping coefficient, defaults to 0

  • slack=false: If true, spring only generates torque when angle > rest_angle

Returns

  • TorsionalSpringDamper: A torsional spring damper force element
source
Rible.TorsionalSpringDamperState Type
julia
mutable struct TorsionalSpringDamperState{T}
source
Rible.TorsionalSpringDamperState Method
julia
TorsionalSpringDamperState(
    rest_angle
) -> Rible.TorsionalSpringDamperState{T} where T<:Real
source
Rible.DistanceSpringDamper2D Method
julia
DistanceSpringDamper2D(
    restlen,
    k;
    ...
) -> Rible.DistanceSpringDamper
DistanceSpringDamper2D(
    restlen,
    k,
    c;
    slack
) -> Rible.DistanceSpringDamper
source
Rible.DistanceSpringDamper3D Method
julia
DistanceSpringDamper3D(
    restlen,
    k;
    ...
) -> Rible.DistanceSpringDamper
DistanceSpringDamper3D(
    restlen,
    k,
    c;
    slack
) -> Rible.DistanceSpringDamper
source
Rible.potential_energy Method
julia
potential_energy(cab::Rible.DistanceSpringDamper) -> Any
source
Rible.potential_energy Method
julia
potential_energy(sd::Rible.TorsionalSpringDamper) -> Any
source
Rible.update! Function
julia
update!(sd::Rible.TorsionalSpringDamper, angle) -> Any
update!(
    sd::Rible.TorsionalSpringDamper,
    angle,
    angular_velocity
) -> Any
source
Rible.update! Method
julia
update!(
    cab::Rible.DistanceSpringDamper,
    p1,
    p2,
    ṗ1,
    ṗ2
) -> Any
source
Rible.BodyJoint Type

Joint that represents the body's own degrees of freedom (unconstrained).

julia
struct BodyJoint{T, bodyType} <: Rible.AbstractJoint
  • num_of_cstr::Int64

  • body::Any

source
Rible.BodyJoint Method
julia
BodyJoint(body) -> BodyJoint
source
Rible.FixedPointJoint Type

Joint that fixes a point on a body in space.

julia
struct FixedPointJoint{T, N, bodyType} <: Rible.AbstractJoint
  • body::Any

  • num_of_cstr::Int64

  • A::Matrix

  • r̄o::StaticArraysCore.SVector{N, T} where {T, N}

  • ro::StaticArraysCore.SVector{N, T} where {T, N}

source
Rible.LinearJoint Type

Linear constraint joint.

julia
struct LinearJoint{T, bodyType} <: Rible.AbstractJoint
  • body::Any

  • num_of_cstr::Int64

  • A::Matrix

  • violations::Vector

source
Rible.LinearJoint Method
julia
LinearJoint(body, A, violations) -> Rible.LinearJoint
source
Rible.PrototypeJoint Type

Generic joint prototype used for standard joint types.

julia
struct PrototypeJoint{hen2eggType, maskType, valueType, cacheType, posType} <: Rible.AbstractJoint
  • hen2egg::Any

  • num_of_cstr::Int64

  • num_of_dof::Int64

  • mask_1st::Any

  • mask_2nd::Any

  • mask_3rd::Any

  • mask_4th::Any

  • violations::Any

  • cache::Any

  • loci_position_hen::Any

  • loci_position_egg::Any

source
Rible.gen_force! Method
julia
gen_force!(inst_state::AbstractCoordinatesState, bot::Robot, field::AbstractField, policy::AbstractPolicy, ; )

Assembles the total generalized force vector F acting on the robot given the configuration encoded by inst_state (q, , t, possibly s), the robot model bot, policy, and external field.

This method performs the following steps, in order:

  1. Clears all internal force accumulators on the structure.

  2. Applies actuation/controls according to policy and inst_state.

  3. Updates body kinematics from the current state.

  4. Updates any auxiliary apparatuses (possibly parameterized by s).

  5. Applies the external field to the structure (e.g., gravity, magnetics).

  6. Assembles all forces and stores the result in F.

All operations are done in-place. The result in inst_state.F reflects the total forces resulting from both internal (structural, actuation) and external (field) contributions.

Arguments

  • inst_state: Pre-allocated CoordinatesState to store the force output.

  • bot: Robot model containing structure and actuation.

  • field: External field object (e.g., gravity, electromagnetics).

  • policy: Actuation or control policy.

  • (optional keyword arguments to pass through.)

Example

julia
gen_force!(inst_state, bot, field, mypolicy, )

Afterwards, inst_state.F will contain the total generalized forces for the system at this state.

source
Rible.gen_force_jacobian! Function
julia
jacobian of generalized force with respect to state (q, q̇) and control (u)

This is for adjoint dynamics.

source
Rible.gen_force_state_jacobian! Function
julia
jacobian of generalized force with respect to state (q, q̇

This is for forward dynamics.

source
Rible.check_stability Method
julia
check_stability(st::Rible.AbstractStructure; F̌, verbose)
source

Environment and Contact

Control — Policies, Actuators, Gauges, Costs

Rible.DiscreteFeedbackPolicy Type

A discrete modular feedback policy structure.

julia
struct DiscreteFeedbackPolicy{E<:Rible.AbstractStateExtractor, F<:Rible.AbstractFeaturizer, P<:Rible.AbstractParamFun} <: Rible.FeedbackDiscretePolicy
  • extractor::Rible.AbstractStateExtractor

  • featurizer::Rible.AbstractFeaturizer

  • paramfun::Rible.AbstractParamFun

source
Rible.FeedbackPolicy Type

A modular feedback policy structure.

julia
struct FeedbackPolicy{E<:Rible.AbstractStateExtractor, F<:Rible.AbstractFeaturizer, P<:Rible.AbstractParamFun} <: Rible.FeedbackDiscretePolicy
  • extractor::Rible.AbstractStateExtractor

  • featurizer::Rible.AbstractFeaturizer

  • paramfun::Rible.AbstractParamFun

source
Rible.GaugesExtractor Type

Extracts state by measuring from gauges defined in bot.hub.gauges, weighted by gauges_weights. Follows the same pattern as Objective.

julia
struct GaugesExtractor{W<:(AbstractVector)} <: Rible.AbstractStateExtractor
  • gauges_weights::AbstractVector

Example

julia
# Assuming bot.hub has 3 gauges defined
extractor = GaugesExtractor([1.0, 0.0, 1.0])  # use gauges 1 and 3

# All gauges with equal weight
extractor = GaugesExtractor(ones(3))

Note

The gauges themselves are defined in bot.hub.gauges (same as used by Objective).

source
Rible.IdentityFeaturizer Type

Passes x through unchanged.

julia
struct IdentityFeaturizer <: Rible.AbstractFeaturizer
source
Rible.TimeFunctionPolicy Type

Policy that evaluates a time-dependent function f(t).

julia
struct TimeFunctionPolicy{F<:Function} <: Rible.AbstractTimePolicy
  • f::Function
source
Rible.evaluate_paramfun Function

Return control action u from feature vector ϕ.

source
Rible.extract Method
julia
extract(extractor, bot::Robot, )

Returns the state of interest x.

source
Rible.extract Method
julia
extract(extractor, bot::Robot)

Extract state from robot at a specific instantaneous state.

source
Rible.extract_jacobian Method
julia
extract_jacobian(extractor, bot::Robot)

Compute the Jacobian of the extracted state with respect to (q, q̇). Returns (∂x/∂q, ∂x/∂q̇) where x is the extracted state.

Uses the same indexing pattern as extract: each gauge's Jacobian rows are placed at indices given by captum_gauge_id2sys_capta_idx[gauge.id].

source
Rible.features Method

Return feature vector ϕ from state x.

julia
features(featurizer, x) -> Any
source
Rible.ApproxFunBasis Type
julia
ApproxFunBasis{S} <: AbstractTimeBasis

A wrapper for ApproxFun.jl spaces. The dimension of the basis is determined by order (number of coefficients).

source
Rible.BSplineBasis Type
julia
BSplineBasis{T, B}

A basis using B-splines defined by a knot vector, wrapping BSplineKit. Uses a single reusable cache to avoid allocations.

source
Rible.BasisOpenLoop Type
julia
BasisOpenLoop{B <: AbstractTimeBasis, T}

A generic open-loop policy that computes control actions as a linear combination of time basis functions.

u(t) = weights * basis_features(basis, t)

Fields

  • weights::Matrix{T}: Weights matrix where each row corresponds to an actuator/DOF and each column corresponds to a basis function.

  • basis::B: The time basis object.

source
Rible.basis_dimension Method
julia
basis_dimension(basis::AbstractTimeBasis)

Returns the number of basis functions (dimension of the feature vector).

source
Rible.basis_features Method
julia
basis_features(basis::AbstractTimeBasis, t)

Returns a vector of basis function values at time t.

source
Rible.LinearParamFun Type

Linear parameter function: u = W φ + b.

julia
struct LinearParamFun{T} <: Rible.AbstractParamFun
  • weights::Matrix

  • bias::Vector

source
Rible.LinearFeedbackPolicy Method
julia
LinearFeedbackPolicy(K, k=zeros(...); extractor, featurizer)

Convenience constructor returning a FeedbackPolicy configured with LinearParamFun (u = K * x + k). No dedicated wrapper struct is used; dispatch relies on the field types of FeedbackPolicy.

source
Rible.gen_force_state_jacobian! Method
julia
gen_force_state_jacobian!(∂F∂q̌, ∂F∂q̌̇, ∂F∂u, policy::LFPolicy, bot::Robot, inst_state)

Compute generalized force Jacobian F(q,q̇,u(q,q̇)) for a given policy. This function updates the provided matrices ∂F∂q̌ and ∂F∂q̌̇ in place. Formula: ∂F∂q̌ = ∂F∂q̌ + ∂F∂u * ∂u∂q̌ ∂F∂q̌̇ = ∂F∂q̌̇ + ∂F∂u * ∂u∂q̌̇

This function concerns only the latter part of the formula: ∂F∂u * ∂u∂q̌ and ∂F∂u * ∂u∂q̌̇

source
Rible.vjp_wrt_state Method
julia
vjp_wrt_state(v, policy::LFPolicy, bot::Robot, num_of_actions, solver, solver_state)

Vector-Jacobian product for reverse-mode differentiation using capta gauges.

source
Rible.PDParamFun Type
julia
PDParamFun{T}

PD control parametric function: u = K(x_des - x)

This is equivalent to the linear form u = -K_x + b where b = K_x_des, but with structured parameterization that separates the gain matrix K and the reference/setpoint x_des.

Fields

  • K::Matrix{T}: Gain matrix (action_dim × state_dim)

  • x::Vector{T}: Reference/desired state (state_dim,)

Control Law

u = K * (x_des - x_measured)

Parameters

The parameters are [vec(K); x], giving a bilinear parameterization where the bias term b = K*x_des couples the gain and reference.

Notes

  • This is a structured but over-parameterized version of LinearParamFun

  • Parameters are nonlinearly related: changing K affects how x_des influences u

  • Useful when you want to separate gain tuning from setpoint adjustment

source
Rible.ProportionalDerivativePolicy Method
julia
ProportionalDerivativePolicy(K, x_des; extractor, featurizer)

Convenience constructor that returns a FeedbackPolicy configured as a PD controller using PDParamFun. The control law is u = K(x_des - x).

This is equivalent to the linear form u = -K_x + b where b = K_x_des, but with structured parameterization [K, x_des] instead of [K, b].

source
Rible.gen_force_state_jacobian! Method
julia
gen_force_state_jacobian!(∂F∂q, ∂F∂q̇, ∂F∂u, policy::PDFeedbackPolicy, bot::Robot, inst_state)

Compute generalized force Jacobian F(q,q̇,u(q,q̇)) for PD policy.

For u = K(x_des - x) = -K_x + K_x_des: ∂F/∂q̌ += ∂F/∂u · (-K · ∂x/∂q̌) ∂F/∂q̌̇ += ∂F/∂u · (-K · ∂x/∂q̌̇)

source
Rible.vjp_wrt_state Method
julia
vjp_wrt_state(v, policy::PDFeedbackPolicy, bot::Robot, num_of_actions, solver, solver_state)

Vector-Jacobian product for reverse-mode differentiation using capta gauges.

For PD control u = K(x_des - x), the VJP computes v'·∂u/∂z for all parameters z.

source
Rible.DiscreteLFPolicy Type

Alias for dispatch on linear-feedback-configured policies.

julia
struct DiscreteFeedbackPolicy{var"#s799"<:Rible.AbstractStateExtractor, var"#s798"<:Rible.AbstractFeaturizer, var"#s797"<:Rible.LinearParamFun} <: Rible.FeedbackDiscretePolicy
source
Rible.DiscreteLinearFeedbackPolicy Method
julia
DiscreteLinearFeedbackPolicy(K, k=zeros(...); extractor, featurizer)

Convenience constructor returning a DiscreteFeedbackPolicy configured with LinearParamFun (u = K * x + k). No dedicated wrapper struct is used; dispatch relies on the field types of DiscreteFeedbackPolicy.

source
Rible.actuate! Method

Execute the control actions on the robot's apparatuses.

julia
actuate!(
    bot::Robot,
    policy::Rible.DiscreteFeedbackPolicy{<:Rible.AbstractStateExtractor, <:Rible.AbstractFeaturizer, <:Rible.LinearParamFun},
    inst_state::Rible.AbstractCoordinatesState
) -> Any
source
Rible.control! Method

Compute the control actions and store them in the robot's hub state.

julia
control!(
    bot::Robot,
    policy::Rible.DiscreteFeedbackPolicy{<:Rible.AbstractStateExtractor, <:Rible.AbstractFeaturizer, <:Rible.LinearParamFun},
    solver_cache,
    solver_state
) -> Any
source
Rible.control_jacobian! Method
julia
control_jacobian!(bot, policy::DiscreteLFPolicy, ...)

For discrete time policy u = u(qₖ).

source
Rible.gen_force_state_jacobian! Method
julia
gen_force_state_jacobian!(∂F∂q, ∂F∂q̇, ∂F∂u, policy::DiscreteLFPolicy, bot::Robot, inst_state)

Zero out gradients because control is fixed w.r.t integration variables q_mid or q_{k+1}.

source
Rible.vjp_wrt_state Method
julia
vjp_wrt_state(v, policy::DiscreteLFPolicy, bot::Robot, num_of_actions, solver_cache, solver_state)

Vector-Jacobian product for reverse-mode differentiation using discrete q_k.

source
Rible.DiscretePDPolicy Type

Local alias for PD-configured feedback policies.

julia
struct DiscreteFeedbackPolicy{var"#s799"<:Rible.AbstractStateExtractor, var"#s798"<:Rible.AbstractFeaturizer, var"#s797"<:Rible.PDParamFun} <: Rible.FeedbackDiscretePolicy
source
Rible.DiscreteProportionalDerivativePolicy Method
julia
DiscreteProportionalDerivativePolicy(K, x_des; extractor, featurizer)

Convenience constructor that returns a DiscreteFeedbackPolicy configured as a PD controller using PDParamFun. The control law is u = K(x_des - x).

This is equivalent to the linear form u = -K_x + b where b = K_x_des, but with structured parameterization [K, x_des] instead of [K, b].

source
Rible.actuate! Method

Execute the control actions on the robot's apparatuses.

julia
actuate!(
    bot::Robot,
    policy::Rible.DiscreteFeedbackPolicy{<:Rible.AbstractStateExtractor, <:Rible.AbstractFeaturizer, <:Rible.PDParamFun},
    inst_state::Rible.AbstractCoordinatesState
) -> Any
source
Rible.control! Method

Compute the control actions and store them in the robot's hub state.

julia
control!(
    bot::Robot,
    policy::Rible.DiscreteFeedbackPolicy{<:Rible.AbstractStateExtractor, <:Rible.AbstractFeaturizer, <:Rible.PDParamFun},
    solver_cache,
    solver_state
) -> Any
source
Rible.control_jacobian! Method
julia
control_jacobian!(bot, policy::DiscretePDPolicy, ...)

For discrete time policy u = u(qₖ). We compute ∂C∂qₖ and ∂C∂pₖ. ∂u/∂qₖ₊₁ = 0.

source
Rible.gen_force_state_jacobian! Method
julia
gen_force_state_jacobian!(∂F∂q, ∂F∂q̇, ∂F∂u, policy::DiscretePDPolicy, bot::Robot, inst_state)

Zero out gradients because control is fixed w.r.t integration variables q_mid or q_{k+1}.

source
Rible.vjp_wrt_state Method
julia
vjp_wrt_state(v, policy::DiscretePDPolicy, bot::Robot, num_of_actions, solver_cache, solver_state)

Vector-Jacobian product for reverse-mode differentiation. u = K(x_des - x(qₖ))

source
Rible.control! Method
julia
control!(bot::Robot,policy,state::ComponentArray)

For policy that acts directly on discrete solver's discretized states (e.g. iLQR)

source
Rible.control_jacobian! Method
julia
control_jacobian!(workspace,bot::Robot,policy,solver_cache,solver_state)

Jacobian of the control function w.r.t. the discrete solver's discretized states. For policy that acts directly on discrete solver's discretized states (e.g. iLQR)

source
Rible.RegisterActuator Type
julia
struct RegisterActuator{sigType, opType, regType} <: Rible.AbstractActuator

Actuator that operates on a register of values, such as the original rest lengths of cables.

Fields

  • id::Int: Unique identifier for the actuator

  • signifier::sigType: The signifier type, typically representing what the actuator acts upon

  • operator::opType: The operator type, defining how the actuator operates

  • register::regType: The register containing values to be manipulated

Methods

  • get_num_of_actions(actuator::RegisterActuator): Returns the number of actions available

  • get_initial_actions(structure::AbstractStructure, actuator::RegisterActuator): Returns a vector of zeros representing possible actions

  • execute!(structure::AbstractStructure, actuator::RegisterActuator, u): Executes the actuator's action on the structure

This actuator type is designed to work with a register of values, allowing for manipulation of multiple elements simultaneously based on the provided actions.

source
Rible.execute! Method
julia
execute!(structure::AbstractStructure,actuator,u)

Execute the actuator on the structure with the provided actions u.

source
Rible.gen_force_actu_jacobian! Method
julia
gen_force_actu_jacobian!(∂F∂u, structure::AbstractStructure,actuator,u)

Compute and store in ∂F∂u the Jacobian of the generalized force with respect to the actuator's actions, with the provided actions u.

source
Rible.get_initial_actions Method
julia
get_initial_actions(structure::AbstractStructure,actuator)

Return a vector of actions on the structure by the actuator.

source
Rible.get_num_of_actions Method
julia
get_num_of_actions(::AbstractActuator)

Return the number of actions available for the actuator.

source
Rible.measure Method
julia
measure(structure::AbstractStructure,gauge::CaptumGauge)

Return the measurement of the captum gauge.

source
Rible.measure Method
julia
measure(structure::AbstractStructure,err_gau::ErrorGauge{sigType,captumType,<:AbstractVector}) where {sigType,captumType}

Return the measurement of the error as deviation of the captum from the reference.

source
Rible.measure_gradient! Method
julia
measure_jacobian!(∂g∂q,∂g∂q̇,∂g∂s,structure::AbstractStructure,err_gau::ErrorGauge)

Compute the gradient of the error function w.r.t. the coordinates and velocities of the structure.

source
Rible.measure_hessians! Method
julia
measure_hessians!(∂²g∂q²,∂²g∂q̇²,∂²g∂q̇∂q,structure::AbstractStructure,err_gau::ErrorGauge)

Compute the Hessian of the error function w.r.t. the coordinates and velocities of the structure.

source
Rible.FullStateCaptum Type
julia
FullStateCaptum

A captum that measures the full system state [q; v] (generalized coordinates and velocities). Unlike other Captum types which measure from a specific signifier (body + locus), this captum measures system-level quantities.

source
Rible.compute_com_position_jacobian Method
julia
compute_com_position_jacobian(structure::AbstractStructure)

Compute the Jacobian matrix B that maps generalized coordinates to center of mass position. For constant mass system: r_com = B*q, where B = (1/M_total) * Σ m_i * J_i J_i is the position Jacobian of body i's center of mass.

source
Rible.measure Method
julia
measure(structure::AbstractStructure, signifier, captum::CoMPosVelCaptum)

Measure center of mass position and velocity for constant mass system: [r; v] = [B_q; B_q̇]

source
Rible.measure Method
julia
measure(structure::AbstractStructure, signifier, captum::CoMPositionCaptum)

Measure center of mass position for constant mass system: r = B*q where B maps generalized coordinates to center of mass position.

source
Rible.measure Method
julia
measure(structure::AbstractStructure, signifier, captum::CoMVelocityCaptum)

Measure center of mass velocity for constant mass system: v = B*q̇ where B maps generalized velocities to center of mass velocity.

source
Rible.measure Method
julia
measure(structure::AbstractStructure,signifier::Signifier,captum)

Return the measurement of the captum on the signifier.

source
Rible.measure_hessians Method
julia
measure_hessians(structure::AbstractStructure, signifier, captum::CoMPosVelCaptum)

Return Hessians for center of mass position and velocity (all zeros since both are linear).

source
Rible.measure_hessians Method
julia
measure_hessians(structure::AbstractStructure, signifier, captum::CoMPositionCaptum)

Return Hessians for center of mass position (all zeros since r = B*q is linear).

source
Rible.measure_hessians Method
julia
measure_hessians(structure::AbstractStructure, signifier, captum::CoMVelocityCaptum)

Return Hessians for center of mass velocity (all zeros since v = B*q̇ is linear).

source
Rible.measure_hessians Method
julia
measure_hessians(structure::AbstractStructure,signifier::Signifier,captum)

Return the Hessian of the captum's measurement w.r.t. the signifier's coordinates and velocities.

source
Rible.measure_jacobian! Method
julia
measure_jacobian(structure::AbstractStructure,signifier::Signifier,captum)

Return the Jacobian of the captum's measurement w.r.t. the signifier's coordinates and velocities.

source
Rible.cost! Method
julia
cost!(bot::Robot, objt::AbstractObjective, inst_state::AbstractCoordinatesState, u; mode=:trajectory)

Compute the cost for a robot system given the current state and control input at a single time point.

Arguments

  • bot::Robot: The robot system

  • objt::AbstractObjective: The objective function containing weights for gauges and actuators

  • inst_state::AbstractCoordinatesState: Instantaneous state of the robot system

  • u: Control inputs

  • mode::Symbol: Cost mode (:trajectory or :terminal) for weights

Returns

The computed cost value

source
Rible.cost_gradient! Method
julia
cost_gradient!(bot::Robot, policy::AbstractPolicy, objt::AbstractObjective, field::AbstractField=NoField(); mode=:trajectory)

Compute the gradient of the cost function with respect to the robot's current state variables, control inputs, and parameters.

Arguments

  • bot::Robot: The robot system

  • policy::AbstractPolicy: The control policy

  • objt::AbstractObjective: The objective function

  • field::AbstractField: The field applied to the system (default: NoField())

  • mode::Symbol: The mode of operation (:trajectory or :terminal)

Returns

A tuple containing the gradients with respect to:

  • ∂ϕ∂qᵀ: Generalized coordinates

  • ∂ϕ∂q̇ᵀ: Generalized velocities

  • ∂ϕ∂pᵀ: Generalized momenta

  • ∂ϕ∂uᵀ: Control inputs

  • ∂ϕ∂θᵀ: Policy parameters

  • ∂ϕ∂cᵀ: System parameters

source
Rible.cost_hessian! Method
julia
cost_hessian!(hessian::CostHessian, bot::Robot, policy::AbstractPolicy, env::AbstractEnvironment, objt::AbstractObjective, inst_state::AbstractCoordinatesState, u)

Compute the Hessian of the cost function w.r.t. the coordinates q and p for a given robot bot at time t. This function updates the provided matrices in hessian in place.

source

Dynamics Solvers and Sensitivity Analysis

Rible.DynamicsProblem Type

Dynamics Problem definition.

julia
struct DynamicsProblem{RobotType, policyType, envType, objtType, contact_modelType, apparatus_modelType, optionsType} <: Rible.AbstractDynamicsProblem
  • bot::Any

  • policy::Any

  • env::Any

  • objt::Any

  • contact_model::Any

  • apparatus_model::Any

  • options::Any

source
Rible.DynamicsProblem Method
julia
DynamicsProblem(bot::Robot;
    env=GravityEnv(),
    policy=NoPolicy(),
    contact_model=Contactless(),
    apparatus_model=Naive(),
    kwargs...
)

Construct a dynamics problem for the given robot.

Arguments

  • bot::Robot: the robot model (required, positional)

  • env: environment model (default: GravityEnv())

  • policy: control policy (default: NoPolicy())

  • contact_model: contact model (default: Contactless())

  • apparatus_model: apparatus model (default: Naive())

  • kwargs...: additional options forwarded to the solver

Examples

julia
prob = DynamicsProblem(bot)
prob = DynamicsProblem(bot; env=GravityEnv(), contact_model=Zhong06())
prob = DynamicsProblem(bot; policy=my_policy, apparatus_model=my_apparatus)
source
Rible.DynamicsSolver Type

Standard Dynamics Solver.

julia
struct DynamicsSolver{integratorType, body_solverType, apparatus_solverType, contact_solverType, optionsType} <: Rible.AbstractDynamicsSolver
  • integrator::Any

  • body_solver::Any

  • apparatus_solver::Any

  • contact_solver::Any

  • options::Any

source
Rible.Objective Type

Objective function parameters for dynamics problems.

julia
struct Objective{weightsType, ηtype<:Function} <: Rible.AbstractObjective
  • trajectory_error_gauges_weights::Any

  • trajectory_actuators_weights::Any

  • terminal_error_gauges_weights::Any

  • terminal_actuators_weights::Any

  • η::Function: weight of the trajectory cost as a function of time

source
Rible.SimulationResult Type

Result of a simulation.

julia
struct SimulationResult{simType, cacheType}
  • simulator::Any

  • solver_cache::Any

source
Rible.Simulator Type

Simulator for running dynamics problems.

julia
mutable struct Simulator{probType, ctrlType, T, dataType}
  • prob::Any

  • controller::Any

  • tspan::Tuple{T, T} where T

  • restart::Bool

  • totalstep::Int64

  • solver_history::Rible.SolverHistory

  • convergence::Bool

source
Rible.generate_cache Method
julia
generate_cache(
    simulator::Simulator,
    solver::AbstractDynamicsSolver;
    dt,kwargs...
)

Generate cache for the solver, dispatch based on constant mass matrix trait.

source
Rible.solve! Method
julia
solve!(prob::AbstractDynamicsProblem,solver::AdjointDynamicsSensitivitySolver;
    prescribe! = (state, structure) -> nothing,
    tspan,dt,restart=true,kwargs...
)

Solve the dynamics problem with the adjoint solver, return the simulation result.

source
Rible.solve! Method
julia
solve!(prob::AbstractDynamicsProblem,solver::AbstractDynamicsSolver;
    prescribe! = (state, structure) -> nothing,
    tspan,dt,restart=true,kwargs...
)

Solve the dynamics problem with the solver, return the simulation result.

source
Rible.solve! Method
julia
solve!(simulator::Simulator,solver::AbstractDynamicsSolver;karg...)

Solve the simulator with the solver, return the solver cache.

source
Rible.ContactVariables Type

Contact-specific variables for predictor-corrector method.

julia
struct ContactVariables{T, VT, SVT, SAT}
  • Λ::Any

  • Γ::Any

  • Λ_split::Any

  • Γ_split::Any

  • Λp::Any

  • Γp::Any

  • Λp_split::Any

  • Γp_split::Any

  • Δxp::Any

  • ΔΛp::Any

  • ΔΓp::Any

  • ΔΛp_split::Any

  • ΔΓp_split::Any

  • Δxc::Any

  • ΔΛc::Any

  • ΔΓc::Any

  • ΔΛc_split::Any

  • ΔΓc_split::Any

  • 𝐞_split::Array{StaticArraysCore.SVector{3, T}, 1} where T

  • J::LinearAlgebra.Diagonal{T, StaticArraysCore.SVector{3, T}} where T

source
Rible.CostGradientHessianWorkspace Type

Workspace for storing cost gradients and Hessians.

julia
struct CostGradientHessianWorkspace{VT, MT}
  • ∂ϕ∂xᵀ::Any

  • gradient::Rible.CostGradient

  • ∂ϕ∂xᵀ∂x::Any

  • hessian::Rible.CostHessian

source
Rible.NewtonWorkspace Type

Workspace for Newton iteration variables.

julia
struct NewtonWorkspace{VT, MT}
  • x::Any

  • Res::Any

  • Jac::Any

  • Δx::Any

  • JacΔx::Any

  • xₖ::Any

  • 𝐰::Any

  • ∂Γ∂x::Any

  • lu_tmp::Any

  • ipiv::Vector{Int64}

source
Rible.Zhong06Constants Type

Constants for Jacobian computation.

julia
struct Zhong06Constants{T}
  • h::Any

  • mass_norm::Any

  • nq::Int64

  • nq̌::Int64

  • nλ::Int64

  • nu::Int64

  • nc::Int64

  • nθ::Int64

  • ns::Int64

  • n1::Int64

  • n2::Int64

  • n3::Int64

source
Rible.Zhong06JacobianBlocks Type

Jacobian blocks for the system at time k+1.

julia
struct Zhong06JacobianBlocks{MatType, BackupMatType, CMatType}
  • Jacᵏ⁺¹ₖ₊₁::Any

  • Jacᵏ⁺¹ₖ::Any

  • Jacᵏ⁺¹ₖ_backup::Any

  • Jacᵏ⁺¹ₘu::Any

  • Jacᵏ⁺¹ₘc::Any

source
Rible.Zhong06JacobianWorkspace Type

Workspace for Jacobian computations - contains all intermediate matrices needed. Unified workspace used by Primal, Adjoint, and Direct sensitivity solvers.

julia
struct Zhong06JacobianWorkspace{T}
  • Fₘ::Vector

  • ∂F∂q::Matrix

  • ∂F∂q̇::Matrix

  • ∂Fₘ∂u::Matrix

  • ∂Fₘ∂c::Matrix

  • ∂F∂s::Matrix

  • ∂C∂qₖ::Matrix

  • ∂C∂pₖ::Matrix

  • ∂C∂sₖ::Matrix

  • ∂C∂qₖ₊₁::Matrix

  • ∂C∂pₖ₊₁::Matrix

  • Mₘ::SparseArrays.SparseMatrixCSC{T, Int64} where T

  • M⁻¹ₘ::SparseArrays.SparseMatrixCSC{T, Int64} where T

  • ∂Mₘhq̇ₘ∂qₘ::SparseArrays.SparseMatrixCSC{T, Int64} where T

  • M::SparseArrays.SparseMatrixCSC{T, Int64} where T

  • Ḿ::SparseArrays.SparseMatrixCSC{T, Int64} where T

  • M̌::SparseArrays.SparseMatrixCSC{T, Int64} where T

  • M̄::SparseArrays.SparseMatrixCSC{T, Int64} where T

  • M̌⁻¹::SparseArrays.SparseMatrixCSC{T, Int64} where T

  • Aₖ₊₁::Matrix

  • Aₖ::Matrix

  • ∂Aᵀλ∂q::Matrix

  • ϕbuf::Vector

  • ∂S∂q::Matrix

  • ∂S∂s::Matrix

  • ∂ϕ∂qᵀ::Vector

  • ∂ϕ∂q̇ᵀ::Vector

  • ∂ϕ∂pᵀ::Vector

  • ∂ϕ∂uᵀ::Vector

  • ∂ϕ∂sᵀ::Vector

  • ∂ϕf∂qᵀ::Vector

  • ∂ϕf∂q̇ᵀ::Vector

  • ∂ϕf∂pᵀ::Vector

  • ∂ϕf∂uᵀ::Vector

  • ∂ϕf∂sᵀ::Vector

  • cost_∂g∂q::Matrix

  • cost_∂g∂q̇::Matrix

  • cost_∂g∂s::Matrix

  • cost_∂g∂u::Matrix

  • cost_tmp_vec::Vector

  • gauge_workspaces::Array{Rible.GaugeWorkspace{T}, 1} where T

source
Rible.Zhong06SolverState Type

Unified solver state containing all trajectory information needed for Jacobian computation.

julia
struct Zhong06SolverState{InstStateType, T}
  • state_k::Any

  • state_kp1::Any

  • state_mid::Any

  • dt::Any

source
Rible.default_linear_solver! Method

Linear solver that uses the analytic Jacobian.

Expected signature for custom solvers: linear_solver!(ws::NewtonWorkspace, solver_state, solver_cache, bot, policy, env)

source
Rible.finite_diff_linear_solver! Method

Linear solver that builds the Jacobian with finite differences of the residual.

residual_func! must populate ws.Res using the values in ws.x.

source
Rible._compute_contact_jacobian_blocks! Method

Compute contact-related Jacobian blocks.

This function adds the contribution from frictional contacts to the Jacobian.

source
Rible.compute_primal_jacobian! Method

Compute Jacobian for primal Newton solver at timestep k+1.

Key difference from adjoint/direct: pₖ₊₁ = pₖ₊₁(qₖ₊₁, λₘ) is not independent, so we use chain rule: ∂vₖ₊₁/∂qₖ₊₁ = (∂vₖ₊₁/∂pₖ₊₁) * (∂pₖ₊₁/∂qₖ₊₁).

source
Rible.compute_primal_residual! Method

Compute residual for primal Newton solver at timestep k+1.

Note: This uses a reduced state vector [qₖ₊₁, λₘ, Λ, Γ] where pₖ₊₁ is computed from qₖ₊₁ via the momentum relation, unlike the adjoint/direct solvers which treat p as an independent variable.

source
Rible.create_line_search_functions Method

Create line search functions (ϕ, dϕ, ϕdϕ) with shared setup for efficient evaluation.

Returns a tuple of three closures:

  • ϕ(β): merit function ϕ(β) = 0.5 * ||Res(x + β*Δx)||²

  • dϕ(β): derivative dϕ(β)/dβ

  • ϕdϕ(β): both merit and derivative (for efficiency)

All three functions share the same temporary workspace setup to avoid redundant allocations.

source
Rible.compute_centering_parameter Method

Compute centering parameter σ and corrector residual

source
Rible.compute_predictor_step Method

Compute predictor step in predictor-corrector interior point method.

julia
compute_predictor_step(
    contact_vars::Rible.ContactVariables,
    na
) -> Tuple{Any, Any}
source
Rible.compute_timestep_sensitivities! Method

Compute direct sensitivities after convergence at timestep.

Computes:

  • Jacobian w.r.t. state at k: ∂x_{k+1}/∂x_k

  • Jacobian w.r.t. action: ∂x_{k+1}/∂u_

  • Jacobian w.r.t. control parameters: ∂x_{k+1}/∂θ

  • Cost gradients and Hessians w.r.t. state and action

source
Rible.newton_iteration_with_contact! Method

Perform single Newton iteration with predictor-corrector for contact case (na > 0)

Note: contact_vars.Δxp should already be computed before calling this function

source
Rible.compute_adjoint_step! Method

Compute adjoint step: Jacobians, cost gradients, VJP, and solve for adjoint variables. Returns updated adjoint variable yₖ and parameter gradients.

source

Robot and Post-processing

Rible.Robot Type

Robot Type Constructor.

julia
Robot(
    structure
) -> Robot{stType, hubType, _A, contacts_trajType, contact_caches_trajType} where {stType<:Rible.AbstractStructure, hubType<:(ControlHub{Vector{Int64}, Vector{Int64}, Vector{Int64}, Coalition, NamedTuple{(:c, :e, :u), var"#s179"}} where var"#s179"<:Tuple{Any, Any, Any}), _A, contacts_trajType<:(Vector), contact_caches_trajType<:(Vector{T} where T<:(NamedTuple{(:na, :bodyid2act_idx, :persistent_idx, :activated_bits, :H, :activated_restitution_coefficients, :D, :Dper, :Dimp, :∂Dq̇∂q, :∂DᵀΛ∂q, :ŕ, :L, :Lv, :Λ, :Γ), <:Tuple{Any, Any, Vector{Int64}, Vararg{Any, 13}}}))}
Robot(
    structure,
    hub
) -> Robot{_A, _B, _C, contacts_trajType, contact_caches_trajType} where {_A, _B, _C, contacts_trajType<:(Vector), contact_caches_trajType<:(Vector{T} where T<:(NamedTuple{(:na, :bodyid2act_idx, :persistent_idx, :activated_bits, :H, :activated_restitution_coefficients, :D, :Dper, :Dimp, :∂Dq̇∂q, :∂DᵀΛ∂q, :ŕ, :L, :Lv, :Λ, :Γ), <:Tuple{Any, Any, Vector{Int64}, Vararg{Any, 13}}}))}
source
Rible.Robot Type

Robot Type.

julia
struct Robot{stType, hubType, trajType, contacts_trajType, contact_caches_trajType, control_trajType}
source
Rible.goto_step! Method

Update System State to specific step.

julia
goto_step!(bot::Robot, that_step; policy) -> Robot
source
Rible.reset! Method

Reset System State.

julia
reset!(bot::Robot) -> Any
source
Rible.set_initial! Function

Set new nitial conditions.

julia
set_initial!(bot::Robot, q, q̇) -> Any
set_initial!(bot::Robot, q, q̇, s) -> Any
source
Rible.set_robot_state! Method

Set robot state from a dictionary of CartesianFrames mapped to body IDs.

julia
set_robot_state!(
    bot::Robot,
    frames::AbstractVector{<:Rible.CartesianFrame}
) -> Any
source
Rible.AxisConfig Type
julia
AxisConfig

Axis configuration struct.

source
Rible.PlayConfig Type
julia
PlayConfig

Playback/recording configuration struct.

source
Rible.VisConfig Type
julia
VisConfig

Visualization configuration struct.

source
Rible.draw_background! Method

Draw the background scene (e.g., starry sky).

julia
draw_background!(ax, config::Rible.AxisConfig) -> Makie.Plot
source
Rible.draw_ground! Method
julia
draw_ground!(ax, ground, config::AxisConfig)

Draw the ground.

source
Rible.record_trajectory! Method
julia
record_trajectory!(fig, traj, bot, structure, viz_st, this_time, policy, config::PlayConfig)

Record the trajectory.

source
Rible.setup_axis! Method
julia
setup_axis!(subgrid, config::AxisConfig, ndim::Int, show_mesh::Bool)

Set up the axis.

Arguments

  • subgrid: subgrid

  • config: axis configuration

  • ndim: dimension

  • show_mesh: whether to show the mesh

source
Rible.setup_info_panel! Method
julia
setup_info_panel!(subgrid, ax, axis_config::AxisConfig)

Set up the info panel.

source
Rible.setup_interaction! Method
julia
setup_interaction!(subgrid, traj, bot, structure, viz_st, ax, this_time, this_step, policy, config::PlayConfig, axis_config::AxisConfig, vis_config::VisConfig)

Set up interaction.

source
Rible.update_robot_vis! Method
julia
update_robot_vis!(viz_st, structure, bot, step, traj, this_time, policy, config::AxisConfig, ax)

Update the robot visualization.

source

Visualization Recipes

Rible.Vis Type

Vis is the plot type associated with plotting function vis. Check the docstring for vis for further information.

source
Rible.vis Function

No docstring defined.

Plot type

The plot type alias for the vis function is Vis.

Attributes

axes_arrows_scale = 1.0No docs available.

cable_color = :deepskyblueNo docs available.

cable_label_color = :darkgreenNo docs available.

cable_width = 0.6No docs available.

clip_planes = Makie.Plane3f[]No docs available.

fontsize = 12No docs available.

id = 1No docs available.

isref = falseNo docs available.

label_prefix = ""No docs available.

linewidth = 1No docs available.

loci_colors = :blackNo docs available.

loci_idx = nothingNo docs available.

loci_markers_sizes = 12No docs available.

mesh_color = nothingNo docs available.

point_color = :blackNo docs available.

ref_color = :lightgreyNo docs available.

rigid_label_color = :darkblueNo docs available.

show_axes = falseNo docs available.

show_cable_labels = falseNo docs available.

show_cables = trueNo docs available.

show_curvature = falseNo docs available.

show_labels = falseNo docs available.

show_loci = falseNo docs available.

show_loci_labels = falseNo docs available.

show_mass_center_labels = falseNo docs available.

show_mass_centers = falseNo docs available.

show_mesh = trueNo docs available.

show_wire = falseNo docs available.

slack_linestyle = :dashNo docs available.

source
Rible.vis! Function

vis! is the mutating variant of plotting function vis. Check the docstring for vis for further information.

source