FancySafeBot 0.0.1
A safe robotics library
Loading...
Searching...
No Matches
fsb::BodyTree Class Reference

Detailed Description

Body tree description of a kinematic chain.

#include <fsb_body_tree.h>

Collaboration diagram for fsb::BodyTree:
Collaboration graph

Public Member Functions

 BodyTree ()=default
 Construct a new BodyTree object.
 
size_t add_body (size_t parent_body_index, JointType joint_type, const Transform &parent_joint_transform, const Body &body, BodyTreeError &err)
 Add a body to the body tree.
 
size_t add_massless_body (size_t parent_body_index, JointType joint_type, const Transform &parent_joint_transform, const MotionVector &origin_offset, BodyTreeError &err)
 Add a massless body to the body tree.
 
void set_gravity (const Vec3 &gravity)
 Set the gravity vector.
 
Joint get_joint (size_t joint_index, BodyTreeError &err) const
 Get a joint object in the body tree.
 
Body get_body (size_t body_index, BodyTreeError &err) const
 Get body object from tree.
 
BodyTreeError set_body_mass_props (size_t body_index, const MassProps &mass_props)
 Set the body mass properties object.
 
BodyTreeError set_body_origin_offset (size_t body_index, const MotionVector &origin_offset)
 Set the body transform offset.
 
BodyTreeError set_parent_joint_transform (size_t body_index, const Transform &parent_joint_transform)
 Set the parent joint transform object.
 
size_t get_body_dofs (size_t body_index, BodyTreeError &err) const
 Get the number of degrees of freedom for a body.
 
size_t get_num_bodies () const
 Get the number of bodies in tree.
 
size_t get_num_dofs () const
 Get the number of body tree degrees of freedom.
 
size_t get_num_coordinates () const
 Get the number of generalized position coordinates.
 
Vec3 get_gravity () const
 Get the gravity vector.
 
std::array< size_t, MaxSize::bodiesget_leaves (size_t &num_leaves) const
 Get a list of body indexes that are leaves (bodies without children)
 

Static Public Attributes

static constexpr size_t base_index = 0U
 Index of base body is always 0.
 

Member Function Documentation

◆ add_body()

size_t fsb::BodyTree::add_body ( size_t  parent_body_index,
JointType  joint_type,
const Transform parent_joint_transform,
const Body body,
BodyTreeError err 
)

Add a body to the body tree.

Parameters
parent_body_indexIndex of parent body
joint_typeJoint type
parent_joint_transformTransform of joint with respect to parent body
bodyBody to add to tree
errError code
Returns
Index of added body

◆ add_massless_body()

size_t fsb::BodyTree::add_massless_body ( size_t  parent_body_index,
JointType  joint_type,
const Transform parent_joint_transform,
const MotionVector origin_offset,
BodyTreeError err 
)

Add a massless body to the body tree.

Parameters
parent_body_indexIndex of parent body
joint_typeJoint type
parent_joint_transformTransform of joint with respect to parent body
origin_offsetOrigin offset transform
errError code
Returns
Index of added body

◆ get_body_dofs()

size_t fsb::BodyTree::get_body_dofs ( size_t  body_index,
BodyTreeError err 
) const

Get the number of degrees of freedom for a body.

Parameters
body_indexBody index
errError code
Returns
Number of degrees of freedom

◆ get_gravity()

Vec3 fsb::BodyTree::get_gravity ( ) const
inline

Get the gravity vector.

Returns
Gravity acceleration vector

◆ get_leaves()

std::array< size_t, MaxSize::bodies > fsb::BodyTree::get_leaves ( size_t &  num_leaves) const
inline

Get a list of body indexes that are leaves (bodies without children)

Parameters
num_leavesNumber of leaves in body tree
Returns
Array of body indexes which are leaves.

◆ get_num_bodies()

size_t fsb::BodyTree::get_num_bodies ( ) const
inline

Get the number of bodies in tree.

Returns
Number of bodies

◆ get_num_coordinates()

size_t fsb::BodyTree::get_num_coordinates ( ) const
inline

Get the number of generalized position coordinates.

Returns
Number of generalized position coordinates

◆ get_num_dofs()

size_t fsb::BodyTree::get_num_dofs ( ) const
inline

Get the number of body tree degrees of freedom.

Returns
Degrees of freedom

◆ set_gravity()

void fsb::BodyTree::set_gravity ( const Vec3 gravity)
inline

Set the gravity vector.

Parameters
gravityGravity vector

The documentation for this class was generated from the following files: