Skip to main content

Crate rrtk

Crate rrtk 

Source
Expand description

§RRTK: Rust Robotics ToolKit

A data flow-based robotics framework designed for embedded systems.

RRTK works almost entirely without std and alloc. It is not specific to any device or API, but support is available though feature flags for libm and micromath for extended float math.

§Feature Flags

  • alloc - Enable items requiring dynamic allocation through Rust’s builtin alloc crate.
  • std - Enable items requiring the Rust standard library. Requires alloc feature. Enabled by default.
  • devices - Enable RRTK’s graph-based device system.
  • libm - Use libm for float exponentiation when std is not available.
  • micromath - Use micromath for float exponentiation when std and libm are unavailable.
  • internal_enhanced_float - Do not enable this yourself.

RRTK prefers std over libm and libm over micromath when multiple are available.

Re-exports§

pub use dimensions::*;

Modules§

compile_time_integer
RRTK’s compile-time integer system. This is basically a simpler version of Typenum. It is used for compile-time dimensional analysis.
devices
A graph-based system for tracking the rotational states of mechanical components throughout your robot.
dimensions
RRTK’s compile-time dimensional analysis system. This system is simpler than ones like uom, but it serves a similar purpose: to protect users from dimension mismatch errors at compile time without runtime overhead.
error
Error types used for a few things in RRTK.
prelude
Re-exports some of the most important RRTK items as well as all its extension traits.
streams
There are some special Getters that hold other Getters that they use as input for some form of data processing. These are called streams.
stulta
“The stupid things” (Latin). These items really shouldn’t exist but currently must, mostly either due to language limitations or a desire to minimize external dependencies.

Macros§

div
Gets the resulting type from dividing values of two types. (Alias for <$a as Div<$b>>::Output.)
mul
Gets the resulting type from multiplying values of two types. (Alias for <$a as Mul<$b>>::Output.)

Structs§

AngularState
A one-dimensional motion state with position, velocity, and acceleration.
ConstantGetter
Getter for returning a constant value.
Datum
Holds a timestamp and something else, usually an f32, a Quantity, or one of the state types.
Feeder
Feeds the output of a Getter into a Settable.
GetterFromChronology
As Chronology types return values at times, we can ask them to return values at the current time or at the current time with a delta. This is the recommended way of following MotionProfiles.
LinearState
A one-dimensional motion state with position, velocity, and acceleration.
MotionProfile
A motion profile for getting from one state to another.
NoneGetter
Getter always returning Ok(None).
PIDKValues
Coefficients for a PID controller.
PointerDereferencer
Updatable, Getter, Settable, and TimeGetter are passed through Box, Rc<RefCell<T>>, Arc<RwLock<T>>, and Arc<Mutex<T>>, but this cannot be done safely for references involving raw pointer dereferencing. This is a wrapper struct that provides this functionality for *mut T, *const RwLock<T>, and *const Mutex<T>. It’s constructor is unsafe fn, so this is considered sound.
PositionDerivativeDependentPIDKValues
A set of PID k-values for controlling each position derivative.
TimeGetterFromGetter
Because Getters always return a timestamp (as long as they don’t return Err(_) or Ok(None)), we can use this to treat them like TimeGetters.

Enums§

AngularCommand
A command for a motor to perform: go to a position, run at a velocity, or accelerate at a rate.
LinearCommand
A command for a motor to perform: go to a position, run at a velocity, or accelerate at a rate.
MotionProfilePiece
Where you are in following a motion profile.
PositionDerivative
A derivative of position: position, velocity, or acceleration.

Traits§

Chronology
An object that can return a value, like a Getter, for a given time. Unlike Getter, Chronology is infallible.
GenericCommand
This trait allows one to write code generically over LinearCommand and AngularCommand. Each of those has a corresponding method to each method of this trait without the generic_ prefix. This is necessary because many of the implementations should be const fn and can’t be in a trait. Calling the direct methods (without generic_) is preferred where possible.
GenericState
This trait allows one to write code generically over LinearState and AngularState. Each of those has a corresponding method to each method of this trait without the generic_ prefix. This is necessary because many of the implementations should be const fn and can’t be in a trait. Calling the direct methods (without generic_) is preferred where possible.
Getter
An object that can be updated and can return timestamped values. This is one of the most fundamental traits to RRTK.
NothingOrErrorExt
An extension trait for NothingOrError.
OptionDatumExt
Extension trait for Option<Datum<T>>.
OutputExt
Extension trait for Output<T, E>, a type alias to Result<Option<Datum<T>>, E>.
Settable
An object that can be updated and can be set to or given values, potentially erroring when this is done.
TimeGetter
An object for getting the absolute time.
Updatable
An object that can be updated, potentially erroring when this is done. This is one of the most fundamental traits to RRTK.

Functions§

latest
Get the newer of two Datum objects.

Type Aliases§

NothingOrError
Returned when something may return either nothing or an error.
Output
A generic output type when something may return an error, nothing, or something with a timestamp. The most common use for this is as the output of Getter::get.
TimeOutput
Returned from TimeGetter objects, which may return either a time or an error.