SCL
1.0
Standard Control Library : Control, dynamics, physics, and simulation
|
#include <CDynamicsBase.hpp>
Public Member Functions | |
virtual sBool | computeGCModel (const SRobotSensors *arg_sensor_data, SGcModel *arg_gc_model)=0 |
virtual sBool | computeTransformsForAllLinks (sutil::CMappedTree< std::string, SRigidBodyDyn > &arg_tree, const Eigen::VectorXd &arg_q) |
virtual sBool | computeTransform (SRigidBodyDyn &arg_link, const Eigen::VectorXd &arg_q) |
virtual sBool | computeTransformToAncestor (Eigen::Affine3d &arg_T, SRigidBodyDyn &arg_link, const SRigidBodyDyn *arg_ancestor, const Eigen::VectorXd &arg_q) |
virtual sBool | computeJacobianWithTransforms (Eigen::MatrixXd &arg_J, SRigidBodyDyn &arg_link, const Eigen::VectorXd &arg_q, const Eigen::Vector3d &arg_pos_local) |
virtual sBool | computeJacobian (Eigen::MatrixXd &arg_J, const SRigidBodyDyn &arg_link, const Eigen::VectorXd &arg_q, const Eigen::Vector3d &arg_pos_local) const |
virtual sBool | computeJacobian (Eigen::MatrixXd &arg_J, const SRigidBodyDyn &arg_link, const SRigidBodyDyn *arg_ancestor, const Eigen::VectorXd &arg_q, const Eigen::Vector3d &arg_pos_local) |
virtual sBool | computeJacobianTrans (Eigen::MatrixXd &arg_J, const SRigidBodyDyn &arg_link, const SRigidBodyDyn *arg_ancestor, const Eigen::VectorXd &arg_q, const Eigen::Vector3d &arg_pos_local) |
virtual sBool | computeJacobianRot (Eigen::MatrixXd &arg_J, const SRigidBodyDyn &arg_link, const SRigidBodyDyn *arg_ancestor, const Eigen::VectorXd &arg_q, const Eigen::Vector3d &arg_pos_local) |
virtual sBool | computeExternalContacts (sutil::CMappedList< std::string, SForce > &arg_contacts) |
virtual sBool | integrate (SRobotIO &arg_inputs, const sFloat arg_time_interval) |
virtual sFloat | computeEnergyKinetic (sutil::CMappedTree< std::string, SRigidBodyDyn > &arg_tree, const Eigen::VectorXd &arg_q, const Eigen::VectorXd &arg_dq) |
virtual sFloat | computeEnergyPotential (sutil::CMappedTree< std::string, SRigidBodyDyn > &arg_tree, const Eigen::VectorXd &arg_q) |
CDynamicsBase () | |
virtual | ~CDynamicsBase () |
virtual sBool | init (const SRobotParsed &arg_robot_data)=0 |
virtual sBool | hasBeenInit () |
Protected Attributes | |
sBool | has_been_init_ |
const SRobotParsed * | robot_parsed_data_ |
A base class for different dynamics implementations.
Using any controller requires supporting this api with a dynamics engine implementation.
All dynamics implementations must try to be stateless. Ie. After one initial configuration that specifies the dynamic model's parameters, they must not store any more data. Pass in the model configuration as an argument and return the new state and/or dynamics matrices.
|
inline |
Default constructor sets the initialization state to false
|
inlinevirtual |
Default destructor does nothing
|
inlinevirtual |
Gets the robot's kinetic energy
arg_tree | The tree for which the transformation matrices are to be updated |
arg_q | The current generalized coordinates. |
arg_dq | The current generalized velocities. |
Reimplemented in scl::CDynamicsScl, scl_ext::CDynamics3d, and scl_ext::CDynamicsSclSpatial.
|
inlinevirtual |
Gets the robot's potential energy
arg_tree | The tree for which the transformation matrices are to be updated |
arg_q | The current generalized coordinates. |
Reimplemented in scl::CDynamicsScl, scl_ext::CDynamicsSclSpatial, and scl_ext::CDynamics3d.
|
inlinevirtual |
Calculates the collision forces for the robot to which this dynamics object is assigned.
Uses std::string based force lookup. The dynamics implementation should support this (maintain a map or something).
NOTE : The dynamics engine may delete forces from the passed mapped list at will. Do not store pointers to them at random places in your code.
As of now, this is optional for dynamics engines
arg_contacts | This is where the simulator will store the contact forces. It may use the std::string to identify when to remove or re-add forces. |
Reimplemented in scl_ext::CDynamics3d.
|
pure virtual |
Updates the generalized coordinate model matrices (Everything in SGcModel).
This is the most efficient method to access the standard matrices. Computing transformations and Jacobians individually is typically wasteful.
arg_sensor_data | Current robot state. q, dq, ddq, sensed generalized forces and perceived external forces. |
arg_gc_model | Individual link Jacobians, and composite intertial, centrifugal/coriolis gravity estimates. |
Implemented in scl_ext::CDynamicsSclSpatial, scl_ext::CDynamics3d, scl::CDynamicsScl, scl::CDynamicsTao, and scl::CSimbodyDynamics.
|
inlinevirtual |
Calculates the Jacobian for the robot to which this dynamics object is assigned. dx_global_origin = Jx . dq The Jacobian is specified by a link and an offset (in task space dimensions)from that link. ** CONST VERSION : NOTE : The regular version should call this. **
arg_J | The Jacobain will be saved here. |
arg_link | The link at which the Jacobian is to be calculated |
arg_q | The current generalized coordinates. |
arg_pos_local | The offset from the link's frame (in link coordinates). |
Reimplemented in scl::CDynamicsScl.
|
inlinevirtual |
Calculates the Jacobian for the robot to which this dynamics object is assigned. dx_ancestor_coords = Jx . dq The Jacobian is specified by a link and an offset (in task space dimensions)from that link.
arg_J | The Jacobain will be saved here. |
arg_link | The link at which the Jacobian is to be calculated |
arg_ancestor | The link up to which the Jacobian is to be calculated Pass NULL to compute the Jacobian up to the global root. |
arg_q | The current generalized coordinates. |
arg_pos_local | The offset from the link's frame (in link coordinates). |
|
inlinevirtual |
Calculates the Jacobian for the robot to which this dynamics object is assigned. ONLY for rotation. Ie. size(Jx) = (3,ndof) dx_ancestor_coords = Jx . dq
arg_J | The Jacobain will be saved here. |
arg_link | The link at which the Jacobian is to be calculated |
arg_ancestor | The link up to which the Jacobian is to be calculated Pass NULL to compute the Jacobian up to the global root. |
arg_q | The current generalized coordinates. |
arg_pos_local | The offset from the link's frame (in link coordinates). |
|
inlinevirtual |
Calculates the Jacobian for the robot to which this dynamics object is assigned. ONLY for translation. Ie. size(Jx) = (3,ndof) dx_ancestor_coords = Jx . dq
arg_J | The Jacobain will be saved here. |
arg_link | The link at which the Jacobian is to be calculated |
arg_ancestor | The link up to which the Jacobian is to be calculated Pass NULL to compute the Jacobian up to the global root. |
arg_q | The current generalized coordinates. |
arg_pos_local | The offset from the link's frame (in link coordinates). |
|
inlinevirtual |
Calculates the Jacobian for the robot to which this dynamics object is assigned. dx_global_origin = Jx . dq The Jacobian is specified by a link and an offset (in task space dimensions)from that link.
arg_J | The Jacobain will be saved here. |
arg_link | The link at which the Jacobian is to be calculated. Transforms are updated in this link and ancestors in the tree. |
arg_q | The current generalized coordinates. |
arg_pos_local | The offset from the link's frame (in link coordinates). |
Reimplemented in scl::CDynamicsScl.
|
inlinevirtual |
Calculates the Transformation Matrix for the robot to which this dynamics object is assigned. x_parent_link_coords = arg_link.T_lnk_ * x_link_coords Note that the matrix is stored in the passed link data struct.
arg_link | The link at which the transformation matrix is to be calculated |
arg_q | The current generalized coordinates. |
Reimplemented in scl::CDynamicsScl.
|
inlinevirtual |
Updates the Transformation Matrices for the robot to which this dynamics object is assigned. x_ancestor_link_coords = arg_link.T_lnk_ * x_link_coords
arg_tree | The tree for which the transformation matrices are to be updated |
arg_q | The current generalized coordinates. |
Reimplemented in scl::CDynamicsScl.
|
inlinevirtual |
Calculates the Transformation Matrix for the robot to which this dynamics object is assigned. x_ancestor_link_coords = arg_link.T_lnk_ * x_link_coords
Note that the local transformation matrices are updated in all the link data structs from arg_link to arg_ancestor.
Also note that there are two origins, robot origin, which actually has a node allocated for it. And the global scl origin, for which you should pass in a NULL as ancestor.
arg_T | The transformation matrix in which to store the answer |
arg_link | The link at which the transformation matrix is to be calculated |
arg_ancestor | The link up to which the transformation matrix is to be calculated Pass NULL to compute the transform up to the global root. |
arg_q | The current generalized coordinates. |
Reimplemented in scl::CDynamicsScl.
|
inlinevirtual |
Initialization state
|
pure virtual |
Initializes the dynamics to be computed for a specific robot.
Returns, true : Succeeds in creating a dynamics object
false : If it can't find the robot or if the information is inconsistent with what the implementation requires, it returns false
NOTE TODO : Should strive for a stateless dynamics implementation...
Implemented in scl::CDynamicsScl, scl_ext::CDynamics3d, scl_ext::CDynamicsSclSpatial, scl::CDynamicsTao, and scl::CSimbodyDynamics.
|
inlinevirtual |
Integrates the robot's state. Uses the given applied forces, torques, positions and velocities and its internal dynamic model to compute new positions and velocities. Operates on the SRobotIO data structure.
Reads from, and updates: arg_inputs_.sensors_.q_, dq_, ddq_
Reads from: arg_inputs_.sensors_.forces_external_ arg_inputs_.actuators_.force_gc_commanded_
arg_inputs | The existing generalized coordinates, velocities and accelerations + The generalized forces + task (euclidean) forces and the list of contact points and links. |
arg_time_interval | The time across which the system should integrate the dynamics. Could take fixed steps or dynamic ones in between. Up to the integrator implementation. |
Reimplemented in scl::CSimbodyDynamics, scl::CDynamicsTao, scl_ext::CDynamics3d, and scl_ext::CDynamicsSclSpatial.
|
protected |
True if the dynamics object has been initialized for a given robot
|
protected |
A read-only pointer to access parsed data