SignalLogger
A library for signal logging.
signal_logger Namespace Reference

Namespaces

 traits
 

Classes

struct  both_slashes
 Helper for subclass add functions. More...
 
class  Buffer
 Thread-safe circular buffer. More...
 
class  BufferInterface
 
struct  EnumClassHash
 Enum class hash. More...
 
struct  KindrVectorAtPosition
 Kindr vector at position type. More...
 
class  LogElementBase
 Forward declaration of LogElementBase. More...
 
class  LogElementInterface
 Basic interface of logger elements. More...
 
class  LogElementOptions
 
class  SignalLoggerBase
 Class that severs as base class for all the loggers. More...
 
class  SignalLoggerNone
 
struct  SignalLoggerOptions
 Struct containing logger options. More...
 

Typedefs

typedef std::pair< int64_t, int64_t > TimestampPair
 Time stamp pair <s,ns> More...
 
typedef Eigen::Vector3d Vector3d
 Eigen types. More...
 
typedef Eigen::MatrixXf MatrixXf
 
typedef Eigen::MatrixXd MatrixXd
 
typedef Eigen::MatrixXi MatrixXi
 
typedef Eigen::Matrix< long,Eigen::Dynamic, Eigen::Dynamic > MatrixXl
 
typedef Eigen::Matrix< short,Eigen::Dynamic, Eigen::Dynamic > MatrixXs
 
typedef Eigen::Matrix< char,Eigen::Dynamic, Eigen::Dynamic > MatrixXc
 
typedef Eigen::Matrix< unsigned char,Eigen::Dynamic, Eigen::Dynamic > MatrixXUc
 
typedef Eigen::Matrix< bool,Eigen::Dynamic, Eigen::Dynamic > MatrixXb
 
typedef Eigen::Matrix< std::string,Eigen::Dynamic, Eigen::Dynamic > MatrixXstring
 
typedef kindr::Position3D KindrPositionD
 Kindr types. More...
 
typedef kindr::RotationQuaternionPD KindrRotationQuaternionD
 
typedef kindr::EulerAnglesZyxPD KindrEulerAnglesZyxD
 
typedef kindr::LocalAngularVelocityPD KindrAngularVelocityD
 
typedef kindr::AngleAxisPD KindrAngleAxisD
 
typedef kindr::RotationMatrixPD KindrRotationMatrixD
 
typedef kindr::RotationVectorPD KindrRotationVectorD
 
typedef kindr::Velocity3D KindrLinearVelocityD
 
typedef kindr::Acceleration3D KindrLinearAccelerationD
 
typedef kindr::AngularAcceleration3D KindrAngularAccelerationD
 
typedef kindr::Force3D KindrForceD
 
typedef kindr::Torque3D KindrTorqueD
 
typedef kindr::VectorTypeless3D KindrVectorD
 
typedef kindr::HomTransformQuatD KindrHomTransformQuatD
 
using TimeElement = LogElementBase< TimestampPair >
 
template<typename T >
using vector_type = typename std::conditional< traits::is_eigen_matrix< T >::value, std::vector< T, Eigen::aligned_allocator< T >>, std::vector< T >>::type
 Vector type. More...
 
using LogFileTypeSet = std::unordered_set< LogFileType, EnumClassHash >
 

Enumerations

enum  LoggerType : int { LoggerType::TypeUnknown = -1, LoggerType::TypeNone = 0, LoggerType::TypeStd = 1, LoggerType::TypeRos = 2 }
 Get the logger type at runtime. More...
 
enum  BufferType : unsigned int { BufferType::FIXED_SIZE = 0, BufferType::LOOPING = 1, BufferType::EXPONENTIALLY_GROWING = 2 }
 Enum containing possible buffer types. More...
 
enum  LogElementAction : unsigned int { LogElementAction::SAVE_AND_PUBLISH = 0, LogElementAction::SAVE = 1, LogElementAction::PUBLISH = 2 }
 Enum containing possible logging actions. More...
 
enum  LogFileType : unsigned int { LogFileType::BINARY = 0, LogFileType::CSV = 1, LogFileType::BAG = 2 }
 Enum containing possible log file types. More...
 

Functions

LoggerType getLoggerType ()
 
void setSignalLoggerNone ()
 
void setSignalLoggerStd ()
 
void setSignalLoggerRos (ros::NodeHandle *nh)
 
template<typename ValueType_ >
void add (const ValueType_ &var, const std::string &name, const std::string &group=LOG_ELEMENT_DEFAULT_GROUP_NAME, const std::string &unit=LOG_ELEMENT_DEFAULT_UNIT, const std::size_t divider=LOG_ELEMENT_DEFAULT_DIVIDER, const LogElementAction action=LOG_ELEMENT_DEFAULT_ACTION, const std::size_t bufferSize=LOG_ELEMENT_DEFAULT_BUFFER_SIZE, const BufferType bufferType=LOG_ELEMENT_DEFAULT_BUFFER_TYPE)
 
template<typename ValueType_ >
std::enable_if< std::is_base_of< Eigen::MatrixBase< ValueType_ >, ValueType_ >::value >::type add (const ValueType_ &var, Eigen::Ref< MatrixXstring > names, const std::string &group=LOG_ELEMENT_DEFAULT_GROUP_NAME, const std::string &unit=LOG_ELEMENT_DEFAULT_UNIT, const std::size_t divider=LOG_ELEMENT_DEFAULT_DIVIDER, const LogElementAction action=LOG_ELEMENT_DEFAULT_ACTION, const std::size_t bufferSize=LOG_ELEMENT_DEFAULT_BUFFER_SIZE, const BufferType bufferType=LOG_ELEMENT_DEFAULT_BUFFER_TYPE)
 

Variables

std::shared_ptr< SignalLoggerBaselogger
 Reference to the logger. More...
 
static constexpr const char * LOG_ELEMENT_DEFAULT_GROUP_NAME = "/log/"
 Default log element group. More...
 
static constexpr const char * LOG_ELEMENT_DEFAULT_UNIT = "-"
 Default log element unit. More...
 
static constexpr std::size_t LOG_ELEMENT_DEFAULT_DIVIDER = 1
 Default log element divider. More...
 
static constexpr LogElementAction LOG_ELEMENT_DEFAULT_ACTION = LogElementAction::SAVE_AND_PUBLISH
 Default log element action. More...
 
static constexpr std::size_t LOG_ELEMENT_DEFAULT_BUFFER_SIZE = 1000
 Default log element buffer size. More...
 
static constexpr BufferType LOG_ELEMENT_DEFAULT_BUFFER_TYPE = BufferType::LOOPING
 Default log element buffer type. More...
 
static constexpr const double LOGGER_DEFAULT_MAXIMUM_LOG_TIME = 10.0
 Default maximal logging time. More...
 
static constexpr const char * LOGGER_DEFAULT_SCRIPT_FILENAME = "logger.yaml"
 Default logging script file name. More...
 
static constexpr const char * LOGGER_DEFAULT_PREFIX = "/log"
 Default logger prefix. More...
 
static constexpr const char * LOGGER_DEFAULT_NAME = "silo"
 Default logger name. More...
 
static constexpr const double LOGGER_EXP_GROWING_MAXIMUM_LOG_TIME = 10.0
 Default log time for exponentially growing time buffer. More...
 

Typedef Documentation

typedef kindr::AngleAxisPD signal_logger::KindrAngleAxisD
typedef kindr::AngularAcceleration3D signal_logger::KindrAngularAccelerationD
typedef kindr::LocalAngularVelocityPD signal_logger::KindrAngularVelocityD
typedef kindr::EulerAnglesZyxPD signal_logger::KindrEulerAnglesZyxD
typedef kindr::Force3D signal_logger::KindrForceD
typedef kindr::HomTransformQuatD signal_logger::KindrHomTransformQuatD
typedef kindr::Acceleration3D signal_logger::KindrLinearAccelerationD
typedef kindr::Velocity3D signal_logger::KindrLinearVelocityD
typedef kindr::Position3D signal_logger::KindrPositionD

Kindr types.

typedef kindr::RotationMatrixPD signal_logger::KindrRotationMatrixD
typedef kindr::RotationQuaternionPD signal_logger::KindrRotationQuaternionD
typedef kindr::RotationVectorPD signal_logger::KindrRotationVectorD
typedef kindr::Torque3D signal_logger::KindrTorqueD
typedef kindr::VectorTypeless3D signal_logger::KindrVectorD
using signal_logger::LogFileTypeSet = typedef std::unordered_set<LogFileType, EnumClassHash>
typedef Eigen::Matrix< bool ,Eigen::Dynamic, Eigen::Dynamic > signal_logger::MatrixXb
typedef Eigen::Matrix< char ,Eigen::Dynamic, Eigen::Dynamic > signal_logger::MatrixXc
typedef Eigen::MatrixXd signal_logger::MatrixXd
typedef Eigen::MatrixXf signal_logger::MatrixXf
typedef Eigen::MatrixXi signal_logger::MatrixXi
typedef Eigen::Matrix< long ,Eigen::Dynamic, Eigen::Dynamic > signal_logger::MatrixXl
typedef Eigen::Matrix< short ,Eigen::Dynamic, Eigen::Dynamic > signal_logger::MatrixXs
typedef Eigen::Matrix< std::string ,Eigen::Dynamic, Eigen::Dynamic > signal_logger::MatrixXstring
typedef Eigen::Matrix< unsigned char ,Eigen::Dynamic, Eigen::Dynamic > signal_logger::MatrixXUc
typedef std::pair<int64_t, int64_t> signal_logger::TimestampPair

Time stamp pair <s,ns>

typedef Eigen::Vector3d signal_logger::Vector3d

Eigen types.

template<typename T >
using signal_logger::vector_type = typedef typename std::conditional<traits::is_eigen_matrix<T>::value, std::vector<T, Eigen::aligned_allocator<T>>, std::vector<T>>::type

Vector type.

Enumeration Type Documentation

enum signal_logger::BufferType : unsigned int
strong

Enum containing possible buffer types.

Enumerator
FIXED_SIZE 

0

LOOPING 

1

EXPONENTIALLY_GROWING 

2

enum signal_logger::LogElementAction : unsigned int
strong

Enum containing possible logging actions.

Enumerator
SAVE_AND_PUBLISH 

0

SAVE 

1

PUBLISH 

2

enum signal_logger::LogFileType : unsigned int
strong

Enum containing possible log file types.

Enumerator
BINARY 

0

CSV 

1

BAG 

2

enum signal_logger::LoggerType : int
strong

Get the logger type at runtime.

Enumerator
TypeUnknown 

-1

TypeNone 

0

TypeStd 

1

TypeRos 

2

Function Documentation

template<typename ValueType_ >
void signal_logger::add ( const ValueType_ &  var,
const std::string &  name,
const std::string &  group = LOG_ELEMENT_DEFAULT_GROUP_NAME,
const std::string &  unit = LOG_ELEMENT_DEFAULT_UNIT,
const std::size_t  divider = LOG_ELEMENT_DEFAULT_DIVIDER,
const LogElementAction  action = LOG_ELEMENT_DEFAULT_ACTION,
const std::size_t  bufferSize = LOG_ELEMENT_DEFAULT_BUFFER_SIZE,
const BufferType  bufferType = LOG_ELEMENT_DEFAULT_BUFFER_TYPE 
)

Add variable to logger. This is a default implementation if no specialization is provided an error is posted.

Template Parameters
ValueType_Data type of the logger element
Parameters
varPointer to log variable
namename of the log variable
grouplogger group the variable belongs to
unitunit of the log variable
dividerdivider is defining the update frequency of the logger element (ctrl_freq/divider)
actionlog action of the log variable
bufferSizesize of the buffer storing log elements
bufferTypedetermines the buffer type
template<typename ValueType_ >
std::enable_if<std::is_base_of<Eigen::MatrixBase<ValueType_>, ValueType_>::value>::type signal_logger::add ( const ValueType_ &  var,
Eigen::Ref< MatrixXstring names,
const std::string &  group = LOG_ELEMENT_DEFAULT_GROUP_NAME,
const std::string &  unit = LOG_ELEMENT_DEFAULT_UNIT,
const std::size_t  divider = LOG_ELEMENT_DEFAULT_DIVIDER,
const LogElementAction  action = LOG_ELEMENT_DEFAULT_ACTION,
const std::size_t  bufferSize = LOG_ELEMENT_DEFAULT_BUFFER_SIZE,
const BufferType  bufferType = LOG_ELEMENT_DEFAULT_BUFFER_TYPE 
)

Function implementation to add eigen matrices as their underlying type to the logger.

Parameters
varpointer to log matrix
namesname of every entry of the matrix
grouplogger group the variable belongs to
unitunit of the log variable
dividerdivider is defining the update frequency of the logger element (ctrl_freq/divider)
actionlog action of the log variable
bufferSizesize of the buffer storing log elements
bufferTypedetermines type of buffer
LoggerType signal_logger::getLoggerType ( )
Returns
the logger type
void signal_logger::setSignalLoggerNone ( )
void signal_logger::setSignalLoggerRos ( ros::NodeHandle *  nh)
void signal_logger::setSignalLoggerStd ( )

Variable Documentation

constexpr LogElementAction signal_logger::LOG_ELEMENT_DEFAULT_ACTION = LogElementAction::SAVE_AND_PUBLISH
static

Default log element action.

constexpr std::size_t signal_logger::LOG_ELEMENT_DEFAULT_BUFFER_SIZE = 1000
static

Default log element buffer size.

constexpr BufferType signal_logger::LOG_ELEMENT_DEFAULT_BUFFER_TYPE = BufferType::LOOPING
static

Default log element buffer type.

constexpr std::size_t signal_logger::LOG_ELEMENT_DEFAULT_DIVIDER = 1
static

Default log element divider.

constexpr const char* signal_logger::LOG_ELEMENT_DEFAULT_GROUP_NAME = "/log/"
static

Default log element group.

constexpr const char* signal_logger::LOG_ELEMENT_DEFAULT_UNIT = "-"
static

Default log element unit.

std::shared_ptr<SignalLoggerBase> signal_logger::logger

Reference to the logger.

constexpr const double signal_logger::LOGGER_DEFAULT_MAXIMUM_LOG_TIME = 10.0
static

Default maximal logging time.

constexpr const char* signal_logger::LOGGER_DEFAULT_NAME = "silo"
static

Default logger name.

constexpr const char* signal_logger::LOGGER_DEFAULT_PREFIX = "/log"
static

Default logger prefix.

constexpr const char* signal_logger::LOGGER_DEFAULT_SCRIPT_FILENAME = "logger.yaml"
static

Default logging script file name.

constexpr const double signal_logger::LOGGER_EXP_GROWING_MAXIMUM_LOG_TIME = 10.0
static

Default log time for exponentially growing time buffer.