TVM  0.9.4
tvm::robot::internal::DynamicFunction Class Reference

#include <tvm/robot/internal/DynamicFunction.h>

Inheritance diagram for tvm::robot::internal::DynamicFunction:
Collaboration diagram for tvm::robot::internal::DynamicFunction:

Classes

struct  ForceContact
 

Public Types

using Output = function::abstract::LinearFunction::Output
 
- Public Types inherited from tvm::graph::internal::AbstractNode
enum class  Update_
 
using UpdateParent = AbstractNode
 
using UpdateBase = AbstractNode
 
- Public Types inherited from tvm::graph::internal::Inputs
using inputs_t = std::unordered_map< abstract::Outputs *, std::set< int > >
 
using store_t = std::unordered_set< std::shared_ptr< abstract::Outputs > >
 
- Public Types inherited from tvm::graph::abstract::Outputs
enum class  Output_
 
using OutputParent = Outputs
 
using OutputBase = Outputs
 

Public Member Functions

 DynamicFunction (RobotPtr robot)
 
bool addContact (ContactPtr contact, bool linearize, double mu, unsigned int nrGen)
 
void removeContact (const Contact::Id &id)
 
sva::ForceVecd contactForce (const Contact::Id &id) const
 
void addPositiveLambdaToProblem (ControlProblem &problem)
 
- Public Member Functions inherited from tvm::function::abstract::LinearFunction
void updateValue ()
 
void updateVelocity ()
 
void resizeCache () override
 
const tvm::internal::VectorWithPropertiesb () const
 
- Public Member Functions inherited from tvm::function::abstract::Function
virtual const Eigen::VectorXd & velocity () const
 
virtual const Eigen::VectorXd & normalAcceleration () const
 
virtual MatrixConstRef JDot (const Variable &x) const
 
- Public Member Functions inherited from tvm::internal::FirstOrderProvider
virtual const Eigen::VectorXd & value () const
 
virtual MatrixConstRefWithProperties jacobian (const Variable &x) const
 
bool linearIn (const Variable &x) const
 
const SpaceimageSpace () const
 
int size () const
 
int rSize () const
 
int tSize () const
 
const VariableVectorvariables () const
 
- Public Member Functions inherited from tvm::graph::internal::AbstractNode
template<typename EnumT >
bool isUpdateEnabled (EnumT e) const
 
virtual bool isUpdateStaticallyEnabled (int) const
 
virtual bool isUpdateCustomEnabled (int) const
 
virtual ~AbstractNode ()=default
 
void update (int i)
 
- Public Member Functions inherited from tvm::graph::internal::Inputs
virtual ~Inputs ()=default
 
template<typename T , typename EnumI , typename... Args>
void addInput (std::shared_ptr< T > source, EnumI i, Args... args)
 
template<typename T , typename EnumI , typename... Args, typename std::enable_if< std::is_base_of< abstract::Outputs, T >::value, int >::type = 0>
void addInput (T &source, EnumI i, Args... args)
 
template<typename T >
void removeInput (T *source)
 
template<typename T , typename... Args>
void removeInput (T *source, Args... args)
 
template<typename T >
Iterator getInput (T *source)
 
template<typename T >
Iterator getInput (const std::shared_ptr< T > &source)
 
- Public Member Functions inherited from tvm::graph::abstract::Outputs
virtual ~Outputs ()=default
 
template<typename EnumT >
bool isOutputEnabled (EnumT e) const
 
bool isOutputEnabled (int i) const
 
virtual bool isOutputStaticallyEnabled (int) const
 
virtual bool isOutputCustomEnabled (int) const
 

Protected Member Functions

void updateb ()
 
void updateJacobian ()
 
void addContact_ (const Contact::View &contact, bool linearize, double mu, unsigned int nrGen, double dir)
 
std::vector< ForceContact >::iterator getContact (const Contact::Id &id)
 
std::vector< ForceContact >::const_iterator getContact (const Contact::Id &id) const
 
- Protected Member Functions inherited from tvm::function::abstract::LinearFunction
 LinearFunction (int m)
 
virtual void updateValue_ ()
 
virtual void updateVelocity_ ()
 
void setDerivativesToZero ()
 
- Protected Member Functions inherited from tvm::function::abstract::Function
 Function (int m=0)
 
 Function (Space image)
 
void resizeVelocityCache ()
 
void resizeNormalAccelerationCache ()
 
void resizeJDotCache ()
 
void addVariable_ (VariablePtr v) override
 
void removeVariable_ (VariablePtr v) override
 
- Protected Member Functions inherited from tvm::internal::FirstOrderProvider
 FirstOrderProvider (int m)
 
 FirstOrderProvider (Space image)
 
void resizeValueCache ()
 
void resizeJacobianCache ()
 
void addVariable (VariablePtr v, bool linear)
 
void removeVariable (VariablePtr v)
 
void addVariable (const VariableVector &v, bool linear)
 
void splitJacobian (const MatrixConstRef &J, const std::vector< VariablePtr > &vars, bool keepProperties=false)
 
void splitJacobian (const MatrixConstRef &J, const VariableVector &vars, bool keepProperties=false)
 
void resize (int m)
 
- Protected Member Functions inherited from tvm::graph::abstract::Node< FirstOrderProvider >
void registerUpdates (EnumT u, void(U::*fn)(), Args... args)
 
void registerUpdates (EnumT u, void(U::*fn)())
 
void addOutputDependency (EnumO o, EnumU u)
 
void addOutputDependency (std::initializer_list< EnumO > os, EnumU u)
 
void addInternalDependency (EnumU1 uDependent, EnumU2 u)
 
void addInputDependency (EnumU u, std::shared_ptr< S > source, EnumO i, Args... args)
 
void addInputDependency (EnumU u, S &source, EnumO i, Args... args)
 
void addDirectDependency (EnumO o, std::shared_ptr< S > source, EnumI i)
 
void addDirectDependency (EnumO o, S &source, EnumI i)
 

Protected Attributes

RobotPtr robot_
 
std::vector< ForceContactcontacts_
 
- Protected Attributes inherited from tvm::function::abstract::LinearFunction
tvm::internal::VectorWithProperties b_
 
- Protected Attributes inherited from tvm::function::abstract::Function
Eigen::VectorXd velocity_
 
Eigen::VectorXd normalAcceleration_
 
utils::internal::MapWithVariableAsKey< Eigen::MatrixXd, slice_jdotJDot_
 
- Protected Attributes inherited from tvm::internal::FirstOrderProvider
Eigen::VectorXd value_
 
utils::internal::MapWithVariableAsKey< MatrixWithProperties, slice_matrix, true > jacobian_
 
Space imageSpace_
 
VariableVector variables_
 
utils::internal::MapWithVariableAsKey< bool, slice_linearlinear_
 
- Protected Attributes inherited from tvm::graph::internal::AbstractNode
std::map< int, std::function< void(AbstractNode &)> > updates_
 
std::map< int, std::vector< int > > outputDependencies_
 
std::map< int, std::vector< int > > internalDependencies_
 
std::map< int, input_dependency_tinputDependencies_
 
std::map< int, std::pair< Outputs *, int > > directDependencies_
 
- Protected Attributes inherited from tvm::graph::abstract::Outputs
bool is_node_ = false
 

Additional Inherited Members

- Static Public Member Functions inherited from tvm::graph::internal::AbstractNode
static constexpr const char * UpdateName (Update_)
 
template<typename EnumT >
static constexpr bool UpdateStaticallyEnabled (EnumT)
 
- Static Public Member Functions inherited from tvm::graph::abstract::Outputs
static constexpr const char * OutputName (Output_)
 
template<typename EnumT >
static constexpr bool OutputStaticallyEnabled (EnumT)
 
- Static Public Attributes inherited from tvm::graph::internal::AbstractNode
static constexpr unsigned int UpdateSize = 0
 
static constexpr auto UpdateBaseName = "AbstractNode"
 
- Static Public Attributes inherited from tvm::graph::abstract::Outputs
static constexpr unsigned int OutputSize = 0
 
static constexpr auto OutputBaseName = "Outputs"
 
- Protected Types inherited from tvm::graph::internal::AbstractNode
using input_dependency_t = std::map< Outputs *, std::set< int > >
 

Detailed Description

Implement the equation of motion for a given robot.

It can be given contacts that will be integrated into the equation of motion (

See also
DynamicFunction::addContact) or contacts that will be removed from the equation (
DynamicFunction::removeContact).

It manages the force variables related to these contacts.

It also takes care of linearizing the contacts, either by having them in a linearized form in the solver (lambdas) or as forces. The related constraint (mu*f_n >= ||f_t||) can be added to the problem through this function.

Notably, it does not take care of enforcing Newton 3rd law of motion when two actuated robots are in contact.

Member Typedef Documentation

◆ Output

Constructor & Destructor Documentation

◆ DynamicFunction()

tvm::robot::internal::DynamicFunction::DynamicFunction ( RobotPtr  robot)

Construct the equation of motion for a given robot

Member Function Documentation

◆ addContact()

bool tvm::robot::internal::DynamicFunction::addContact ( ContactPtr  contact,
bool  linearize,
double  mu,
unsigned int  nrGen 
)

Add a contact to the function

This adds forces variables for every contact point belonging to the robot of this dynamic function.

Parameters
contactContact that will be added
linearizeIf true, linearize the friction cone using generators
muFriction coefficient
nrGenNumber of generators for the cone (only applicable when linearize is true)

Returns true if a contact has been added

◆ addContact_()

void tvm::robot::internal::DynamicFunction::addContact_ ( const Contact::View contact,
bool  linearize,
double  mu,
unsigned int  nrGen,
double  dir 
)
protected

◆ addPositiveLambdaToProblem()

void tvm::robot::internal::DynamicFunction::addPositiveLambdaToProblem ( ControlProblem problem)

Add constraints to the given problem

The constraints express that the contact should not slip, i.e. mu*f_n > ||f_t||, where mu was set when the contact was added.

◆ contactForce()

sva::ForceVecd tvm::robot::internal::DynamicFunction::contactForce ( const Contact::Id id) const

Return the contact force at the contact.

The force is null if this contact has not been added or does not concern the related robot.

◆ getContact() [1/2]

std::vector<ForceContact>::iterator tvm::robot::internal::DynamicFunction::getContact ( const Contact::Id id)
protected

◆ getContact() [2/2]

std::vector<ForceContact>::const_iterator tvm::robot::internal::DynamicFunction::getContact ( const Contact::Id id) const
protected

◆ removeContact()

void tvm::robot::internal::DynamicFunction::removeContact ( const Contact::Id id)

Remove a contact

This has no effect if this contact was not added before

◆ updateb()

void tvm::robot::internal::DynamicFunction::updateb ( )
protected

◆ updateJacobian()

void tvm::robot::internal::DynamicFunction::updateJacobian ( )
protected

Member Data Documentation

◆ contacts_

std::vector<ForceContact> tvm::robot::internal::DynamicFunction::contacts_
protected

◆ robot_

RobotPtr tvm::robot::internal::DynamicFunction::robot_
protected

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