29 template <
class RBDDynamics,
size_t ACT_STATE_DIM = 0,
bool EE_ARE_CONTROL_INPUTS = false>
31 RBDDynamics::NSTATE + ACT_STATE_DIM,
32 RBDDynamics::NJOINTS + EE_ARE_CONTROL_INPUTS * RBDDynamics::N_EE * 3>
35 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
37 static const size_t N_EE = RBDDynamics::N_EE;
38 static const size_t STATE_DIM = RBDDynamics::NSTATE + ACT_STATE_DIM;
39 static const size_t CONTROL_DIM = RBDDynamics::NJOINTS + EE_ARE_CONTROL_INPUTS * N_EE * 3;
65 :
BASE(basePose), actuatorDynamics_(actuatorDynamics)
78 if (arg.actuatorDynamics_)
80 actuatorDynamics_ = std::shared_ptr<ActuatorDynamics_t>(arg.actuatorDynamics_->clone());
105 typename RBDDynamics::ExtLinkForces_t linkForces(Eigen::Matrix<SCALAR, 6, 1>::Zero());
108 if (EE_ARE_CONTROL_INPUTS ==
true)
110 for (
size_t i = 0;
i < RBDDynamics::N_EE;
i++)
112 auto endEffector = this->
dynamics_.kinematics().getEndEffector(
i);
113 size_t linkId = endEffector.getLinkId();
115 this->
dynamics_.kinematics().mapForceFromWorldToLink3d(
116 control.template segment<3>(
BASE::NJOINTS +
i * 3), this->basePose_,
121 typename RBDDynamics::JointAcceleration_t jAcc;
124 robotState.
joints(), control.template head<BASE::NJOINTS>(), linkForces, jAcc);
126 derivative.template segment<BASE::NJOINTS>(
BASE::NJOINTS) = jAcc.getAcceleration();
130 template <
typename T =
void>
138 const Eigen::Ref<const typename control_vector_t::Base> actControlIn =
139 controlIn.template topRows<BASE::NJOINTS>();
142 actuatorDynamics_->computeActuatorDynamics(
145 stateDerivative.template tail<ACTUATOR_STATE_DIM>() = actStateDerivative;
148 controlOut = actuatorDynamics_->computeControlOutput(robotState.
joints(), robotState.
actuatorState());
152 template <
typename T =
void>
171 template <
typename T =
typename FixBaseRobotState_t::actuator_state_vector_t>
176 return actuatorDynamics_->computeStateFromOutput(jStateRef, torqueRef);
180 template <
typename T =
typename FixBaseRobotState_t::actuator_state_vector_t>
191 std::shared_ptr<ActuatorDynamics_t> actuatorDynamics_;
static const size_t CONTROL_DIM
Definition: FixBaseFDSystem.h:39
static const size_t ACTUATOR_STATE_DIM
Definition: FixBaseFDSystem.h:40
FixBaseFDSystem(const RigidBodyPose_t &basePose=RigidBodyPose_t())
constructor
Definition: FixBaseFDSystem.h:58
A fix base rigid body system that uses forward dynamics.
Definition: FixBaseFDSystem.h:30
static const size_t STATE_DIM
number of end-effectors
Definition: FixBaseFDSystem.h:38
joint state and joint velocity
Definition: JointState.h:21
virtual ~FixBaseFDSystem()=default
destructor
std::shared_ptr< ActuatorDynamics_t > getActuatorDynamics()
get pointer to actuator dynamics
Definition: FixBaseFDSystem.h:169
typename BASE::control_vector_t control_vector_t
Definition: FixBaseFDSystem.h:45
typename BASE::state_vector_t state_vector_t
Definition: FixBaseFDSystem.h:44
ct::core::ControlVector< NJOINTS > computeIDTorques(const JointState< NJOINTS, SCALAR > &jState, const JointAcceleration_t &jAcc=JointAcceleration_t(Eigen::Matrix< SCALAR, NJOINTS, 1 >::Zero()))
compute inverse dynamics torques
Definition: FixBaseSystemBase.h:67
std::enable_if<(ACT_STATE_DIM > 0), T >::type computeActuatorDynamics(const FixBaseRobotState_t &robotState, const SCALAR &t, const control_vector_t &controlIn, state_vector_t &stateDerivative, control_vector_t &controlOut)
evaluate the actuator dynamics if actuators are enabled
Definition: FixBaseFDSystem.h:131
FixBaseFDSystem(std::shared_ptr< ActuatorDynamics_t > actuatorDynamics, const RigidBodyPose_t &basePose=RigidBodyPose_t())
constructor including actuator dynamics
Definition: FixBaseFDSystem.h:63
Base class for fix-base robot systems.
Definition: FixBaseSystemBase.h:19
FixBaseFDSystem(const FixBaseFDSystem &arg)
copy constructor
Definition: FixBaseFDSystem.h:76
void computeControlledDynamics(const state_vector_t &state, const SCALAR &t, const control_vector_t &controlIn, state_vector_t &derivative) override
compute the controlled dynamics of the fixed base robotic system
Definition: FixBaseFDSystem.h:88
actuator_state_vector_t & actuatorState()
accessor to actuator state
Definition: FixBaseRobotState.h:94
static EIGEN_MAKE_ALIGNED_OPERATOR_NEW const size_t N_EE
Definition: FixBaseFDSystem.h:37
JointPositionBlock getVelocities()
get joint velocity
Definition: JointState.h:131
LinkIdentifiers
Definition: declarations.h:40
typename BASE::RigidBodyPose_t RigidBodyPose_t
Definition: FixBaseFDSystem.h:47
virtual FixBaseFDSystem< RBDDynamics, ACT_STATE_DIM, EE_ARE_CONTROL_INPUTS > * clone() const override
deep cloning
Definition: FixBaseFDSystem.h:163
core::ControlVector< CONTROL_D, SCALAR > control_vector_t
Definition: FixBaseSystemBase.h:37
typename BASE::JointAcceleration_t JointAcceleration_t
Definition: FixBaseFDSystem.h:46
JointAcceleration< NJOINTS, SCALAR > JointAcceleration_t
Definition: FixBaseSystemBase.h:38
static const size_t NJOINTS
number of joints
Definition: FixBaseSystemBase.h:28
typename BASE::SCALAR SCALAR
Definition: FixBaseFDSystem.h:43
Definition: ActuatorDynamics.h:25
typename FixBaseRobotState_t::actuator_state_vector_t actuator_state_vector_t
Definition: FixBaseFDSystem.h:51
RBDDynamics dynamics_
rigid body dynamics container
Definition: FixBaseSystemBase.h:80
std::enable_if<(ACT_STATE_DIM > 0), T >::type computeConsistentActuatorState(const JointState< BASE::NJOINTS, SCALAR > &jStateRef)
if actuator dynamics enabled, this method allows to design a consistent actuator state ...
Definition: FixBaseFDSystem.h:181
tpl::RigidBodyPose< SCALAR > RigidBodyPose_t
Definition: FixBaseSystemBase.h:33
std::enable_if<(ACT_STATE_DIM > 0), T >::type computeConsistentActuatorState(const JointState< BASE::NJOINTS, SCALAR > &jStateRef, const ct::core::ControlVector< BASE::NJOINTS > &torqueRef)
if actuator dynamics enabled, this method allows to design a consistent actuator state ...
Definition: FixBaseFDSystem.h:172
whole fix base robot state, i.e. Joint state, Actuator Dynamics (and fix-base pose) ...
Definition: FixBaseRobotState.h:26
typename RBDDynamics::SCALAR SCALAR
Definition: FixBaseSystemBase.h:31
JointPositionBlock getPositions()
get joint state
Definition: JointState.h:76
JointState_t & joints()
accessor to joint state
Definition: FixBaseRobotState.h:102
std::enable_if<(ACT_STATE_DIM==0), T >::type computeActuatorDynamics(const FixBaseRobotState_t &robotState, const SCALAR &t, const control_vector_t &controlIn, state_vector_t &stateDerivative, control_vector_t &controlOut)
do nothing if actuators disabled
Definition: FixBaseFDSystem.h:153
ct::core::StateVector< STATE_D, SCALAR > state_vector_t
Definition: FixBaseSystemBase.h:36
ct::core::StateVector< ACT_STATE_DIM, SCALAR > actuator_state_vector_t
Definition: FixBaseRobotState.h:38