BB.Robot (bb v0.2.1)
View SourceAn optimised robot representation for kinematic computations.
This struct is built from the Spark DSL at compile-time and contains:
- All physical values converted to SI base units (floats)
- Flat maps for O(1) lookup of links, joints, sensors, and actuators by name
- Pre-computed topology metadata for efficient traversal
- Bidirectional parent/child references
Structure
The robot is organised as flat maps indexed by name:
links- all links in the robot, keyed by atom namejoints- all joints in the robot, keyed by atom namesensors- all sensors (at any level), keyed by atom nameactuators- all actuators, keyed by atom name
Unit Conventions
All physical quantities are stored as native floats in SI base units:
- Length: meters
- Angle: radians
- Mass: kilograms
- Moment of inertia: kg·m²
- Force: newtons
- Torque: newton-meters
- Linear velocity: m/s
- Angular velocity: rad/s
Summary
Functions
Get the child joints of a link.
Get a joint by name.
Get a link by name.
Get all joints in traversal order.
Get all links in topological order (root first).
Get the parent joint of a link (nil for root link).
Get the path from root to a given link or joint.
Types
@type t() :: %BB.Robot{ actuators: %{required(atom()) => actuator_info()}, joints: %{required(atom()) => BB.Robot.Joint.t()}, links: %{required(atom()) => BB.Robot.Link.t()}, name: atom(), root_link: atom(), sensors: %{required(atom()) => sensor_info()}, topology: BB.Robot.Topology.t() }
Functions
@spec child_joints(t(), atom()) :: [BB.Robot.Joint.t()]
Get the child joints of a link.
@spec get_joint(t(), atom()) :: BB.Robot.Joint.t() | nil
Get a joint by name.
@spec get_link(t(), atom()) :: BB.Robot.Link.t() | nil
Get a link by name.
@spec joints_in_order(t()) :: [BB.Robot.Joint.t()]
Get all joints in traversal order.
@spec links_in_order(t()) :: [BB.Robot.Link.t()]
Get all links in topological order (root first).
@spec parent_joint(t(), atom()) :: BB.Robot.Joint.t() | nil
Get the parent joint of a link (nil for root link).
Get the path from root to a given link or joint.