Drake
drake Namespace Reference

Namespaces

 assert
 
 automotive
 
 benchmarks
 
 bouncing_ball
 
 common
 
 detail
 
 examples
 
 geometry
 
 lcm
 
 logging
 
 maliput
 
 manipulation
 
 math
 
 multibody
 
 nice_type_name_test
 
 parsers
 
 perception
 
 solvers
 
 symbolic
 
 systems
 
 test
 
 tools
 
 util
 

Classes

class  copyable_unique_ptr
 A smart pointer with deep copy semantics. More...
 
struct  dummy_value
 Provides a "dummy" value for a ScalarType – a value that is unlikely to be mistaken for a purposefully-computed value, useful for initializing a value before the true result is available. More...
 
struct  dummy_value< Eigen::AutoDiffScalar< DerType > >
 Specializes common/dummy_value.h. More...
 
struct  dummy_value< int >
 
struct  dummy_value< symbolic::Expression >
 Specializes common/dummy_value.h. More...
 
class  EigenPtr
 This wrapper class provides a way to write non-template functions taking raw pointers to Eigen objects as parameters while limiting the number of copies, similar to Eigen::Ref. More...
 
struct  EigenSizeMinPreferDynamic
 EigenSizeMinPreferDynamic<a, b>::value gives the min between compile-time sizes a and b. More...
 
struct  EigenSizeMinPreferFixed
 EigenSizeMinPreferFixed is a variant of EigenSizeMinPreferDynamic. More...
 
class  FindResourceResult
 Models the outcome of drake::FindResource. More...
 
struct  hash_value
 Computes the hash value of v using std::hash. More...
 
struct  hash_value< std::map< T1, T2 > >
 Computes the hash value of a map map. More...
 
struct  hash_value< std::pair< T1, T2 > >
 Computes the hash value of a pair p. More...
 
struct  hash_value< std::set< T > >
 Computes the hash value of a set s. More...
 
struct  hash_value< std::vector< T > >
 Computes the hash value of a vector vec. More...
 
struct  hash_value< symbolic::Expression >
 Computes the hash value of a symbolic expression. More...
 
struct  hash_value< symbolic::Formula >
 Computes the hash value of a symbolic formula. More...
 
struct  hash_value< symbolic::Monomial >
 Computes the hash value of a Monomial. More...
 
struct  hash_value< symbolic::Variable >
 Computes the hash value of a variable. More...
 
struct  hash_value< symbolic::Variables >
 Computes the hash value of a symbolic variables. More...
 
struct  is_eigen_nonvector_expression_double_pair
 
struct  is_eigen_nonvector_of
 
struct  is_eigen_scalar_same
 
struct  is_eigen_type
 
struct  is_eigen_vector
 
struct  is_eigen_vector_expression_double_pair
 
struct  is_eigen_vector_of
 
struct  is_numeric
 is_numeric is true for types that are on the real line. More...
 
struct  is_numeric< symbolic::Expression >
 Specializes is_numeric to be false for symbolic::Expression type. More...
 
struct  MultiplyEigenSizes
 MultiplyEigenSizes<a, b> gives a * b if both of a and b are fixed sizes. More...
 
class  never_destroyed
 Wraps an underlying type T such that its storage is a direct member field of this object (i.e., without any indirection into the heap), but unlike most member fields T's destructor is never invoked. More...
 
class  NiceTypeName
 Obtains canonicalized, platform-independent, human-readable names for arbitrarily-complicated C++ types. More...
 
class  PiecewisePolynomialTrajectory
 A PiecewisePolynomialTrajectory is a Trajectory that is represented by (implemented in terms of) a PiecewisePolynomial. More...
 
class  PiecewiseQuaternionSlerp
 A class representing a trajectory for quaternions that are interpolated using piecewise slerp (spherical linear interpolation). More...
 
class  reinit_after_move
 Type wrapper that performs value-initialization on the wrapped type, and guarantees that when moving from this type that the donor object is reset to its value-initialized value. More...
 
class  Trajectory
 A Trajectory represents a time-varying matrix of doubles. More...
 
class  TypeSafeIndex
 A type-safe non-negative index class. More...
 

Typedefs

template<typename T >
using is_copyable_unique_ptr_compatible = copyable_unique_ptr_detail::is_copyable_unique_ptr_compatible_helper< T, void >
 Test for determining if an arbitrary class is compatible with the copyable_unique_ptr. More...
 
template<typename T >
using optional = stx::optional< T >
 
using AutoDiffUpTo73d = Eigen::AutoDiffScalar< VectorUpTo73d >
 An autodiff variable with a dynamic number of partials, up to 73 maximum. More...
 
using AutoDiffXd = Eigen::AutoDiffScalar< Eigen::VectorXd >
 An autodiff variable with a dynamic number of partials. More...
 
template<int num_vars>
using AutoDiffd = Eigen::AutoDiffScalar< Eigen::Matrix< double, num_vars, 1 > >
 An autodiff variable with num_vars partials. More...
 
template<int num_vars, int rows>
using AutoDiffVecd = Eigen::Matrix< AutoDiffd< num_vars >, rows, 1 >
 A vector of rows autodiff variables, each with num_vars partials. More...
 
typedef AutoDiffVecd< Eigen::Dynamic, Eigen::Dynamic > AutoDiffVecXd
 A dynamic-sized vector of autodiff variables, each with a dynamic-sized vector of partials. More...
 
template<typename Key , typename T >
using eigen_aligned_std_map = std::map< Key, T, std::less< Key >, Eigen::aligned_allocator< std::pair< Key const, T >>>
 A std::map that uses Eigen::aligned_allocator so that the contained types may be fixed-size Eigen values. More...
 
template<typename Key , typename T >
using eigen_aligned_std_unordered_map = std::unordered_map< Key, T, std::hash< Key >, std::equal_to< Key >, Eigen::aligned_allocator< std::pair< Key const, T >>>
 A std::unordered_map that uses Eigen::aligned_allocator so that the contained types may be fixed-size Eigen values. More...
 
template<typename T >
using eigen_aligned_std_vector = std::vector< T, Eigen::aligned_allocator< T >>
 A std::vector that uses Eigen::aligned_allocator so that the contained types may be fixed-size Eigen values. More...
 
template<typename Scalar >
using Vector1 = Eigen::Matrix< Scalar, 1, 1 >
 A column vector of size 1 (that is, a scalar), templated on scalar type. More...
 
using Vector1d = Eigen::Matrix< double, 1, 1 >
 A column vector of size 1 of doubles. More...
 
template<typename Scalar >
using Vector2 = Eigen::Matrix< Scalar, 2, 1 >
 A column vector of size 2, templated on scalar type. More...
 
template<typename Scalar >
using Vector3 = Eigen::Matrix< Scalar, 3, 1 >
 A column vector of size 3, templated on scalar type. More...
 
template<typename Scalar >
using Vector4 = Eigen::Matrix< Scalar, 4, 1 >
 A column vector of size 4, templated on scalar type. More...
 
template<typename Scalar >
using Vector6 = Eigen::Matrix< Scalar, 6, 1 >
 A column vector of size 6. More...
 
template<typename Scalar >
using VectorX = Eigen::Matrix< Scalar, Eigen::Dynamic, 1 >
 A column vector of any size, templated on scalar type. More...
 
template<typename Scalar >
using VectorUpTo6 = Eigen::Matrix< Scalar, Eigen::Dynamic, 1, 0, 6, 1 >
 A vector of dynamic size templated on scalar type, up to a maximum of 6 elements. More...
 
template<typename Scalar >
using Matrix2 = Eigen::Matrix< Scalar, 2, 2 >
 A matrix of 2 rows and 2 columns, templated on scalar type. More...
 
template<typename Scalar >
using Matrix3 = Eigen::Matrix< Scalar, 3, 3 >
 A matrix of 3 rows and 3 columns, templated on scalar type. More...
 
template<typename Scalar >
using Matrix4 = Eigen::Matrix< Scalar, 4, 4 >
 A matrix of 4 rows and 4 columns, templated on scalar type. More...
 
template<typename Scalar >
using Matrix6 = Eigen::Matrix< Scalar, 6, 6 >
 A matrix of 6 rows and 6 columns, templated on scalar type. More...
 
template<typename Scalar >
using Matrix2X = Eigen::Matrix< Scalar, 2, Eigen::Dynamic >
 A matrix of 2 rows, dynamic columns, templated on scalar type. More...
 
template<typename Scalar >
using Matrix3X = Eigen::Matrix< Scalar, 3, Eigen::Dynamic >
 A matrix of 3 rows, dynamic columns, templated on scalar type. More...
 
template<typename Scalar >
using Matrix4X = Eigen::Matrix< Scalar, 4, Eigen::Dynamic >
 A matrix of 4 rows, dynamic columns, templated on scalar type. More...
 
template<typename Scalar >
using Matrix6X = Eigen::Matrix< Scalar, 6, Eigen::Dynamic >
 A matrix of 6 rows, dynamic columns, templated on scalar type. More...
 
template<typename Scalar >
using MatrixX = Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic >
 A matrix of dynamic size, templated on scalar type. More...
 
template<typename Scalar >
using MatrixUpTo6 = Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic, 0, 6, 6 >
 A matrix of dynamic size templated on scalar type, up to a maximum of 6 rows and 6 columns. More...
 
template<typename Scalar >
using Quaternion = Eigen::Quaternion< Scalar >
 A quaternion templated on scalar type. More...
 
template<typename Scalar >
using AngleAxis = Eigen::AngleAxis< Scalar >
 An AngleAxis templated on scalar type. More...
 
template<typename Scalar >
using Isometry3 = Eigen::Transform< Scalar, 3, Eigen::Isometry >
 An Isometry templated on scalar type. More...
 
template<typename Scalar >
using Translation3 = Eigen::Translation< Scalar, 3 >
 A translation in 3D templated on scalar type. More...
 
using VectorUpTo73d = Eigen::Matrix< double, Eigen::Dynamic, 1, 0, 73, 1 >
 A column vector of dynamic size, up to a maximum of 73 elements. More...
 
template<typename Scalar >
using TwistVector = Eigen::Matrix< Scalar, kTwistSize, 1 >
 A column vector consisting of one twist. More...
 
template<typename Scalar >
using TwistMatrix = Eigen::Matrix< Scalar, kTwistSize, Eigen::Dynamic >
 A matrix with one twist per column, and dynamically many columns. More...
 
template<typename Scalar >
using SquareTwistMatrix = Eigen::Matrix< Scalar, kTwistSize, kTwistSize >
 A six-by-six matrix. More...
 
template<typename Scalar >
using WrenchVector = Eigen::Matrix< Scalar, 6, 1 >
 A column vector consisting of one wrench (spatial force) = [r X f; f], where f is a force (translational force) applied at a point P and r is the position vector from a point O (called the "moment center") to point P. More...
 
template<typename Scalar >
using SpatialForce = Eigen::Matrix< Scalar, 6, 1 >
 A column vector consisting of a concatenated rotational and translational force. More...
 
using Result = FindResourceResult
 
template<typename T >
using is_cloneable = is_cloneable_detail::is_cloneable_helper< T, void >
 

Enumerations

enum  MatrixCompareType { absolute, relative }
 

Functions

template<typename DerType >
double ExtractDoubleOrThrow (const Eigen::AutoDiffScalar< DerType > &scalar)
 Returns the autodiff scalar's value() as a double. More...
 
template<typename DerType1 , typename DerType2 >
Eigen::AutoDiffScalar< typename Eigen::internal::remove_all< DerType1 >::type::PlainObject > if_then_else (bool f_cond, const Eigen::AutoDiffScalar< DerType1 > &x, const Eigen::AutoDiffScalar< DerType2 > &y)
 Provides if-then-else expression for Eigen::AutoDiffScalar type. More...
 
template<typename DerType , typename... Rest>
Eigen::AutoDiffScalar< typename Eigen::internal::remove_all< DerType >::type::PlainObject > cond (bool f_cond, const Eigen::AutoDiffScalar< DerType > &e_then, Rest...rest)
 Provides special case of cond expression for Eigen::AutoDiffScalar type. More...
 
double if_then_else (bool f_cond, double v_then, double v_else)
 Provides if-then-else expression for double. More...
 
std::string GetDrakePath ()
 Returns the fully-qualified path to the root of the drake source tree. More...
 
::testing::AssertionResult ExpectRotMat (const Eigen::Matrix3d &R, double tolerance)
 Expects that a rotation matrix belongs to SO(3): R ∈ SO(3) => Rᵀ R = I (orthonormal) det(R) = 1 (right-hand rule) More...
 
::testing::AssertionResult CompareTransforms (const Eigen::Isometry3d &X_expected, const Eigen::Isometry3d &X_actual, double tolerance)
 Compares two SE(3) Transforms. More...
 
template<typename DerivedA , typename DerivedB >
::testing::AssertionResult CompareMatrices (const Eigen::MatrixBase< DerivedA > &m1, const Eigen::MatrixBase< DerivedB > &m2, double tolerance=0.0, MatrixCompareType compare_type=MatrixCompareType::absolute)
 Compares two matrices to determine whether they are equal to within a certain threshold. More...
 
template<typename T >
double ExtractDoubleOrThrow (const T &scalar)
 Converts a ScalarType value to a double, failing at runtime (not compile time) if the type cannot be converted to a double. More...
 
double ExtractDoubleOrThrow (double scalar)
 Returns scalar as a double. Never throws. More...
 
Result FindResource (std::string resource_path)
 Attempts to locate a Drake resource named by the given resource_path. More...
 
std::string FindResourceOrThrow (std::string resource_path)
 Convenient wrapper for querying FindResource(resource_path) followed by FindResourceResult::get_absolute_path_or_throw(). More...
 
template<class T >
size_t hash_combine (size_t seed, const T &v)
 Combines a given hash value seed and a hash of parameter v. More...
 
template<class T , class... Rest>
size_t hash_combine (size_t seed, const T &v, Rest...rest)
 
template<typename It >
size_t hash_range (It first, It last)
 Computes the combined hash value of the elements of an iterator range. More...
 
template<typename DerivedA , typename DerivedB >
bool is_approx_equal_abstol (const Eigen::MatrixBase< DerivedA > &m1, const Eigen::MatrixBase< DerivedB > &m2, double tolerance)
 Returns true if and only if the two matrices are equal to within a certain absolute elementwise tolerance. More...
 
template<typename DerivedA , typename DerivedB >
bool IsApproxEqualAbsTolWithPermutedColumns (const Eigen::MatrixBase< DerivedA > &m1, const Eigen::MatrixBase< DerivedB > &m2, double tolerance)
 Returns true if and only if a simple greedy search reveals a permutation of the columns of m2 to make the matrix equal to m1 to within a certain absolute elementwise tolerance. More...
 
std::unique_ptr< google::protobuf::io::FileInputStream > MakeFileInputStreamOrThrow (const std::string &path)
 Returns a self-closing FileInputStream for the file at the given path, or else throws std::runtime_error. More...
 
template<typename T >
bool SortedVectorsHaveIntersection (const std::vector< T > &a, const std::vector< T > &b)
 Checks for the existence of a non-empty intersection between two sorted std::vector's. More...
 
template<typename... Rest>
symbolic::Expression cond (const symbolic::Formula &f_cond, double v_then, Rest...rest)
 Provides specialization of cond function defined in drake/common/cond.h file. More...
 
template<typename ToType , typename FromType >
::testing::AssertionResult is_dynamic_castable (const FromType *ptr)
 Checks if ptr, a pointer to FromType class, can be safely converted to a pointer to ToType class. More...
 
template<typename ToType , typename FromType >
::testing::AssertionResult is_dynamic_castable (std::shared_ptr< FromType > ptr)
 Checks if ptr, a shared pointer to FromType class, can be safely converted to a shared pointer to ToType class. More...
 
template<typename ToType , typename FromType >
::testing::AssertionResult is_dynamic_castable (const std::unique_ptr< FromType > &ptr)
 Checks if ptr, a shared pointer to FromType class, can be safely converted to a shared pointer to ToType class. More...
 
logging::loggerlog ()
 Retrieve an instance of a logger to use for logging; for example: drake::log()->info("potato!") More...
 
template<typename... Args>
void unused (const Args &...)
 Documents the argument(s) as unused, placating GCC's -Wunused-parameter warning. More...
 
void ComputeRegionOfAttraction ()
 
cond

Constructs conditional expression (similar to Lisp's cond).

  cond(cond_1, expr_1,
       cond_2, expr_2,
          ...,   ...,
       cond_n, expr_n,
       expr_{n+1})

The value returned by the above cond expression is expr_1 if cond_1 is true; else if cond_2 is true then expr_2; ... ; else if cond_n is true then expr_n. If none of the conditions are true, it returns expr_{n+1}.

Note
This functions assumes that ScalarType provides operator< and the type of f_cond is the type of the return type of operator<(ScalarType, ScalarType). For example, symbolic::Expression can be used as a ScalarType because it provides symbolic::Formula operator<(symbolic::Expression, symbolic::Expression).
template<typename ScalarType >
ScalarType cond (const ScalarType &e)
 
template<typename ScalarType , typename... Rest>
ScalarType cond (const decltype(ScalarType()< ScalarType())&f_cond, const ScalarType &e_then, Rest...rest)
 

Variables

constexpr int kQuaternionSize = 4
 
constexpr int kSpaceDimension = 3
 
constexpr int kRpySize = 3
 
constexpr int kTwistSize = 6
 https://en.wikipedia.org/wiki/Screw_theory#Twist More...
 
constexpr int kHomogeneousTransformSize = 16
 http://www.euclideanspace.com/maths/geometry/affine/matrix4x4/ More...
 
const int kRotmatSize = kSpaceDimension * kSpaceDimension
 
constexpr auto nullopt = stx::nullopt
 
const char *const kDrakeResourceRootEnvironmentVariableName
 The name of the environment variable that provides the first place where FindResource attempts to look. More...
 

Typedef Documentation

using AngleAxis = Eigen::AngleAxis<Scalar>

An AngleAxis templated on scalar type.

using AutoDiffd = Eigen::AutoDiffScalar<Eigen::Matrix<double, num_vars, 1> >

An autodiff variable with num_vars partials.

using AutoDiffUpTo73d = Eigen::AutoDiffScalar<VectorUpTo73d>

An autodiff variable with a dynamic number of partials, up to 73 maximum.

using AutoDiffVecd = Eigen::Matrix<AutoDiffd<num_vars>, rows, 1>

A vector of rows autodiff variables, each with num_vars partials.

typedef AutoDiffVecd<Eigen::Dynamic, Eigen::Dynamic> AutoDiffVecXd

A dynamic-sized vector of autodiff variables, each with a dynamic-sized vector of partials.

using AutoDiffXd = Eigen::AutoDiffScalar<Eigen::VectorXd>

An autodiff variable with a dynamic number of partials.

using eigen_aligned_std_map = std::map<Key, T, std::less<Key>, Eigen::aligned_allocator<std::pair<Key const, T>>>

A std::map that uses Eigen::aligned_allocator so that the contained types may be fixed-size Eigen values.

using eigen_aligned_std_unordered_map = std::unordered_map<Key, T, std::hash<Key>, std::equal_to<Key>, Eigen::aligned_allocator<std::pair<Key const, T>>>

A std::unordered_map that uses Eigen::aligned_allocator so that the contained types may be fixed-size Eigen values.

using eigen_aligned_std_vector = std::vector<T, Eigen::aligned_allocator<T>>

A std::vector that uses Eigen::aligned_allocator so that the contained types may be fixed-size Eigen values.

using is_cloneable = is_cloneable_detail::is_cloneable_helper<T, void>

Provides method for determining at run time if a class is "cloneable".

Usage

This gets used like type_traits functions (e.g., is_copy_constructible, is_same, etc.) To determine if a class is cloneable simply invoke:

If Foo is cloneable, it will evalute to true. It can also be used in compile-time tests (e.g., SFINAE and static_asserts):

static_assert(is_cloneable<Foo>::value, "This method requires its classes to "
"be cloneable.");

Definition of "cloneability"

To be cloneable, the class Foo must have a public method of the form:

unique_ptr<Foo> Foo::Clone() const;

The pointer contained in the returned unique_ptr must point to a heap-allocated deep copy of the concrete object. This test can confirm the proper signature, but cannot confirm the heap-allocated deep copy. A Clone() method that doesn't return such a copy of the concrete object should be considered a malformed function.

Warning
It is important to note, that a Clone() method that returns a unique_ptr to a super class is not sufficient to be cloneable. In other words the presence of:
unique_ptr<Base> Derived::Clone() const;
will not make the Derived class cloneable.
Template Parameters
TThe class to test for cloneability.
using is_copyable_unique_ptr_compatible = copyable_unique_ptr_detail::is_copyable_unique_ptr_compatible_helper<T, void>

Test for determining if an arbitrary class is compatible with the copyable_unique_ptr.

For a class to be compatible with the copy_unique_ptr, it must be copy constructible or "cloneable" (see is_cloneable). Usage:

Evaluates to true if compatible, false otherwise. This can be used in run-time test, static_asserts, and in SFINAE voodoo.

See also
copyable_unique_ptr
is_cloneable
using Isometry3 = Eigen::Transform<Scalar, 3, Eigen::Isometry>

An Isometry templated on scalar type.

using Matrix2 = Eigen::Matrix<Scalar, 2, 2>

A matrix of 2 rows and 2 columns, templated on scalar type.

using Matrix2X = Eigen::Matrix<Scalar, 2, Eigen::Dynamic>

A matrix of 2 rows, dynamic columns, templated on scalar type.

using Matrix3 = Eigen::Matrix<Scalar, 3, 3>

A matrix of 3 rows and 3 columns, templated on scalar type.

using Matrix3X = Eigen::Matrix<Scalar, 3, Eigen::Dynamic>

A matrix of 3 rows, dynamic columns, templated on scalar type.

using Matrix4 = Eigen::Matrix<Scalar, 4, 4>

A matrix of 4 rows and 4 columns, templated on scalar type.

using Matrix4X = Eigen::Matrix<Scalar, 4, Eigen::Dynamic>

A matrix of 4 rows, dynamic columns, templated on scalar type.

using Matrix6 = Eigen::Matrix<Scalar, 6, 6>

A matrix of 6 rows and 6 columns, templated on scalar type.

using Matrix6X = Eigen::Matrix<Scalar, 6, Eigen::Dynamic>

A matrix of 6 rows, dynamic columns, templated on scalar type.

using MatrixUpTo6 = Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic, 0, 6, 6>

A matrix of dynamic size templated on scalar type, up to a maximum of 6 rows and 6 columns.

Rectangular matrices, with different number of rows and columns, are allowed.

using MatrixX = Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic>

A matrix of dynamic size, templated on scalar type.

using optional = stx::optional<T>
using Quaternion = Eigen::Quaternion<Scalar>

A quaternion templated on scalar type.

using SpatialForce = Eigen::Matrix<Scalar, 6, 1>

A column vector consisting of a concatenated rotational and translational force.

The wrench is a special case of a SpatialForce. For a general SpatialForce the rotational force can be a pure torque or the accumulation of moments and need not necessarily be a function of the force term.

using SquareTwistMatrix = Eigen::Matrix<Scalar, kTwistSize, kTwistSize>

A six-by-six matrix.

using Translation3 = Eigen::Translation<Scalar, 3>

A translation in 3D templated on scalar type.

using TwistMatrix = Eigen::Matrix<Scalar, kTwistSize, Eigen::Dynamic>

A matrix with one twist per column, and dynamically many columns.

using TwistVector = Eigen::Matrix<Scalar, kTwistSize, 1>

A column vector consisting of one twist.

using Vector1 = Eigen::Matrix<Scalar, 1, 1>

A column vector of size 1 (that is, a scalar), templated on scalar type.

using Vector1d = Eigen::Matrix<double, 1, 1>

A column vector of size 1 of doubles.

using Vector2 = Eigen::Matrix<Scalar, 2, 1>

A column vector of size 2, templated on scalar type.

using Vector3 = Eigen::Matrix<Scalar, 3, 1>

A column vector of size 3, templated on scalar type.

using Vector4 = Eigen::Matrix<Scalar, 4, 1>

A column vector of size 4, templated on scalar type.

using Vector6 = Eigen::Matrix<Scalar, 6, 1>

A column vector of size 6.

using VectorUpTo6 = Eigen::Matrix<Scalar, Eigen::Dynamic, 1, 0, 6, 1>

A vector of dynamic size templated on scalar type, up to a maximum of 6 elements.

using VectorUpTo73d = Eigen::Matrix<double, Eigen::Dynamic, 1, 0, 73, 1>

A column vector of dynamic size, up to a maximum of 73 elements.

using VectorX = Eigen::Matrix<Scalar, Eigen::Dynamic, 1>

A column vector of any size, templated on scalar type.

using WrenchVector = Eigen::Matrix<Scalar, 6, 1>

A column vector consisting of one wrench (spatial force) = [r X f; f], where f is a force (translational force) applied at a point P and r is the position vector from a point O (called the "moment center") to point P.

Enumeration Type Documentation

enum MatrixCompareType
strong
Enumerator
absolute 
relative 

Function Documentation

::testing::AssertionResult drake::CompareMatrices ( const Eigen::MatrixBase< DerivedA > &  m1,
const Eigen::MatrixBase< DerivedB > &  m2,
double  tolerance = 0.0,
MatrixCompareType  compare_type = MatrixCompareType::absolute 
)

Compares two matrices to determine whether they are equal to within a certain threshold.

Parameters
m1The first matrix to compare.
m2The second matrix to compare.
toleranceThe tolerance for determining equivalence.
compare_typeWhether the tolereance is absolute or relative.
explanationA pointer to a string variable for saving an explanation of why m1 and m2 are unequal. This parameter is optional and defaults to nullptr. If this is nullptr and m1 and m2 are not equal, an explanation is logged as an error message.
Returns
true if the two matrices are equal based on the specified tolerance.

Here is the call graph for this function:

Here is the caller graph for this function:

testing::AssertionResult CompareTransforms ( const Eigen::Isometry3d &  X_expected,
const Eigen::Isometry3d &  X_actual,
double  tolerance 
)

Compares two SE(3) Transforms.

Parameters
X_expectedExpected SE(3) transform.
X_actualActual SE(3) transform.
toleranceThe tolerance for determining equivalence for the rotation matrix cases (using ExpectRotMat) and comparing both transforms as matrices.

Here is the call graph for this function:

void drake::ComputeRegionOfAttraction ( )

Here is the call graph for this function:

Here is the caller graph for this function:

ScalarType drake::cond ( const ScalarType &  e)
ScalarType drake::cond ( const decltype(ScalarType()< ScalarType())&  f_cond,
const ScalarType &  e_then,
Rest...  rest 
)

Here is the call graph for this function:

Eigen::AutoDiffScalar< typename Eigen::internal::remove_all<DerType>::type::PlainObject> drake::cond ( bool  f_cond,
const Eigen::AutoDiffScalar< DerType > &  e_then,
Rest...  rest 
)

Provides special case of cond expression for Eigen::AutoDiffScalar type.

Here is the call graph for this function:

Here is the caller graph for this function:

symbolic::Expression drake::cond ( const symbolic::Formula f_cond,
double  v_then,
Rest...  rest 
)

Provides specialization of cond function defined in drake/common/cond.h file.

This specialization is required to handle double to symbolic::Expression conversion so that we can write one such as cond(x > 0.0, 1.0, -1.0).

Here is the call graph for this function:

testing::AssertionResult ExpectRotMat ( const Eigen::Matrix3d &  R,
double  tolerance 
)

Expects that a rotation matrix belongs to SO(3): R ∈ SO(3) => Rᵀ R = I (orthonormal) det(R) = 1 (right-hand rule)

Parameters
RRotation matrix.
toleranceThe tolerance for determining equivalence for the orthonormal and right-hand rule cases.

Here is the call graph for this function:

Here is the caller graph for this function:

double drake::ExtractDoubleOrThrow ( const T &  scalar)

Converts a ScalarType value to a double, failing at runtime (not compile time) if the type cannot be converted to a double.

This function is useful for writing ScalarType-generic code that (1) is only intended to be used on numeric types, (2) can reasonably discard any supplemental scalar data, e.g., the derivatives of an AutoDiffScalar, and (3) is reasonable to fail at runtime if called with a non-numeric ScalarType.

The default implementation throws an exception. ScalarTypes that are numeric must overload this method to provide an appropriate extraction. An overload for double is already provided.

See autodiff_overloads.h to use this with Eigen's AutoDiffScalar. See number_traits.h for specifying which ScalarTypes are numeric.

double drake::ExtractDoubleOrThrow ( double  scalar)
inline

Returns scalar as a double. Never throws.

double drake::ExtractDoubleOrThrow ( const Eigen::AutoDiffScalar< DerType > &  scalar)

Returns the autodiff scalar's value() as a double.

Never throws. Overloads ExtractDoubleOrThrow from common/extract_double.h.

Here is the caller graph for this function:

FindResourceResult FindResource ( std::string  resource_path)

Attempts to locate a Drake resource named by the given resource_path.

The resource_path refers to the relative path within the Drake repository, e.g., drake/examples/pendulum/Pendulum.urdf.

When called from within a source code workspace (i.e., what a Drake developer would use), this finds the resource within the current workspace.

When called from an installed binary build of Drake, this is intended to find the installed resource, but that feature is not yet implemented.

Here is the call graph for this function:

Here is the caller graph for this function:

std::string FindResourceOrThrow ( std::string  resource_path)

Convenient wrapper for querying FindResource(resource_path) followed by FindResourceResult::get_absolute_path_or_throw().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string GetDrakePath ( )

Returns the fully-qualified path to the root of the drake source tree.

N.B: not the drake-distro source tree.

Here is the call graph for this function:

size_t hash_combine ( size_t  seed,
const T &  v 
)
inline

Combines a given hash value seed and a hash of parameter v.

Combines two hash values into one.

The following code is public domain according to http://www.burtleburtle.net/bob/hash/doobs.html.

Here is the caller graph for this function:

size_t drake::hash_combine ( size_t  seed,
const T &  v,
Rest...  rest 
)

Here is the call graph for this function:

size_t drake::hash_range ( It  first,
It  last 
)

Computes the combined hash value of the elements of an iterator range.

Here is the call graph for this function:

Here is the caller graph for this function:

double drake::if_then_else ( bool  f_cond,
double  v_then,
double  v_else 
)
inline

Provides if-then-else expression for double.

The value returned by the if-then-else expression is v_then if f_cond is true. Otherwise, it returns v_else. The semantics is similar but not exactly the same as C++'s conditional expression constructed by its ternary operator, ?:. In if_then_else(f_cond, v_then, v_else), both of v_then and v_else are evaluated regardless of the evaluation of f_cond. In contrast, only one of v_then or v_else is evaluated in C++'s conditional expression f_cond ? v_then : v_else.

Eigen::AutoDiffScalar< typename Eigen::internal::remove_all<DerType1>::type::PlainObject> drake::if_then_else ( bool  f_cond,
const Eigen::AutoDiffScalar< DerType1 > &  x,
const Eigen::AutoDiffScalar< DerType2 > &  y 
)
inline

Provides if-then-else expression for Eigen::AutoDiffScalar type.

To support Eigen's generic expressions, we use casting to the plain object after applying Eigen::internal::remove_all. It is based on the Eigen's implementation of min/max function for AutoDiffScalar type (https://bitbucket.org/eigen/eigen/src/10a1de58614569c9250df88bdfc6402024687bc6/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h?at=default&fileviewer=file-view-default#AutoDiffScalar.h-546).

Here is the caller graph for this function:

bool drake::is_approx_equal_abstol ( const Eigen::MatrixBase< DerivedA > &  m1,
const Eigen::MatrixBase< DerivedB > &  m2,
double  tolerance 
)

Returns true if and only if the two matrices are equal to within a certain absolute elementwise tolerance.

Special values (infinities, NaN, etc.) do not compare as equal elements.

Here is the caller graph for this function:

::testing::AssertionResult drake::is_dynamic_castable ( const FromType *  ptr)

Checks if ptr, a pointer to FromType class, can be safely converted to a pointer to ToType class.

Our motivation is to provide a good diagnostic for what ptr actually was when the test fails.

Here is an illustrative code snippet. We assume that Prius and Camry are derived classes of Car.

const Car* prius = new Prius{};
// The following assertion fails without diagnostic info.
EXPECT_TRUE(dynamic_cast<Camry>(ptr) != nullptr)
// The following assertion returns `::testing::AssertionFailure()` with
// diagnostic info attached.
EXPECT_TRUE(is_dynamic_castable<Camry>(prius));
// Output:
// Value of: is_dynamic_castable<Camry>(prius)
// Actual: false (is_dynamic_castable<Camry>(Car* ptr) failed
// because ptr is of dynamic type Prius.)
// Expected: true

Here is the call graph for this function:

::testing::AssertionResult drake::is_dynamic_castable ( std::shared_ptr< FromType >  ptr)

Checks if ptr, a shared pointer to FromType class, can be safely converted to a shared pointer to ToType class.

Our motivation is to provide a good diagnostic for what ptr actually was when the test fails.

::testing::AssertionResult drake::is_dynamic_castable ( const std::unique_ptr< FromType > &  ptr)

Checks if ptr, a shared pointer to FromType class, can be safely converted to a shared pointer to ToType class.

Our motivation is to provide a good diagnostic for what ptr actually was when the test fails.

bool drake::IsApproxEqualAbsTolWithPermutedColumns ( const Eigen::MatrixBase< DerivedA > &  m1,
const Eigen::MatrixBase< DerivedB > &  m2,
double  tolerance 
)

Returns true if and only if a simple greedy search reveals a permutation of the columns of m2 to make the matrix equal to m1 to within a certain absolute elementwise tolerance.

E.g., there exists a P such that

   forall i,j,  |m1 - m2*P|_{i,j} <= tolerance
   where P is a permutation matrix:
      P(i,j)={0,1}, sum_i P(i,j)=1, sum_j P(i,j)=1.

Note: Returns false for matrices of different sizes. Note: The current implementation is O(n^2) in the number of columns. Note: In marginal cases (with similar but not identical columns) this algorithm can fail to find a permutation P even if it exists because it accepts the first column match (m1(i),m2(j)) and removes m2(j) from the pool. It is possible that other columns of m2 would also match m1(i) but that m2(j) is the only match possible for a later column of m1.

Here is the call graph for this function:

logging::logger * log ( )

Retrieve an instance of a logger to use for logging; for example: drake::log()->info("potato!")

Here is the caller graph for this function:

std::unique_ptr< google::protobuf::io::FileInputStream > MakeFileInputStreamOrThrow ( const std::string &  path)

Returns a self-closing FileInputStream for the file at the given path, or else throws std::runtime_error.

Here is the caller graph for this function:

bool drake::SortedVectorsHaveIntersection ( const std::vector< T > &  a,
const std::vector< T > &  b 
)

Checks for the existence of a non-empty intersection between two sorted std::vector's.

Parameters
[in]aFirst vector.
[in]bSecond vector.
Template Parameters
TThe type of the elements in the input vectors a and b. This is expected to be an integral type or a pointer type.
Returns
true if there is a non-empty intersection between vectors; false otherwise.

Elements are compared using operator< and the vectors must be sorted with respect to the same operator.

This algorithm only works on std::vector's to take advantage of their fast and random access.

Entries can be repeated as long as they are sorted. For vector a of size Na and vector b of size Nb the complexity is at most Order(Na + Nb). The algorithm executes in constant time for vectors with disjoint entries. An example of the worst case scenario is given below:

 a = (10, 20, 30)
 b = (15, 25, 35)

In this case the algorithm needs to scan both vectors from start to end.

Here is the caller graph for this function:

void drake::unused ( const Args &  ...)

Documents the argument(s) as unused, placating GCC's -Wunused-parameter warning.

This can be called within function bodies to mark that certain parameters are unused.

When possible, removing the unused parameter is better than placating the warning. However, in some cases the parameter is part of a virtual API or template concept that is used elsewhere, so we can't remove it. In those cases, this function might be an appropriate work-around.

Here's rough advice on how to fix Wunused-parameter warnings:

(1) If the parameter can be removed entirely, prefer that as the first choice. (This may not be possible if, e.g., a method must match some virtual API or template concept.)

(2) Unless the parameter name has acute value, prefer to omit the name of the parameter, leaving only the type, e.g.

void Print(const State& state) override { /* No state to print. */ }

changes to

void Print(const State&) override { /* No state to print. */}

This no longer triggers the warning and further makes it clear that a parameter required by the API is definitively unused in the function.

This is an especially good solution in the context of method definitions (vs declarations); the parameter name used in a definition is entirely irrelevant to Doxygen and most readers.

(3) When leaving the parameter name intact has acute value, it is acceptable to keep the name and mark it unused. For example, when the name appears as part of a virtual method's base class declaration, the name is used by Doxygen to document the method, e.g.,

virtual void SetDefault(const Context<T>& context, State<T>* state) const {
unused(context);
state->SetZero();
}

Here is the caller graph for this function:

Variable Documentation

const char *const kDrakeResourceRootEnvironmentVariableName
Initial value:
=
"DRAKE_RESOURCE_ROOT"

The name of the environment variable that provides the first place where FindResource attempts to look.

The environment variable is allowed to be unset or empty; in that case, FindResource will attempt to use other locations without complaint.

The value is guaranteed to be "DRAKE_RESOURCE_ROOT". (For some users, it may be easier to hard-code a value than refer to this constant.)

constexpr int kHomogeneousTransformSize = 16
constexpr int kQuaternionSize = 4
const int kRotmatSize = kSpaceDimension * kSpaceDimension
constexpr int kRpySize = 3
constexpr int kSpaceDimension = 3
constexpr auto nullopt = stx::nullopt