Aikido
aikido::common Namespace Reference

Namespaces

 operators
 

Classes

class  BSpline
 
struct  DynamicCastFactory
 Call a template factory function based on runtime type of the first argument to a function. More...
 
struct  DynamicCastFactory< Factory, Pointer, BaseParameter, common::type_list< Arg, Args... > >
 
struct  DynamicCastFactory< Factory, Pointer, BaseParameter, common::type_list<> >
 
struct  DynamicCastFactory_raw_ptr
 Helper template class necessary to use raw pointers as the pointer type in DynamicCastFactory. More...
 
struct  DynamicCastFactory_shared_ptr
 Helper template class necessary to use std::shared_ptr as the pointer type in DynamicCastFactory. More...
 
class  ExecutorMultiplexer
 Combine multiple executors (i.e. More...
 
class  ExecutorThread
 ExecutorThread is a wrapper of std::thread that calls a callback periodically. More...
 
struct  PairHash
 Implements a hash function for pairs of std::hash-able types. More...
 
class  RNG
 Implementation of the C++11 "random engine" concept that uses virtual function calls to erase the type of the underlying random engine. More...
 
class  RNGWrapper
 Concrete implementation of the RNG type erasure class. More...
 
class  SplineND
 An arbitrary dimensional polynomial spline. More...
 
class  SplineProblem
 Utility for fitting splines given constraints on function value, derivative value, and continuity. More...
 
struct  SplineTraits
 
struct  SplineTraits< BSpline< _Scalar, _Dim, _Degree >, _DerivativeOrder >
 Compile-time attributes of the Spline class for fixed degree. More...
 
struct  SplineTraits< BSpline< _Scalar, _Dim, _Degree >, Eigen::Dynamic >
 Compile-time attributes of the Spline class for Dynamic degree. More...
 
class  StepSequence
 An iterator that returns a sequence of numbers between start point and end point stepping at a fixed stepsize. More...
 
class  type_list
 Wrapper for a variadic template parameter pack of types. More...
 
class  VanDerCorput
 Generator for the Van der Corput sequence, a low-discripancy sequence defined over a real interval. More...
 

Typedefs

using RNGPtr = std::shared_ptr< RNG >
 
using ConstRNGPtr = std::shared_ptr< const RNG >
 
using WeakRNGPtr = std::weak_ptr< RNG >
 
using WeakConstRNGPtr = std::weak_ptr< const RNG >
 
using UniqueRNGPtr = std::unique_ptr< RNG >
 
using UniqueConstRNGPtr = std::unique_ptr< const RNG >
 
typedef BSpline< float, 2 > BSpline2f
 2D float B-spline with dynamic degree. More...
 
typedef BSpline< float, 3 > BSpline3f
 3D float B-spline with dynamic degree. More...
 
typedef BSpline< double, 2 > BSpline2d
 2D double B-spline with dynamic degree. More...
 
typedef BSpline< double, 3 > BSpline3d
 3D double B-spline with dynamic degree. More...
 

Functions

template<class T , class Compare >
const T & clamp (const T &v, const T &lo, const T &hi, Compare comp)
 If v compares less than lo, returns lo; otherwise if hi compares less than v, returns hi; otherwise returns v. More...
 
template<class T >
const T & clamp (const T &v, const T &lo, const T &hi)
 Same as above, but uses std::less<T> to compare the values. More...
 
template<typename SplineType , typename DerivativeType >
void derivativesImpl (const SplineType &spline, typename SplineType::Scalar u, Eigen::DenseIndex order, DerivativeType &der)
 
template<typename T , typename... Args>
::std::unique_ptr< T > make_unique (Args &&... args)
 
template<class Engine , class Scalar , class Quaternion >
Quaternion sampleQuaternion (Engine &_engine, std::uniform_real_distribution< Scalar > &_distribution)
 Sample a unit quaternion uniformly at random. More...
 
Eigen::MatrixXd pseudoinverse (const Eigen::MatrixXd &mat, double eps=1e-6)
 Computes the Moore-Penrose pseudoinverse of a matrix. More...
 
std::vector< std::unique_ptr< common::RNG > > cloneRNGsFrom (RNG &_engine, std::size_t _numOutputs, std::size_t _numSeeds=NUM_DEFAULT_SEEDS)
 Deterministically create different _numOutputs random number generators of the same type as the input _engine. More...
 
std::vector< std::unique_ptr< common::RNG > > cloneRNGFrom (RNG &_engine, std::size_t _numSeeds=NUM_DEFAULT_SEEDS)
 Deterministically create a random number generator of the same type as the input _engine. More...
 
void printCollisionObject (const dart::collision::CollisionObject &collisionObject, std::ostream &stream)
 Prints a CollisionObject for debugging purposes. More...
 
void printCollisionResult (const dart::collision::CollisionResult &collisionResult, std::ostream &stream)
 Prints a CollisionResult for debugging purposes. More...
 
std::vector< std::string > split (const std::string &string, const std::string &delimiters=" \t")
 Splits (tokenizes) a string into substrings that are divided by the given delimiter tokens. More...
 

Variables

constexpr int NUM_DEFAULT_SEEDS {100}
 Default number of seeds to by cloneRNGsFrom to seed new engines. More...
 

Typedef Documentation

◆ BSpline2d

typedef BSpline<double, 2> aikido::common::BSpline2d

2D double B-spline with dynamic degree.

◆ BSpline2f

2D float B-spline with dynamic degree.

◆ BSpline3d

typedef BSpline<double, 3> aikido::common::BSpline3d

3D double B-spline with dynamic degree.

◆ BSpline3f

3D float B-spline with dynamic degree.

◆ ConstRNGPtr

using aikido::common::ConstRNGPtr = typedef std::shared_ptr< const RNG >

◆ RNGPtr

using aikido::common::RNGPtr = typedef std::shared_ptr< RNG >

◆ UniqueConstRNGPtr

using aikido::common::UniqueConstRNGPtr = typedef std::unique_ptr< const RNG >

◆ UniqueRNGPtr

using aikido::common::UniqueRNGPtr = typedef std::unique_ptr< RNG >

◆ WeakConstRNGPtr

using aikido::common::WeakConstRNGPtr = typedef std::weak_ptr< const RNG >

◆ WeakRNGPtr

using aikido::common::WeakRNGPtr = typedef std::weak_ptr< RNG >

Function Documentation

◆ clamp() [1/2]

template<class T >
const T & aikido::common::clamp ( const T &  v,
const T &  lo,
const T &  hi 
)

Same as above, but uses std::less<T> to compare the values.

◆ clamp() [2/2]

template<class T , class Compare >
const T & aikido::common::clamp ( const T &  v,
const T &  lo,
const T &  hi,
Compare  comp 
)

If v compares less than lo, returns lo; otherwise if hi compares less than v, returns hi; otherwise returns v.

Uses operator < to compare the values.

The behavior is undefined if the value of lo is greater than hi.

Parameters
[in]vThe value to clamp.
[in]loThe lower bound to clamp v to.
[in]hiThe upper bound to clamp v to.
[in]compComparison function object (i.e., an object that satisfies the requirements of Compare) which returns ​true if the first argument is less than the second. The signature of the comparison function should be equivalent to
bool cmp(const Type1& a, const Type2& b)
. The signature does not need to have const &, but the function object must not modify the objects passed to it. The types Type1 and Type2 must be such that an object of type T can be implicitly converted to both of them.
Returns
Reference to lo if v is less than lo, reference to hi if hi is less than v, otherwise reference to v.

◆ cloneRNGFrom()

std::vector<std::unique_ptr<common::RNG> > aikido::common::cloneRNGFrom ( RNG _engine,
std::size_t  _numSeeds = NUM_DEFAULT_SEEDS 
)

Deterministically create a random number generator of the same type as the input _engine.

This is implemented by using _engine to generate _numSeeds seeds, then using std::seed_seq to generate an uncorrelated seed to create the output engine.

Parameters
_enginerandom engine
_numSeedsnumber of seeds to use for initialization
Returns
new random number generators

◆ cloneRNGsFrom()

std::vector<std::unique_ptr<common::RNG> > aikido::common::cloneRNGsFrom ( RNG _engine,
std::size_t  _numOutputs,
std::size_t  _numSeeds = NUM_DEFAULT_SEEDS 
)

Deterministically create different _numOutputs random number generators of the same type as the input _engine.

This is implemented by using _engine to generate _numSeeds seeds, then using std::seed_seq to generate _numOutputs uncorrelated seeds to create the output engines.

Parameters
_enginerandom engine
_numOutputsnumber of RNGs to create
_numSeedsnumber of seeds to use for initialization
Returns
new random number generators

◆ derivativesImpl()

template<typename SplineType , typename DerivativeType >
void aikido::common::derivativesImpl ( const SplineType &  spline,
typename SplineType::Scalar  u,
Eigen::DenseIndex  order,
DerivativeType &  der 
)

◆ make_unique()

template<typename T , typename... Args>
::std::unique_ptr<T> aikido::common::make_unique ( Args &&...  args)

◆ printCollisionObject()

void aikido::common::printCollisionObject ( const dart::collision::CollisionObject &  collisionObject,
std::ostream &  stream 
)

Prints a CollisionObject for debugging purposes.

Parameters
collisionObjectobject to print
[out]streamto use for output

◆ printCollisionResult()

void aikido::common::printCollisionResult ( const dart::collision::CollisionResult &  collisionResult,
std::ostream &  stream 
)

Prints a CollisionResult for debugging purposes.

Parameters
collisionResultresult to print
[out]streamto use for output

◆ pseudoinverse()

Eigen::MatrixXd aikido::common::pseudoinverse ( const Eigen::MatrixXd &  mat,
double  eps = 1e-6 
)

Computes the Moore-Penrose pseudoinverse of a matrix.

Parameters
matinput matrix
epsrepresents tolerance
Returns
pseudo-inverse of mat

◆ sampleQuaternion()

template<class Engine , class Scalar , class Quaternion >
Quaternion aikido::common::sampleQuaternion ( Engine &  _engine,
std::uniform_real_distribution< Scalar > &  _distribution 
)

Sample a unit quaternion uniformly at random.

This function requires that the provided std::uniform_real_distribution has bounds of [ 0, 1 ].

Template Parameters
Enginetype of random engine
Scalartype of floating point scalar number
Quaterniontype of quaternion to create
Parameters
_enginerandom engine
_distributionuniform distribution over the range [ 0, 1 ]
Returns
sampled unit quaternion

◆ split()

std::vector<std::string> aikido::common::split ( const std::string &  string,
const std::string &  delimiters = " \t" 
)

Splits (tokenizes) a string into substrings that are divided by the given delimiter tokens.

Example:

std::string text = "HERB, the robot.";
auto res1 = split(text); // {"HERB,", "the", "robot."}
auto res2 = split(text, ","); // {"HERB", " the robot."}
auto res3 = split(text, "to"); // {"HERB, ", "he r", "b", "."}
Parameters
[in]stringInput string to be splitted.
[in]delimitersDelimiters where any character in this string is considered a delimiter, i.e. the string is interpreted as a set of delimiter characters, not as a single multi-character delimiter.
Returns
The splitted substrings. Space and tab are the default.

Variable Documentation

◆ NUM_DEFAULT_SEEDS

constexpr int aikido::common::NUM_DEFAULT_SEEDS {100}
constexpr

Default number of seeds to by cloneRNGsFrom to seed new engines.

aikido::common::split
std::vector< std::string > split(const std::string &string, const std::string &delimiters=" \t")
Splits (tokenizes) a string into substrings that are divided by the given delimiter tokens.