RcsPySim
A robot control and simulation library
Rcs::DSMassSpringDamper Class Reference

#include <DynamicalSystem.h>

Inheritance diagram for Rcs::DSMassSpringDamper:
Collaboration diagram for Rcs::DSMassSpringDamper:

Classes

struct  Spring
 

Public Member Functions

 DSMassSpringDamper (const Spring &attractor, const std::vector< Spring > &repellers, const double damping, const double mass=1.0)
 
virtual DynamicalSystemclone () const
 
void step (Eigen::VectorXd &x_ddot, const Eigen::VectorXd &x_dot, const Eigen::VectorXd &x, double dt) const
 
Eigen::VectorXd getGoal () const
 
void setGoal (const Eigen::VectorXd &x_des)
 
- Public Member Functions inherited from Rcs::DSSecondOrder
virtual void step (Eigen::VectorXd &x_dot, const Eigen::VectorXd &x, double dt) const
 
- Public Member Functions inherited from Rcs::DynamicalSystem
 DynamicalSystem ()=default
 
virtual ~DynamicalSystem ()=default
 
virtual double goalDistance (const Eigen::VectorXd &x_curr) const
 
unsigned int getStateDim () const
 

Protected Attributes

Spring attractorSpring
 
std::vector< SpringrepellerSprings
 
double damping
 
double mass
 

Additional Inherited Members

- Static Public Member Functions inherited from Rcs::DynamicalSystem
static DynamicalSystemcreate (PropertySource *properties, unsigned int innerTaskDim)
 
- Public Attributes inherited from Rcs::DynamicalSystem
Eigen::VectorXd x_dot_des
 

Detailed Description

Mass-Spring-Damper Dynamical System

Definition at line 180 of file DynamicalSystem.h.

Constructor & Destructor Documentation

◆ DSMassSpringDamper()

Rcs::DSMassSpringDamper::DSMassSpringDamper ( const Spring attractor,
const std::vector< Spring > &  repellers,
const double  damping,
const double  mass = 1.0 
)

Constructor

Parameters
[in]attractorattractor spring pulling the mass to the goal poisiton (there is only one)
[in]repellersrepeller springs pushing the mass away from points in space
[in]dampingof the dynamical system (there is only on)
[in]massmass of the particle (default: unit mass 1kg)

DSMassSpringDamper

Definition at line 279 of file DynamicalSystem.cpp.

Member Function Documentation

◆ clone()

DynamicalSystem * Rcs::DSMassSpringDamper::clone ( ) const
virtual

Create a deep copy of this DynamicalSystem.

Returns
deep copy

Implements Rcs::DynamicalSystem.

Reimplemented in Rcs::DSMassSpringDamperNonlinear.

Definition at line 286 of file DynamicalSystem.cpp.

◆ getGoal()

Eigen::VectorXd Rcs::DSMassSpringDamper::getGoal ( ) const
virtual

Get the goal state for this dynamical system.

Returns
x_des desired state for the system to pursue

Implements Rcs::DynamicalSystem.

Definition at line 323 of file DynamicalSystem.cpp.

◆ setGoal()

void Rcs::DSMassSpringDamper::setGoal ( const Eigen::VectorXd &  x_des)
virtual

Set the goal state for this dynamical system. The goal state is the system's desired equilibrium state. In the presence of repellers, this Systems without an explicit goal state do not need to override this. By default, it does othing.

Parameters
[in]x_desdesired state for the system to pursue

Implements Rcs::DynamicalSystem.

Definition at line 328 of file DynamicalSystem.cpp.

◆ step()

void Rcs::DSMassSpringDamper::step ( Eigen::VectorXd &  x_ddot,
const Eigen::VectorXd &  x_dot,
const Eigen::VectorXd &  x,
double  dt 
) const
virtual

Advance the dynamical system one step in time. Compute the acceleration x_ddot given the velocity x_dot and the state x, and the time step size dt.

Parameters
[out]x_ddotfill with desired acceleration, is not initialized
[in]x_dotcurrent velocity
[in]xcurrent state
[in]dttime step size for integration

Implements Rcs::DSSecondOrder.

Reimplemented in Rcs::DSMassSpringDamperNonlinear.

Definition at line 291 of file DynamicalSystem.cpp.

Member Data Documentation

◆ attractorSpring

Spring Rcs::DSMassSpringDamper::attractorSpring
protected

attractor spring pulling the mass to the goal poisiton (there is only one for every dynamical system)

Definition at line 215 of file DynamicalSystem.h.

◆ damping

double Rcs::DSMassSpringDamper::damping
protected

daming of the dynamical system (there is only one for every dynamical system)

Definition at line 219 of file DynamicalSystem.h.

◆ mass

double Rcs::DSMassSpringDamper::mass
protected

mass of the particle

Definition at line 221 of file DynamicalSystem.h.

◆ repellerSprings

std::vector<Spring> Rcs::DSMassSpringDamper::repellerSprings
protected

repeller springs pushing the mass away from points in space (e.g. obstacles)

Definition at line 217 of file DynamicalSystem.h.


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