sas
Modularised monitoring, logging, and control of robots.
Loading...
Searching...
No Matches
marinholab::sas::core Namespace Reference

Namespaces

namespace  _core
namespace  example_clock
namespace  example_clock_sched_fifo
namespace  example_robot_driver_subclass

Classes

class  Clock
 Clock utility for timing and statistics in control loops. More...
class  Object
 Base class for SAS objects. More...
class  RobotDriver
 Abstract interface for robot hardware drivers. More...
class  RobotDriverExample
 Simple in-memory RobotDriver implementation for testing. More...
struct  RobotDriverExampleConfiguration
 Configuration for the RobotDriverExample. More...
class  ShutdownSignaler
 Shutdown coordinator. More...
class  ThreadManager

Enumerations

enum class  Statistics { Mean }
 Statistical measures supported by sas_core utilities. More...

Functions

std::vector< double > vectorxd_to_std_vector_double (const Eigen::VectorXd &vectorxd)
 Convert an Eigen::VectorXd to a std::vector<double>.
std::vector< int > vectorxi_to_std_vector_int (const Eigen::VectorXi &vectorxi)
 Convert an Eigen::VectorXi to a std::vector<int>.
Eigen::VectorXd std_vector_double_to_vectorxd (std::vector< double > std_vector_double)
 Convert a std::vector<double> to an Eigen::VectorXd.
Eigen::VectorXi std_vector_int_to_vectorxi (std::vector< int > std_vector_int)
 Convert a std::vector<int> to an Eigen::VectorXi.
DQ std_vector_double_to_dq (const std::vector< double > &std_vector_double)
 Convert a std::vector<double> to a DQ (dual quaternion) object.
template<class T>
constexpr T incremental_mean (const T &current_mean, const int &current_number_of_samples, const T &new_sample)
 incremental_mean a simple implementation of incremental mean, for the many cases in which keeping a vector of all values would be impractical.
Eigen::VectorXd concatenate (const Eigen::VectorXd &a, const Eigen::VectorXd &b)
 Concatenate two vectors by appending b after a.
Eigen::VectorXd concatenate (const std::vector< Eigen::VectorXd > &as)
 Concatenate a list of vectors into a single vector.
Eigen::MatrixXd vstack (const Eigen::MatrixXd &A, const Eigen::MatrixXd &B)
 Stack two matrices vertically (A above B).
Eigen::MatrixXd block_diag (const std::vector< Eigen::MatrixXd > &As)
 Create a block-diagonal matrix from a list of matrices.
std::vector< Eigen::VectorXd > split (const Eigen::VectorXd &a, const std::vector< int > &ns)
 Split a vector into pieces with sizes specified by ns.

Detailed Description

@file __init__.py
@brief Package entry for the sas_core Python bindings.

This module re-exports the primary Python bindings provided by the
compiled extension module :mod:`marinholab.sas.core._core`.

- Clock: high-resolution timing and sleep class.
- Statistics: enumeration for statistical types.
- RobotDriver: abstract robot driver interface that can be inherited by Python classes.
- ShutdownSignaler: request and wait for orderly shutdown.

The concrete implementations live in the compiled extension module
``marinholab.sas.core._core``.

Enumeration Type Documentation

◆ Statistics

Statistical measures supported by sas_core utilities.

Enumeration of lightweight statistics that classes and functions may compute (for example, Clock statistics). Add new entries here as new statistics are supported.

Function Documentation

◆ block_diag()

Eigen::MatrixXd marinholab::sas::core::block_diag ( const std::vector< Eigen::MatrixXd > & As)

Create a block-diagonal matrix from a list of matrices.

block_diag creates a block diagonal matrix using an input of std::vector<Eigen::MatrixXd>. e.g. if As= [A, B, C], then block_diag(As) = |A 0 0| |0 B 0| |0 0 C|

Parameters
AsVector of matrices to place on the block diagonal.
Returns
Block-diagonal matrix containing the input matrices along its diagonal.
Parameters
Asthe std::vector<Eigen::MatrixXd> contaning the matrix to form the block diagonal matrix.
Returns
the block diagonal matrix.

◆ concatenate() [1/2]

Eigen::VectorXd marinholab::sas::core::concatenate ( const Eigen::VectorXd & a,
const Eigen::VectorXd & b )

Concatenate two vectors by appending b after a.

concatenate two Eigen::VectorXd.

Parameters
aFirst vector.
bSecond vector.
Returns
Concatenated vector containing all elements of a followed by b.
Parameters
aa Eigen::VectorXd.
ba Eigen::VectorXd.
Returns
the result of the concatenated vectors.

◆ concatenate() [2/2]

Eigen::VectorXd marinholab::sas::core::concatenate ( const std::vector< Eigen::VectorXd > & as)

Concatenate a list of vectors into a single vector.

concatenate a std::vector of Eigen::VectorXd.

Parameters
asVector of vectors to concatenate in order.
Returns
Concatenated vector containing the elements of each input vector in order.
Parameters
aan std::vector of Eigen::VectorXd.
Returns
the result of the concatenated vectors.

◆ incremental_mean()

template<class T>
T marinholab::sas::core::incremental_mean ( const T & current_mean,
const int & current_number_of_samples,
const T & new_sample )
constexpr

incremental_mean a simple implementation of incremental mean, for the many cases in which keeping a vector of all values would be impractical.

Parameters
current_meanthe current value of the mean.
current_number_of_samplesthe current number of samples, not considering the new_sample.
new_samplethe new sample that will change the mean.
Exceptions
std::range_errorif current_number_of_samples is negative.
Returns
the incremental mean, considering the new_sample.

◆ split()

std::vector< Eigen::VectorXd > marinholab::sas::core::split ( const Eigen::VectorXd & a,
const std::vector< int > & ns )

Split a vector into pieces with sizes specified by ns.

split splits the input Eigen::VectorXd as into a set of subvectors defined by ns.

Parameters
aVector to split.
nsSizes of each piece; their sum must equal a.size().
Returns
Vector containing the split Eigen::VectorXd pieces.
Parameters
asthe Eigen::VectorXd to be split.
nsthe sizes of the subvectors.
Returns
an std::vector<Eigen::VectorXd> of the splitted vectors.

◆ std_vector_double_to_dq()

DQ marinholab::sas::core::std_vector_double_to_dq ( const std::vector< double > & std_vector_double)

Convert a std::vector<double> to a DQ (dual quaternion) object.

Parameters
std_vector_doubleSource std::vector<double> containing the DQ coefficients.
Returns
DQ constructed from the provided coefficients.

◆ std_vector_double_to_vectorxd()

Eigen::VectorXd marinholab::sas::core::std_vector_double_to_vectorxd ( std::vector< double > std_vector_double)

Convert a std::vector<double> to an Eigen::VectorXd.

Parameters
std_vector_doubleSource std::vector<double>.
Returns
Eigen::VectorXd containing the same elements.

◆ std_vector_int_to_vectorxi()

Eigen::VectorXi marinholab::sas::core::std_vector_int_to_vectorxi ( std::vector< int > std_vector_int)

Convert a std::vector<int> to an Eigen::VectorXi.

Parameters
std_vector_intSource std::vector<int>.
Returns
Eigen::VectorXi containing the same elements.

◆ vectorxd_to_std_vector_double()

std::vector< double > marinholab::sas::core::vectorxd_to_std_vector_double ( const Eigen::VectorXd & vectorxd)

Convert an Eigen::VectorXd to a std::vector<double>.

Parameters
vectorxdSource Eigen vector.
Returns
std::vector<double> containing the same elements in order.

◆ vectorxi_to_std_vector_int()

std::vector< int > marinholab::sas::core::vectorxi_to_std_vector_int ( const Eigen::VectorXi & vectorxi)

Convert an Eigen::VectorXi to a std::vector<int>.

Parameters
vectorxiSource Eigen integer vector.
Returns
std::vector<int> containing the same elements in order.

◆ vstack()

Eigen::MatrixXd marinholab::sas::core::vstack ( const Eigen::MatrixXd & A,
const Eigen::MatrixXd & B )

Stack two matrices vertically (A above B).

vstack vertically (row-wise) stack two Eigen::MatrixXd.

Parameters
ATop matrix.
BBottom matrix.
Returns
Matrix formed by stacking A on top of B. Columns must match.
Exceptions
std::range_errorif A and B have different numbers of columns.
Parameters
Athe first Eigen::MatrixXd.
Bthe second Eigen::MatrixXd.
Returns
the vstacked Eigen::MatrixXd.
Exceptions
astd::range_error if A and B don't have the same number of columns.
Note
returns an empty matrix if both arguments are empty or return the other argument of only one of the arguments is empty.