Drake
Drake C++ Documentation
AcrobotParams< T > Class Template Referencefinal

Detailed Description

template<typename T>
class drake::examples::acrobot::AcrobotParams< T >

Specializes BasicVector with specific getters and setters.

#include <drake/examples/acrobot/acrobot_params.h>

Public Types

typedef AcrobotParamsIndices K
 An abbreviation for our row index constants. More...
 

Public Member Functions

 AcrobotParams ()
 Default constructor. More...
 
template<typename U = T>
std::enable_if_t< std::is_same_v< U, symbolic::Expression > > SetToNamedVariables ()
 Create a symbolic::Variable for each element with the known variable name. More...
 
AcrobotParams< T > * DoClone () const final
 Returns a new BasicVector containing a copy of the entire vector. More...
 
template<typename Archive >
void Serialize (Archive *a)
 Visit each field of this named vector, passing them (in order) to the given Archive. More...
 
drake::boolean< T > IsValid () const
 Returns whether the current values of this vector are well-formed. More...
 
void GetElementBounds (Eigen::VectorXd *lower, Eigen::VectorXd *upper) const final
 Get the bounds for the elements. More...
 
Implements CopyConstructible, CopyAssignable, MoveConstructible,

MoveAssignable

 AcrobotParams (const AcrobotParams &other)
 
 AcrobotParams (AcrobotParams &&other) noexcept
 
AcrobotParamsoperator= (const AcrobotParams &other)
 
AcrobotParamsoperator= (AcrobotParams &&other) noexcept
 
Getters and Setters
const T & m1 () const
 Mass of link 1. More...
 
void set_m1 (const T &m1)
 Setter that matches m1(). More...
 
AcrobotParams< T > with_m1 (const T &m1) const
 Fluent setter that matches m1(). More...
 
const T & m2 () const
 Mass of link 2. More...
 
void set_m2 (const T &m2)
 Setter that matches m2(). More...
 
AcrobotParams< T > with_m2 (const T &m2) const
 Fluent setter that matches m2(). More...
 
const T & l1 () const
 Length of link 1. More...
 
void set_l1 (const T &l1)
 Setter that matches l1(). More...
 
AcrobotParams< T > with_l1 (const T &l1) const
 Fluent setter that matches l1(). More...
 
const T & l2 () const
 Length of link 2. More...
 
void set_l2 (const T &l2)
 Setter that matches l2(). More...
 
AcrobotParams< T > with_l2 (const T &l2) const
 Fluent setter that matches l2(). More...
 
const T & lc1 () const
 Vertical distance from shoulder joint to center of mass of link 1. More...
 
void set_lc1 (const T &lc1)
 Setter that matches lc1(). More...
 
AcrobotParams< T > with_lc1 (const T &lc1) const
 Fluent setter that matches lc1(). More...
 
const T & lc2 () const
 Vertical distance from elbow joint to center of mass of link 1. More...
 
void set_lc2 (const T &lc2)
 Setter that matches lc2(). More...
 
AcrobotParams< T > with_lc2 (const T &lc2) const
 Fluent setter that matches lc2(). More...
 
const T & Ic1 () const
 Inertia of link 1 about the center of mass of link 1. More...
 
void set_Ic1 (const T &Ic1)
 Setter that matches Ic1(). More...
 
AcrobotParams< T > with_Ic1 (const T &Ic1) const
 Fluent setter that matches Ic1(). More...
 
const T & Ic2 () const
 Inertia of link 2 about the center of mass of link 2. More...
 
void set_Ic2 (const T &Ic2)
 Setter that matches Ic2(). More...
 
AcrobotParams< T > with_Ic2 (const T &Ic2) const
 Fluent setter that matches Ic2(). More...
 
const T & b1 () const
 Damping coefficient of the shoulder joint. More...
 
void set_b1 (const T &b1)
 Setter that matches b1(). More...
 
AcrobotParams< T > with_b1 (const T &b1) const
 Fluent setter that matches b1(). More...
 
const T & b2 () const
 Damping coefficient of the elbow joint. More...
 
void set_b2 (const T &b2)
 Setter that matches b2(). More...
 
AcrobotParams< T > with_b2 (const T &b2) const
 Fluent setter that matches b2(). More...
 
const T & gravity () const
 Gravitational constant. More...
 
void set_gravity (const T &gravity)
 Setter that matches gravity(). More...
 
AcrobotParams< T > with_gravity (const T &gravity) const
 Fluent setter that matches gravity(). More...
 
- Public Member Functions inherited from BasicVector< T >
 BasicVector ()=default
 Constructs an empty BasicVector. More...
 
 BasicVector (int size)
 Initializes with the given size using the drake::dummy_value<T>, which is NaN when T = double. More...
 
 BasicVector (VectorX< T > vec)
 Constructs a BasicVector with the specified vec data. More...
 
 BasicVector (const std::initializer_list< T > &init)
 Constructs a BasicVector whose elements are the elements of init. More...
 
int size () const final
 Returns the number of elements in the vector. More...
 
void set_value (const Eigen::Ref< const VectorX< T >> &value)
 Sets the vector to the given value. More...
 
const VectorX< T > & value () const
 Returns a const reference to the contained VectorX<T>. More...
 
Eigen::VectorBlock< VectorX< T > > get_mutable_value ()
 Returns the entire vector as a mutable Eigen::VectorBlock, which allows mutation of the values, but does not allow resize() to be invoked on the returned object. More...
 
void SetFromVector (const Eigen::Ref< const VectorX< T >> &value) final
 Replaces the entire vector with the contents of value. More...
 
VectorX< T > CopyToVector () const final
 Copies this entire VectorBase into a contiguous Eigen Vector. More...
 
void ScaleAndAddToVector (const T &scale, EigenPtr< VectorX< T >> vec) const final
 Adds a scaled version of this vector to Eigen vector vec. More...
 
void SetZero () final
 Sets all elements of this vector to zero. More...
 
std::unique_ptr< BasicVector< T > > Clone () const
 Copies the entire vector to a new BasicVector, with the same concrete implementation type. More...
 
Eigen::VectorBlock< const VectorX< T > > get_value () const
 (Don't use this in new code) Returns the entire vector as a const Eigen::VectorBlock. More...
 
 BasicVector (const BasicVector &)=delete
 
BasicVectoroperator= (const BasicVector &)=delete
 
 BasicVector (BasicVector &&)=delete
 
BasicVectoroperator= (BasicVector &&)=delete
 
- Public Member Functions inherited from VectorBase< T >
virtual ~VectorBase ()
 
T & operator[] (int index)
 Returns the element at the given index in the vector. More...
 
const T & operator[] (int index) const
 Returns the element at the given index in the vector. More...
 
const T & GetAtIndex (int index) const
 Returns the element at the given index in the vector. More...
 
T & GetAtIndex (int index)
 Returns the element at the given index in the vector. More...
 
void SetAtIndex (int index, const T &value)
 Replaces the state at the given index with the value. More...
 
virtual void SetFrom (const VectorBase< T > &value)
 Replaces the entire vector with the contents of value. More...
 
virtual void CopyToPreSizedVector (EigenPtr< VectorX< T >> vec) const
 Copies this entire VectorBase into a pre-sized Eigen Vector. More...
 
VectorBasePlusEqScaled (const T &scale, const VectorBase< T > &rhs)
 Add in scaled vector rhs to this vector. More...
 
VectorBasePlusEqScaled (const std::initializer_list< std::pair< T, const VectorBase< T > & >> &rhs_scale)
 Add in multiple scaled vectors to this vector. More...
 
VectorBaseoperator+= (const VectorBase< T > &rhs)
 Add in vector rhs to this vector. More...
 
VectorBaseoperator-= (const VectorBase< T > &rhs)
 Subtract in vector rhs to this vector. More...
 
 VectorBase (const VectorBase &)=delete
 
VectorBaseoperator= (const VectorBase &)=delete
 
 VectorBase (VectorBase &&)=delete
 
VectorBaseoperator= (VectorBase &&)=delete
 

Static Public Member Functions

static const std::vector< std::string > & GetCoordinateNames ()
 See AcrobotParamsIndices::GetCoordinateNames(). More...
 
- Static Public Member Functions inherited from BasicVector< T >
static std::unique_ptr< BasicVector< T > > Make (const std::initializer_list< T > &init)
 Constructs a BasicVector whose elements are the elements of init. More...
 
template<typename... Fargs>
static std::unique_ptr< BasicVector< T > > Make (Fargs &&... args)
 Constructs a BasicVector where each element is constructed using the placewise-corresponding member of args as the sole constructor argument. More...
 

Additional Inherited Members

- Protected Member Functions inherited from BasicVector< T >
const T & DoGetAtIndexUnchecked (int index) const final
 Implementations should ensure this operation is O(1) and allocates no memory. More...
 
T & DoGetAtIndexUnchecked (int index) final
 Implementations should ensure this operation is O(1) and allocates no memory. More...
 
const T & DoGetAtIndexChecked (int index) const final
 Implementations should ensure this operation is O(1) and allocates no memory. More...
 
T & DoGetAtIndexChecked (int index) final
 Implementations should ensure this operation is O(1) and allocates no memory. More...
 
const VectorX< T > & values () const
 Provides const access to the element storage. More...
 
VectorX< T > & values ()
 (Advanced) Provides mutable access to the element storage. More...
 
- Protected Member Functions inherited from VectorBase< T >
 VectorBase ()
 
void ThrowOutOfRange (int index) const
 
void ThrowMismatchedSize (int other_size) const
 
- Static Protected Member Functions inherited from BasicVector< T >
template<typename F , typename... Fargs>
static void MakeRecursive (BasicVector< T > *data, int index, F constructor_arg, Fargs &&... recursive_args)
 Sets data at index to an object of type T, which must have a single-argument constructor invoked via constructor_arg, and then recursively invokes itself on the next index with recursive args. More...
 
template<typename F , typename... Fargs>
static void MakeRecursive (BasicVector< T > *data, int index, F constructor_arg)
 Base case for the MakeRecursive template recursion. More...
 

Member Typedef Documentation

◆ K

An abbreviation for our row index constants.

Constructor & Destructor Documentation

◆ AcrobotParams() [1/3]

Default constructor.

Sets all rows to their default value:

  • m1 defaults to 1.0 kg.
  • m2 defaults to 1.0 kg.
  • l1 defaults to 1.0 m.
  • l2 defaults to 2.0 m.
  • lc1 defaults to 0.5 m.
  • lc2 defaults to 1.0 m.
  • Ic1 defaults to 0.083 kg*m^2.
  • Ic2 defaults to 0.33 kg*m^2.
  • b1 defaults to 0.1 kg*m^2/s.
  • b2 defaults to 0.1 kg*m^2/s.
  • gravity defaults to 9.81 m/s^2.

◆ AcrobotParams() [2/3]

AcrobotParams ( const AcrobotParams< T > &  other)

◆ AcrobotParams() [3/3]

AcrobotParams ( AcrobotParams< T > &&  other)
noexcept

Member Function Documentation

◆ b1()

const T& b1 ( ) const

Damping coefficient of the shoulder joint.

Note
b1 is expressed in units of kg*m^2/s.
b1 has a limited domain of [0.0, +Inf].

◆ b2()

const T& b2 ( ) const

Damping coefficient of the elbow joint.

Note
b2 is expressed in units of kg*m^2/s.
b2 has a limited domain of [0.0, +Inf].

◆ DoClone()

AcrobotParams<T>* DoClone ( ) const
finalvirtual

Returns a new BasicVector containing a copy of the entire vector.

Caller must take ownership, and may rely on the NVI wrapper to initialize the clone elementwise.

Subclasses of BasicVector must override DoClone to return their covariant type.

Reimplemented from BasicVector< T >.

◆ GetCoordinateNames()

static const std::vector<std::string>& GetCoordinateNames ( )
static

◆ GetElementBounds()

void GetElementBounds ( Eigen::VectorXd *  lower,
Eigen::VectorXd *  upper 
) const
finalvirtual

Get the bounds for the elements.

If lower and upper are both empty size vectors, then there are no bounds. Otherwise, the bounds are (*lower)(i) <= GetAtIndex(i) <= (*upper)(i) The default output is no bounds.

Reimplemented from VectorBase< T >.

◆ gravity()

const T& gravity ( ) const

Gravitational constant.

Note
gravity is expressed in units of m/s^2.
gravity has a limited domain of [0.0, +Inf].

◆ Ic1()

const T& Ic1 ( ) const

Inertia of link 1 about the center of mass of link 1.

Note
Ic1 is expressed in units of kg*m^2.
Ic1 has a limited domain of [0.0, +Inf].

◆ Ic2()

const T& Ic2 ( ) const

Inertia of link 2 about the center of mass of link 2.

Note
Ic2 is expressed in units of kg*m^2.
Ic2 has a limited domain of [0.0, +Inf].

◆ IsValid()

drake::boolean<T> IsValid ( ) const

Returns whether the current values of this vector are well-formed.

◆ l1()

const T& l1 ( ) const

Length of link 1.

Note
l1 is expressed in units of m.
l1 has a limited domain of [0.0, +Inf].

◆ l2()

const T& l2 ( ) const

Length of link 2.

Note
l2 is expressed in units of m.
l2 has a limited domain of [0.0, +Inf].

◆ lc1()

const T& lc1 ( ) const

Vertical distance from shoulder joint to center of mass of link 1.

Note
lc1 is expressed in units of m.
lc1 has a limited domain of [0.0, +Inf].

◆ lc2()

const T& lc2 ( ) const

Vertical distance from elbow joint to center of mass of link 1.

Note
lc2 is expressed in units of m.
lc2 has a limited domain of [0.0, +Inf].

◆ m1()

const T& m1 ( ) const

Mass of link 1.

Note
m1 is expressed in units of kg.
m1 has a limited domain of [0.0, +Inf].

◆ m2()

const T& m2 ( ) const

Mass of link 2.

Note
m2 is expressed in units of kg.
m2 has a limited domain of [0.0, +Inf].

◆ operator=() [1/2]

AcrobotParams& operator= ( const AcrobotParams< T > &  other)

◆ operator=() [2/2]

AcrobotParams& operator= ( AcrobotParams< T > &&  other)
noexcept

◆ Serialize()

void Serialize ( Archive *  a)

Visit each field of this named vector, passing them (in order) to the given Archive.

The archive can read and/or write to the vector values. One common use of Serialize is the //common/yaml tools.

◆ set_b1()

void set_b1 ( const T &  b1)

Setter that matches b1().

◆ set_b2()

void set_b2 ( const T &  b2)

Setter that matches b2().

◆ set_gravity()

void set_gravity ( const T &  gravity)

Setter that matches gravity().

◆ set_Ic1()

void set_Ic1 ( const T &  Ic1)

Setter that matches Ic1().

◆ set_Ic2()

void set_Ic2 ( const T &  Ic2)

Setter that matches Ic2().

◆ set_l1()

void set_l1 ( const T &  l1)

Setter that matches l1().

◆ set_l2()

void set_l2 ( const T &  l2)

Setter that matches l2().

◆ set_lc1()

void set_lc1 ( const T &  lc1)

Setter that matches lc1().

◆ set_lc2()

void set_lc2 ( const T &  lc2)

Setter that matches lc2().

◆ set_m1()

void set_m1 ( const T &  m1)

Setter that matches m1().

◆ set_m2()

void set_m2 ( const T &  m2)

Setter that matches m2().

◆ SetToNamedVariables()

std::enable_if_t<std::is_same_v<U, symbolic::Expression> > SetToNamedVariables ( )

Create a symbolic::Variable for each element with the known variable name.

This is only available for T == symbolic::Expression.

◆ with_b1()

AcrobotParams<T> with_b1 ( const T &  b1) const

Fluent setter that matches b1().

Returns a copy of this with b1 set to a new value.

◆ with_b2()

AcrobotParams<T> with_b2 ( const T &  b2) const

Fluent setter that matches b2().

Returns a copy of this with b2 set to a new value.

◆ with_gravity()

AcrobotParams<T> with_gravity ( const T &  gravity) const

Fluent setter that matches gravity().

Returns a copy of this with gravity set to a new value.

◆ with_Ic1()

AcrobotParams<T> with_Ic1 ( const T &  Ic1) const

Fluent setter that matches Ic1().

Returns a copy of this with Ic1 set to a new value.

◆ with_Ic2()

AcrobotParams<T> with_Ic2 ( const T &  Ic2) const

Fluent setter that matches Ic2().

Returns a copy of this with Ic2 set to a new value.

◆ with_l1()

AcrobotParams<T> with_l1 ( const T &  l1) const

Fluent setter that matches l1().

Returns a copy of this with l1 set to a new value.

◆ with_l2()

AcrobotParams<T> with_l2 ( const T &  l2) const

Fluent setter that matches l2().

Returns a copy of this with l2 set to a new value.

◆ with_lc1()

AcrobotParams<T> with_lc1 ( const T &  lc1) const

Fluent setter that matches lc1().

Returns a copy of this with lc1 set to a new value.

◆ with_lc2()

AcrobotParams<T> with_lc2 ( const T &  lc2) const

Fluent setter that matches lc2().

Returns a copy of this with lc2 set to a new value.

◆ with_m1()

AcrobotParams<T> with_m1 ( const T &  m1) const

Fluent setter that matches m1().

Returns a copy of this with m1 set to a new value.

◆ with_m2()

AcrobotParams<T> with_m2 ( const T &  m2) const

Fluent setter that matches m2().

Returns a copy of this with m2 set to a new value.


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