C++ API reference

This reference is generated from the C++ headers via Doxygen + Breathe. Documentation quality tracks the Doxygen comments in the source — types with /** @brief ... */ blocks render richest. The full namespace is blast::.

Note

Header conversion to Doxygen comments is ongoing. blast_manipulator.hpp is fully documented; other modules currently expose plain // comments and will improve as headers are annotated.

Manipulator

class Manipulator

High‐level interface combining limits, kinematics, dynamics, and collision geometry for a manipulator.

Note

Use the constructor to fully specify at least limits and kinematics.

Public Functions

Manipulator() = delete
inline Manipulator(u32 joint_count, const ManipulatorLimits &limits, const ManipulatorKinematics &kinematics, const ManipulatorDynamics *dynamics = nullptr, const ManipulatorCapsules *capsules = nullptr)

Construct a GenericManipulator with required data.

Parameters:
inline void set_limits(const ManipulatorLimits &limits)

Apply provided limits to this manipulator.

Parameters:

limits – Reference to ManipulatorLimits.

inline void set_kinematics(const ManipulatorKinematics &kinematics)

Apply provided kinematics to this manipulator.

Parameters:

kinematics – Reference to ManipulatorKinematics.

inline void set_dynamics(const ManipulatorDynamics &dynamics)

Apply provided dynamics to this manipulator.

Parameters:

dynamics – Reference to ManipulatorDynamics.

inline void set_capsules(const ManipulatorCapsules &capsules)

Apply provided collision capsules to this manipulator.

Parameters:

capsules – Reference to ManipulatorCapsules.

inline void add_tool(const Tool &tool)

Attach a tool to this manipulator.

Parameters:

toolTool structure with payload and geometry.

inline void set_payload(real m_payload, Vec3 cg_payload, Mat3 I_payload)

Add a payload to the last link, adjusting mass and inertia.

Parameters:
  • m_payload – Payload mass.

  • cg_payload – Payload center of mass offset.

  • I_payload – Payload inertia tensor.

Array get_tool_pose() const

Update collision capsules in world frame (store internally).

Compute distances for all internal collisions.

Get the current tool pose as [x,y,z,roll,pitch,yaw].

Returns:

Array of distances between colliding primitives.

Returns:

Array of six values: position and RPY orientation.

Public Members

u32 n_joints = 0
std::array<real, MAX_JOINTS> position_max = {}
std::array<real, MAX_JOINTS> position_min = {}
std::array<real, MAX_JOINTS> velocity_max = {}
std::array<real, MAX_JOINTS> acceleration_max = {}
std::array<real, MAX_JOINTS> jerk_max = {}
std::array<real, MAX_JOINTS> torque_max = {}
real tool_speed_max = 0.0
Vec3 base_position = {0, 0, 0}
Mat3 base_rotation = {1, 0, 0, 0, 1, 0, 0, 0, 1}
bool has_tool = false
Vec3 tool_offset = {0, 0, 0}
Mat3 tool_rotation = {1, 0, 0, 0, 1, 0, 0, 0, 1}
real tool_mass = 0.0
Mat3 tool_inertia_tensor = eye()
Vec3 tool_cog_offset = {0, 0, 0}
Vec3 first_joint_position = {0, 0, 0}
std::array<Vec3, MAX_JOINTS> joint_offsets = {}
std::array<Vec3, MAX_JOINTS> joint_axes = {}
std::array<Mat3, MAX_JOINTS + 1> static_rotations = {}
std::array<Mat3, MAX_JOINTS> inertia_tensors = {}
std::array<Vec3, MAX_JOINTS> cog_offsets = {}
std::array<Vec3, MAX_JOINTS> cog_from_next_joint = {}
int _n_caps = 0
int _n_internal_collisions = 0
std::array<CollisionModelCapsule, MAX_CAPSULES> _collision_model = {}
ObjMatrix<u8> _collision_matrix = {}
Array _collision_base = {}
Sphere _base_sphere = {}
struct ManipulatorLimits

Actuator limits for a manipulator’s joints and Tool.

Public Members

Array position_max
Array position_min
Array velocity_max
Array acceleration_max
Array jerk_max
Array torque_max
real tool_speed_max
struct ManipulatorKinematics

Geometric configuration of manipulator joints and base.

Public Members

std::array<Vec3, MAX_JOINTS> joint_offsets
std::array<Vec3, MAX_JOINTS> joint_axes
std::array<Mat3, MAX_JOINTS + 1> static_rotations
Vec3 base_position = {0.0, 0.0, 0.0}
Vec3 first_joint_position = {0.0, 0.0, 0.0}
Mat3 base_rotation = {1, 0, 0, 0, 1, 0, 0, 0, 1}
struct ManipulatorDynamics

Dynamic properties of each manipulator link.

Public Members

std::array<Mat3, MAX_JOINTS> inertia_tensors = {}
std::array<Vec3, MAX_JOINTS> cog_offsets = {}
struct ManipulatorCapsules

Collision geometry grouping for manipulator.

Public Members

Sphere base_sphere
std::vector<CollisionModelCapsule> capsule_list
ObjMatrix<u8> collision_matrix = {}
Array collision_base
struct Tool

Payload and collision properties of a tool.

Public Members

Vec3 tool_offset = {0.0, 0.0, 0.0}
Mat3 tool_rotation = {1, 0, 0, 0, 1, 0, 0, 0, 1}
real mass = 0.0
Mat3 inertia_tensor
Vec3 cog_offset = {0.0, 0.0, 0.0}
std::vector<CollisionModelCapsule> capsule_list
ObjMatrix<u8> collision_matrix = {}

World & collision primitives

struct World

Public Functions

inline void add_box(const Box &box)
inline void add_box(Vec3 center_point, Vec3 half_width, Mat3 rotation_matrix)
inline void add_sphere(const Sphere &sphere)
inline void add_sphere(Vec3 center_point, real radius)
inline void add_capsule(const Capsule &capsule)
inline void add_capsule(Vec3 point1, Vec3 point2, real radius)
inline void add_dynamic_box(const DynamicBox &box)
inline void add_dynamic_box(const std::vector<Box> &new_boxes, u32 n_points, real start_time, real end_time)
inline void add_dynamic_sphere(const DynamicSphere &sphere)
inline void add_dynamic_sphere(const std::vector<Sphere> &new_spheres, u32 n_points, real start_time, real end_time)
inline void add_dynamic_capsule(const DynamicCapsule &capsule)
inline void add_dynamic_capsule(const std::vector<Capsule> &new_capsules, u32 n_points, real start_time, real end_time)

Public Members

std::vector<Box> boxes
std::vector<Sphere> spheres
std::vector<Capsule> capsules
std::vector<DynamicBox> dynamic_boxes
std::vector<DynamicSphere> dynamic_spheres
std::vector<DynamicCapsule> dynamic_capsules
std::vector<DynamicDoor> dynamic_doors
u32 size = 0
struct Box

Public Members

Vec3 center
Vec3 extents
Mat3 rotation
struct Sphere

Public Members

Vec3 center
real radius = 0
struct Capsule

Public Members

Vec3 p1
Vec3 p2
real radius = 0
struct DynamicBox

Public Functions

inline Box lookup(real time) const

Public Members

u32 n_points
real start_time = 0
real end_time = 0
std::vector<Box> trajectory
struct DynamicSphere

Public Functions

inline Sphere lookup(real time) const

Public Members

u32 n_points
real start_time = 0
real end_time = 0
std::vector<Sphere> trajectory
struct DynamicCapsule

Public Functions

inline Capsule lookup(real time) const

Public Members

u32 n_points
real start_time = 0
real end_time = 0
std::vector<Capsule> trajectory
struct DynamicDoor

Public Functions

inline Box lookup(real t) const

Public Members

Vec3 extents
Vec3 hinge
Vec3 static_c_from_hinge
real start_angle = 0
real end_angle = 0
real start_time = 0
real end_time = 0
Vec3 axis = {0, 0, 1}

Optimization

struct Optimization

Public Functions

Optimization() = delete
inline Optimization(const Manipulator &new_manip, const Task &new_task)
inline Optimization(const Manipulator &new_manip, const Task &new_task, const Bspline &new_bspline)
inline int x_len() const
inline void set_manip(Manipulator new_manip)
inline void set_bspline(Bspline new_bspline)
inline void set_guess(Guess new_guess)
inline void set_constraints(ConstraintSelection new_constraints)
inline void set_objective(Objective new_objective)
inline void set_task(const Task &new_task)
inline void set_world(World new_world)

Public Members

OptimizationMethod method = OptimizationMethod::with_segments
Manipulator manip
Bspline bspline
Guess guess
ConstraintSelection constraints
Objective objective
Matrix task
World world
real trajectory_start_time = 0.0
real success_tolerance = 0.01
int max_tries = 1
int max_eval = 1000
real max_time = 30.0
void *custom_data
Array lb
Array ub
struct Objective

Public Functions

inline void add_custom_objective(ObjectiveFunction function, real k)

Public Members

real time_weight = 1.0
std::vector<real> k_extra_objectives = {}
std::vector<real (*)(Optimization*)> extra_objectives = {}
struct Guess

Public Types

enum GuessType

Values:

enumerator custom
enumerator random
enumerator shotgun
enumerator from_list

Public Functions

Guess() = default
inline explicit Guess(Array x_0)
inline explicit Guess(Matrix m)
inline explicit Guess(u32 shots)

Public Members

GuessType type = random
real parameter = 0
u32 n_random_shots = 100
Array initial_x
Matrix candidates
struct ConstraintSelection

Public Functions

inline void add_constraint(ConstraintFunction, int n_con)

Public Members

bool position = false
bool velocity = false
bool acceleration = false
bool torque = false
bool jerk = false
bool tool_speed = false
bool self_collisions = false
bool external_collisions = false
int n_collision_constraints = 5
int n_collision_skip = 2
int n_constraints = 0
int n_constraints_per_segment = 0
bool collect_x_each_iteration = false
std::vector<Array> x_list
ConstraintFunctionVector extra_constraints = {}
std::vector<u32> n_extra_constraints = {}
struct Result

Public Functions

Result() = delete
inline explicit Result(Optimization *optim)

Public Members

bool success = false
bool success_false = false
real compute_time = 0
Optimization *opt
Array x
Array x0
nlopt_result nlopt_exit_criteria = NLOPT_SUCCESS
int num_eval = 0
int num_tries = 0
Trajectory trajectory
real max_constraint_value = 0.0
int max_constraint_idx = 0
real max_constraint_more_points_value = 0.0
int max_constraint_more_points_idx = 0
enum class blast::OptimizationMethod : u32

Values:

enumerator with_segments
enumerator baseline
enumerator with_analytical_pva
enumerator with_analytical_dynamics
enum blast::ConstraintType

Values:

enumerator position
enumerator velocity
enumerator acceleration
enumerator collision

Task & trajectory

struct Task

Public Functions

Task() = default
inline explicit Task(u32 n_joints)
inline explicit Task(const Matrix &m)
inline Matrix to_matrix() const

Public Members

TaskBoundary start
TaskBoundary goal

Public Static Functions

static inline Task stop_to_stop(Array start_pos, Array goal_pos)
struct Bspline

Public Functions

inline Bspline() = delete
inline Bspline(u32 n_control, u32 n_points, u32 degree, u32 n_joints)
inline explicit Bspline(u32 n_joints)
inline Bspline(const Bspline &other) = default
inline Bspline(Bspline &&other) = default
inline Bspline &operator=(const Bspline &other) = default
inline Bspline &operator=(Bspline &&other) = default
inline void compute_trajectory(const Array &x, const Matrix &task)

Computes the trajectory of a B-spline curve.

This function computes the trajectory of a B-spline curve given its knots and control points. The knots are passed as an array x and the control points are passed as a matrix task. The function first checks that the size of x is equal to the length of task along the x-axis, and that the number of rows and columns in task are equal to the number of joints and 6, respectively. Then, it calls the compute_control function to compute the control points of the B-spline curve. Finally, it computes the position, velocity, and acceleration of each joint at each point along the trajectory using the computed control points and the basis functions for position, velocity, and acceleration.

Parameters:
  • x – An array of real numbers representing the knots of the B-spline curve.

  • task – A matrix representing the control points of the B-spline curve.

inline u32 x_len(const Matrix &task) const
inline void compute_basis()
inline void compute_basis_derivative(int d)
inline void compute_basis_open()
inline void compute_control(const Array &x, const Matrix &task, real *dst) const

Public Members

Trajectory traj
Matrix control
Matrix basis_p
Matrix basis_v
Matrix basis_a
std::vector<Matrix> basis
u32 n_joints
u32 n_points
u32 n_ctrl
u32 degree
std::vector<u32> lower_bounds
std::vector<u32> upper_bounds

Note

Free functions such as blast::optimize live in blast_optimization.hpp. Once they carry Doxygen comments, add {doxygenfunction} directives here (a disambiguating signature is required for overloaded functions).