dynamics.c File Reference IntroductionImplementation of the dynamic-related functions used to implement path planning with differential constraints. Definition in file dynamics.c.
Function Documentation◆ GetPositionJacobian()
Evaluates the position Jacobian. Only the independent equations are relevant.
Definition at line 274 of file dynamics.c. References TDynamicSpace::bJ, TDynamicSpace::bJp, TDynamicSpace::cJ, TDynamicSpace::dof, Error(), EvaluateTransposedJacobianInVector(), EvaluateTransposedJacobianSubSetInVector(), EvaluateTransposedNJacobianSubSetInVector(), FindIndependentRows(), GetChartJacobianBasis(), TDynamicSpace::J, TDynamicSpace::Jp, TDynamicSpace::ndxPE, TDynamicSpace::ne, TDynamicSpace::nipe, TDynamicSpace::nJp, TDynamicSpace::npe, TDynamicSpace::npv, TDynamicSpace::nv, TDynamicSpace::pEqs, PrintTMatrix(), TDynamicSpace::pVars, SelectMatrixColumns(), SelectMatrixRows(), TDynamicSpace::selEqs, TDynamicSpace::sJ, TDynamicSpace::sJp, TRUE, and VectorAnd(). Referenced by ComputeAcceleration(), and ComputeInverseDynamics(). ◆ ComputeAcceleration()
Given a dynamic space with all the relevant dynamic information, we compute the acceleration at a given state.
Definition at line 338 of file dynamics.c. References TDynamicSpace::A, TDynamicSpace::bJ, TDynamicSpace::bJp, CT_EPSILON, TDynamicSpace::da, Error(), EvaluateHessianVector2(), EvaluateJacobianInVector(), EvaluateNHessianVector2(), FALSE, TDynamicSpace::g, TDynamicSpace::gamma, GetLSSolutionBuffer(), GetParameter(), GetPositionJacobian(), HandC(), HandC_Thread, TDynamicSpace::Hp, TDynamicSpace::Hpv, TDynamicSpace::Joo, TDynamicSpace::Jop, TDynamicSpace::Jot, TDynamicSpace::Jp, TDynamicSpace::lsSize, LSSolve(), TDynamicSpace::mA, MatrixVectorProduct(), TDynamicSpace::Mm, TDynamicSpace::ndxOV, TDynamicSpace::ndxPV, TDynamicSpace::ndxVV, TDynamicSpace::ne, TDynamicSpace::nHp, TDynamicSpace::nie, TDynamicSpace::nipe, TDynamicSpace::noe, TDynamicSpace::nov, TDynamicSpace::npv, TDynamicSpace::nv, TDynamicSpace::o, TDynamicSpace::pEqs, TDynamicSpace::pos, PrintMatrix(), PrintTMatrix(), PrintVector(), TDynamicSpace::pvEqs, TDynamicSpace::Qa, TDynamicSpace::qdd, RC2INDEX, TDynamicSpace::rhsA, ScaleVector(), TDynamicSpace::sHp, TDynamicSpace::sJoo, TDynamicSpace::sJop, TDynamicSpace::solA, SubMatrixFromMatrix(), SubMatrixFromTMatrix(), TRUE, and TDynamicSpace::vel. Referenced by Getxdot(), LinearizeDynamics(), NextDynamicState(), NextDynamicStateEuler(), NextDynamicStateLocalEuler(), NextDynamicStateLocalRK4(), NextDynamicStateRK4(), and Time2Go(). ◆ DynamicStepCtResidue()
Computes the constant part of the projection residue. Used in the Broyden's before entering the iteration to find the solution. NOTE: This assumes ComputeAcceleration has been called before with the current state (not passed as a parameter since all we need from it is the acceleration, stored as ds->g).
Definition at line 597 of file dynamics.c. References TDynamicSpace::g, TDynamicSpace::gn, and TDynamicSpace::nv. Referenced by NextDynamicState(). ◆ DynamicStepResidue()
Computes the constant part of Broyden's residue. NOTE: This assumes ComputeAcceleration has been called before with x (so that the acceleration is for x is included in ds) and that the constant part of the projection error is also precomputed (and stored in ds) calling DynamicStepCtResidue
Definition at line 603 of file dynamics.c. References TDynamicSpace::bJ, TDynamicSpace::bJp, CS_WD_EVALUATE_SUBSET_SIMP_EQUATIONS, DifferenceVector(), TDynamicSpace::dof, EvaluateSystemFromNJacobian(), TDynamicSpace::fe, TDynamicSpace::g, TDynamicSpace::gn, Manifold2Chart(), TDynamicSpace::ndxVV, TDynamicSpace::ne, TDynamicSpace::nie, TDynamicSpace::nipe, TDynamicSpace::nJp, TDynamicSpace::noe, Norm(), TDynamicSpace::nv, TDynamicSpace::oEqs, TDynamicSpace::pe, TDynamicSpace::pEqs, PrintVector(), TDynamicSpace::pvEqs, TDynamicSpace::selEqs, SumVector(), SumVectorScale(), TDynamicSpace::tp, VectorAnd(), TDynamicSpace::w, TDynamicSpace::xa, and TDynamicSpace::y. Referenced by NextDynamicState(). ◆ EvaluatePermutation()
Defines a permutation matrix to select particular actions in the inverse dynamics.
Definition at line 4593 of file dynamics.c. References TDynamicSpace::a2x, TDynamicSpace::da, TDynamicSpace::npv, TDynamicSpace::P, and RC2INDEX. Referenced by ComputeInverseDynamics(). ◆ ValidState()
Checks if the the dynamic state is valid. For instance if the contact forces are the required ones. For instance, in the cable-driven robot ensures that the cables are always in tension. This is used when computing the next dynamic step. This assumes that ComputeAcceleration has been just used to update 'ds'. This is the case at the end of NextDynamicState which is wehre we use this function right now.
Definition at line 4641 of file dynamics.c. References TDynamicSpace::solA, and TRUE. Referenced by NextDynamicState(), NextDynamicStateEuler(), NextDynamicStateLocalEuler(), NextDynamicStateLocalRK4(), and NextDynamicStateRK4(). ◆ InitHandC()
Initializes the data fields in ds necessary to compute the H and C (see HandC).
Definition at line 664 of file dynamics.c. References TDynamicSpace::a_grav, TDynamicSpace::auxSAM1, TDynamicSpace::auxSAM2, TDynamicSpace::auxSAV1, TDynamicSpace::auxSAV2, TDynamicSpace::auxSAV3, TDynamicSpace::avp, AXIS_H, AXIS_X, AXIS_Y, AXIS_Z, TDynamicSpace::bJHC, TDynamicSpace::cJoint, TDynamicSpace::closeTr, CT_G_AXIS, TDynamicSpace::damped, TDynamicSpace::dh, Error(), FALSE, TDynamicSpace::fe, TDynamicSpace::feHC, TDynamicSpace::fh, FIX_JOINT, TDynamicSpace::fout, TDynamicSpace::friction, TDynamicSpace::fvp, TDynamicSpace::gamma, TDynamicSpace::gammaHC, GetJointDamping(), GetJointDOF(), GetJointFriction(), GetJointPostT(), GetJointPreT(), GetJointType(), GetLinkInertialFrame(), GetLinkInertiaMatrix(), GetLinkMass(), GetParameter(), GetWorldClosureN(), GetWorldJoint2Dof(), GetWorldJointTo(), GetWorldLinkN(), GetWorldPredLink(), HandC_Thread, HTransform2SAM(), HTransformCopy(), HTransformGetElement(), HTransformIdentity(), HTransformInverse(), HTransformPrint(), HTransformProduct(), TDynamicSpace::IC, IdentitySAM(), TDynamicSpace::IM, IsConnectionSpring(), TDynamicSpace::iXaTr, TDynamicSpace::iXtreeTr, TDynamicSpace::iXupTr, TDynamicSpace::j, TDynamicSpace::j2x, TDynamicSpace::jID, JointFromID(), JointToID(), TDynamicSpace::jSgn, TDynamicSpace::l, TDynamicSpace::lID, M_G, MatrixMatrixProduct(), MatrixTMatrixProduct(), mci2rbi(), TDynamicSpace::nef, NEW, TDynamicSpace::nipe, TDynamicSpace::nj, TDynamicSpace::njx, TDynamicSpace::nl, TDynamicSpace::nlHC, TDynamicSpace::nLoops, NO_UINT, TDynamicSpace::noe, TDynamicSpace::npv, NumLoops(), TDynamicSpace::oID, TDynamicSpace::pLink, PrintMatrix(), RC2INDEX, TDynamicSpace::S, ScaleVector(), TDynamicSpace::v, TDynamicSpace::vJ, TDynamicSpace::vxS, TDynamicSpace::wo, TDynamicSpace::wr1, TDynamicSpace::wr2, TDynamicSpace::XJ, TDynamicSpace::Xtree, and TDynamicSpace::Xup. Referenced by InitDynamicSpace(). ◆ ComputeHandC_FJH()
Computes the function, the Jacobian and the Hessian re-using data computed in HandC.
Definition at line 1025 of file dynamics.c. References AddSubMatrix(), TDynamicSpace::auxSAM1, TDynamicSpace::auxSAM2, TDynamicSpace::auxSAV1, TDynamicSpace::avp, AXIS_H, AXIS_X, AXIS_Y, AXIS_Z, TDynamicSpace::bJHC, TDynamicSpace::cJoint, TDynamicSpace::closeTr, CS_WD_EVALUATE_SUBSET_SIMP_EQUATIONS, CT_EPSILON, TDynamicSpace::fe, TDynamicSpace::feHC, TDynamicSpace::gamma, TDynamicSpace::gammaHC, GetParameter(), TDynamicSpace::Hpv, HTransformGetElement(), HTransformInverse(), HTransformProduct(), HTransformSubstract(), HTransformXSAV(), TDynamicSpace::iXaTr, TDynamicSpace::j, TDynamicSpace::j2x, JointToID(), TDynamicSpace::Jp, MatrixFromSubMatrix(), MatrixMatrixProduct(), MatrixVectorProduct(), NEW, TDynamicSpace::nie, TDynamicSpace::nipe, TDynamicSpace::njx, TDynamicSpace::nl, TDynamicSpace::nLoops, TDynamicSpace::noe, TDynamicSpace::nov, TDynamicSpace::npv, TDynamicSpace::oEqs, TDynamicSpace::oID, TDynamicSpace::pLink, RowsDotProduct(), TDynamicSpace::S, SelectMatrixRows(), SubtractVector(), TRUE, TDynamicSpace::vxS, and TDynamicSpace::w. Referenced by HandC(). ◆ ApplyExternalForces()
Auxiliary function of HandC that applies the external forces to the computation of C.
Definition at line 1195 of file dynamics.c. References TDynamicSpace::auxSAV1, DeleteLinkTransforms(), TDynamicSpace::fvp, GetConnectionLinkWrench(), GetConnectLinkFrom(), GetConnectLinkTo(), GetLinkTransformsFromSolutionPoint(), HandC_Thread, HTransformPrint(), HTransformXSAV(), IsConnectionSpring(), TDynamicSpace::iXaTr, TDynamicSpace::l, TDynamicSpace::lID, TDynamicSpace::nlHC, NO_UINT, TDynamicSpace::oID, PrintMatrix(), PrintVector(), scaleSAV(), sumSAV(), TRUE, TSAMxSAV(), TDynamicSpace::wo, TDynamicSpace::wr1, and TDynamicSpace::wr2. Referenced by HandC(). ◆ ComputeC()
Compute the C term of HandC
Definition at line 1294 of file dynamics.c. References TDynamicSpace::a2x, TDynamicSpace::da, TDynamicSpace::damped, TDynamicSpace::friction, TDynamicSpace::fvp, GetJointDamping(), GetJointFriction(), HandC_Thread, TDynamicSpace::j, TDynamicSpace::j2x, TDynamicSpace::jID, TDynamicSpace::lID, TDynamicSpace::njx, TDynamicSpace::nlHC, NO_UINT, TDynamicSpace::npv, TDynamicSpace::pLink, PrintMatrix(), PrintVector(), TDynamicSpace::S, SAVxSAV(), ScaleVector(), SGN, TMatrixVectorProduct(), TSAMxSAVAccum(), and TDynamicSpace::Xup. Referenced by HandC(). ◆ ComputeH()
Compute the H term of HandC
Definition at line 1422 of file dynamics.c. References TDynamicSpace::auxSAM1, TDynamicSpace::auxSAV1, copySAV(), TDynamicSpace::dh, TDynamicSpace::fh, HandC_Thread, TDynamicSpace::IC, TDynamicSpace::j2x, TDynamicSpace::lID, MatrixMatrixProduct(), TDynamicSpace::njx, TDynamicSpace::nlHC, NO_UINT, TDynamicSpace::npv, TDynamicSpace::pLink, PrintMatrix(), PrintVector(), RC2INDEX, TDynamicSpace::S, SAMxSAV(), SAVxSAV(), SubMatrixFromMatrix(), SubMatrixFromTMatrix(), TMatrixMatrixProduct(), TSAMxSAV(), and TDynamicSpace::Xup. Referenced by HandC(). ◆ HandC()
This replicates the HandC function in the code by Featherstone. The only difference is that our C includes the action, thus, it is tau-C in Featherstone code.
Definition at line 1564 of file dynamics.c. References TDynamicSpace::a_grav, ApplyExternalForces(), TDynamicSpace::auxSAM1, TDynamicSpace::auxSAM2, TDynamicSpace::auxSAV1, TDynamicSpace::auxSAV2, TDynamicSpace::auxSAV3, TDynamicSpace::avp, ComputeC(), ComputeH(), ComputeHandC_FJH(), copySAM(), copySAV(), crf(), CRFxSAM(), crm(), CRMxSAV(), TDynamicSpace::da, TDynamicSpace::fvp, GetColumn(), GetJointBasicTransform(), HandC_FJH, HandC_Thread, HTransform2SAM(), HTransformCopy(), HTransformProduct(), HTransformXSAV(), TDynamicSpace::IC, TDynamicSpace::IM, TDynamicSpace::iXaTr, TDynamicSpace::iXJTr, TDynamicSpace::iXtreeTr, TDynamicSpace::iXupTr, TDynamicSpace::j, TDynamicSpace::j2x, TDynamicSpace::jID, TDynamicSpace::jSgn, TDynamicSpace::lID, MatrixMatrixProduct(), MatrixVectorProduct(), TDynamicSpace::nef, TDynamicSpace::njx, TDynamicSpace::nlHC, NO_UINT, TDynamicSpace::nov, TDynamicSpace::npv, TDynamicSpace::nv, TDynamicSpace::pLink, PrintMatrix(), PrintVector(), TDynamicSpace::S, SAMxSAM(), SAMxSAMAccum(), SAMxSAV(), SAMxSAVAccum(), ScaleVector(), SetColumn(), sumSAV(), SumVectorScale(), TSAMxSAM(), TDynamicSpace::v, TDynamicSpace::vJ, TDynamicSpace::vxS, TDynamicSpace::XJ, TDynamicSpace::Xtree, and TDynamicSpace::Xup. Referenced by ComputeAcceleration(), and ComputeInverseDynamics(). ◆ DeleteHandC()
Deletes the data allocated with InitHandC.
Definition at line 2106 of file dynamics.c. References TDynamicSpace::a_grav, TDynamicSpace::auxSAM1, TDynamicSpace::auxSAM2, TDynamicSpace::auxSAV1, TDynamicSpace::auxSAV2, TDynamicSpace::auxSAV3, TDynamicSpace::avp, TDynamicSpace::bJHC, TDynamicSpace::cJoint, TDynamicSpace::closeTr, TDynamicSpace::dh, TDynamicSpace::feHC, TDynamicSpace::fh, TDynamicSpace::fout, TDynamicSpace::fvp, TDynamicSpace::gammaHC, TDynamicSpace::IC, TDynamicSpace::IM, TDynamicSpace::iXaTr, TDynamicSpace::iXtreeTr, TDynamicSpace::iXupTr, TDynamicSpace::j2x, TDynamicSpace::jID, TDynamicSpace::jSgn, TDynamicSpace::lID, TDynamicSpace::nipe, TDynamicSpace::njx, TDynamicSpace::nlHC, TDynamicSpace::nLoops, TDynamicSpace::oID, TDynamicSpace::pLink, TDynamicSpace::S, TDynamicSpace::v, TDynamicSpace::vJ, TDynamicSpace::vxS, TDynamicSpace::wr1, TDynamicSpace::wr2, TDynamicSpace::XJ, TDynamicSpace::Xtree, and TDynamicSpace::Xup. Referenced by DeleteDynamicSpace(). ◆ dr()
Computes the derivative of 'r' on a given point. This is used to integrate 'r' possibly with different methods (Euler, RK4,...) The output is stored in ds->dr_LQR.
Definition at line 4075 of file dynamics.c. References AccumulateVector(), TDynamicSpace::dr_LQR, TDynamicSpace::lsSize_LQR, and MatrixVectorProduct(). Referenced by InitRRT(), LoadRRT(), and LQRComputePolicy(). ◆ dG()
Computes the derivative of 'G' on a given point. This is used to integrate 'G' possibly with different methods (Euler, RK4,...) The output is stored in ds->dG_LQR.
Definition at line 4081 of file dynamics.c. References AccumulateTMatrix(), AccumulateVector(), TDynamicSpace::dG_LQR, TDynamicSpace::lsSize_LQR, and MatrixMatrixProduct(). Referenced by LQRComputePolicy(). ◆ dGt()
Computes the derivative of G in terms of time. This is used as for an alternative way to compute G (as an integration on time instead than an integration over G). The output is stored in ds->dG_LQR.
Definition at line 4314 of file dynamics.c. References TDynamicSpace::dG_LQR, TDynamicSpace::Gtemp_LQR, TDynamicSpace::lsSize_LQR, MatrixExponential(), MatrixMatrixProduct(), MatrixTMatrixProduct(), and SymmetrizeMatrix(). Referenced by LQRComputePolicy_t(). ◆ MechEnergy()
This replicates part of the the EnerMo function in the code by Featherstone.
Definition at line 1918 of file dynamics.c. References TDynamicSpace::a_grav, TDynamicSpace::auxSAM1, TDynamicSpace::auxSAM2, TDynamicSpace::auxSAV1, copySAM(), copySAV(), DeleteLinkTransforms(), GeneralDotProduct(), GetConnectionLinkPotentialEnergy(), GetJointBasicTransform(), GetLinkTransformsFromSolutionPoint(), HTransform2SAM(), HTransformCopy(), HTransformProduct(), HTransformXSAV(), TDynamicSpace::IC, TDynamicSpace::IM, IsConnectionSpring(), TDynamicSpace::j, TDynamicSpace::j2x, TDynamicSpace::jID, TDynamicSpace::jSgn, TDynamicSpace::l, TDynamicSpace::lID, MatrixMatrixProduct(), MatrixVectorProduct(), TDynamicSpace::nef, TDynamicSpace::njx, TDynamicSpace::nlHC, NO_UINT, TDynamicSpace::npv, TDynamicSpace::nv, TDynamicSpace::pLink, PrintMatrix(), PrintVector(), rbi2mci(), TDynamicSpace::S, SAMxSAM(), SAMxSAV(), SAVxSAV(), ScaleVector(), sumSAM(), sumSAV(), TRUE, TSAMxSAM(), TDynamicSpace::v, TDynamicSpace::vJ, TDynamicSpace::wo, TDynamicSpace::XJ, TDynamicSpace::Xtree, and TDynamicSpace::Xup. Referenced by main(). ◆ InitDynamicSpace()
Initializes the space to be used when computing the acceleration and during the integration.
Definition at line 2180 of file dynamics.c. References TDynamicSpace::A, TDynamicSpace::a2j, TDynamicSpace::a2x, TDynamicSpace::A_ID, TDynamicSpace::A_LQR, TDynamicSpace::action, ActuatedJoint(), AllocateHessianEvaluationAsVectors(), TDynamicSpace::B, TDynamicSpace::bJ, TDynamicSpace::bJp, TDynamicSpace::cJ, CopyNonDynamicsJacobian(), CopyPositionJacobian(), CS_WD_GENERATE_SIMP_INITIAL_BOX, CS_WD_GET_POSITION_EQS, CS_WD_GET_POSITION_VARS, CS_WD_GET_POSITION_VELOCITY_EQS, CS_WD_GET_POSITION_VELOCITY_VARS, CS_WD_GET_SIMP_NHESSIAN, CS_WD_GET_SIMP_NJACOBIAN, CS_WD_GET_SIMP_TOPOLOGY, CT_N_DOF, CT_REPRESENTATION, CT_TAU, TDynamicSpace::d0_LQR, TDynamicSpace::d_LQR, TDynamicSpace::da, TDynamicSpace::dG_LQR, TDynamicSpace::dGtemp_LQR, TDynamicSpace::dof, TDynamicSpace::domain, TDynamicSpace::dr_LQR, TDynamicSpace::eA_LQR, TDynamicSpace::effort, Error(), FALSE, TDynamicSpace::fe, TDynamicSpace::fE_LQR, TDynamicSpace::g, TDynamicSpace::G_LQR, TDynamicSpace::gamma, TDynamicSpace::Gd, GET_WORLD, GetBroydenMatrixBuffer(), GetBroydenRHBuffer(), GetJacobianSize(), GetJointCost(), GetJointDOF(), GetJointEffort(), GetLSMatrixBuffer(), GetLSRHBuffer(), GetLSSolutionBuffer(), GetParameter(), GetScalarJacobian(), GetWorldActionDimension(), GetWorldJoint(), GetWorldLink(), GetWorldNJoints(), GetWorldNLinks(), TDynamicSpace::gn, TDynamicSpace::Gnew_LQR, TDynamicSpace::Gtemp_LQR, TDynamicSpace::gy, TDynamicSpace::Hp, TDynamicSpace::Hpv, IdentityMatrix(), InitBroyden(), InitHandC(), InitHessian(), InitLS(), TDynamicSpace::iR, TDynamicSpace::iRBt, TDynamicSpace::J, TDynamicSpace::j, TDynamicSpace::Joo, TDynamicSpace::Jop, TDynamicSpace::Jot, TDynamicSpace::Jp, TDynamicSpace::k1, TDynamicSpace::k2, TDynamicSpace::k3, TDynamicSpace::l, TDynamicSpace::lsSize, TDynamicSpace::lsSize_ID, TDynamicSpace::lsSize_LQR, TDynamicSpace::mA, TDynamicSpace::mA_ID, TDynamicSpace::mA_LQR, TDynamicSpace::mAt, TDynamicSpace::mB, TDynamicSpace::Mm, TDynamicSpace::ndxOE, TDynamicSpace::ndxOV, TDynamicSpace::ndxPE, TDynamicSpace::ndxPV, TDynamicSpace::ndxVE, TDynamicSpace::ndxVV, TDynamicSpace::ne, NEW, TDynamicSpace::nHp, TDynamicSpace::nie, TDynamicSpace::nipe, TDynamicSpace::nj, TDynamicSpace::nJp, TDynamicSpace::nl, TDynamicSpace::noe, TDynamicSpace::nov, TDynamicSpace::npe, TDynamicSpace::npv, NumLoops(), TDynamicSpace::nv, TDynamicSpace::o, TDynamicSpace::oEqs, ON_CUIKSYSTEM, TDynamicSpace::P, TDynamicSpace::parallel, TDynamicSpace::pe, TDynamicSpace::pEqs, TDynamicSpace::pos, TDynamicSpace::pVars, TDynamicSpace::pvEqs, TDynamicSpace::pvVars, TDynamicSpace::Qa, TDynamicSpace::qdd, TDynamicSpace::r_LQR, RC2INDEX, REP_JOINTS, TDynamicSpace::rhsA, TDynamicSpace::rhsA_ID, TDynamicSpace::rhsA_LQR, TDynamicSpace::rnew_LQR, TDynamicSpace::rtemp_LQR, TDynamicSpace::selEqs, TDynamicSpace::sHp, TDynamicSpace::sJ, TDynamicSpace::sJoo, TDynamicSpace::sJop, TDynamicSpace::sJp, TDynamicSpace::solA, TDynamicSpace::solA_ID, TDynamicSpace::solA_LQR, TOPOLOGY_S, TDynamicSpace::tp, TRUE, TDynamicSpace::vel, TDynamicSpace::w, TDynamicSpace::x0_LQR, TDynamicSpace::x_LQR, TDynamicSpace::xa, TDynamicSpace::y, and TDynamicSpace::y_LQR. Referenced by InitAtlasRRT(), kinobiRRT(), kinoEST(), kinoRRT(), LoadAtlasRRT(), and main(). ◆ Getxdot()
Computes the derivative of a state. This includes the velocity, the acceleration and the derivative of the non-dynamic equations.
Definition at line 2598 of file dynamics.c. References ComputeAcceleration(), FALSE, TDynamicSpace::g, and TDynamicSpace::nv. Referenced by AtlasRRTValidateSample(), and main(). ◆ GetInverseActionCostMatrix()
Returns a pointer to the invers of the matrix weighting the cost of each action in the LQR used a sterring method.
Definition at line 2607 of file dynamics.c. References TDynamicSpace::iR. Referenced by UpdateLQRPolicy(). ◆ Time2Go()
Linear approximation of the time to go from a given state to another one. This is implemented with the aim of improving the nearest-neighbour metric in RRTs. The information is better than the one given by a simple Euclidean metric but it is significantly slower to compute and it is only a first order approximation. This is inspired in the derivation included in "An RRT-Based Algorithm for Testing and Validating Multi-Robot Controllers" by J. Kim, J. M. Esposito, and V. Kumar Robotics Science and Systems 2001. The main difference is that we have a constraint manifold and, thus, we compute the time to go in tangent space. Consequently, we can only compute it for samples in the same tangent space (sharing the same local parameterization). The time to go is computed as with d the distance between the goal and the current position and r the decrease ration of this distance. 'd' is computed as the Euclidean distance (between parameterizations). 'r' is more difficult to estimate. Actually an exact value for 'r' is as difficult as finding the solution to the two point boundary value problem (TPBVP) between the departing and the goal states. In general the TPBVP is hard and, thus we only find an approximation to the solution. This approximation is based on a linear approximation of the time to go evaluated at the departing state If 'd' is the Euclidean distance with . Moreover Thus, and In this context . We need to estimate . Probably the easiest estimation is to take it as 0. An alternative is to use the acceleration resulting from u=0 (null action). Yet another option is to select the action which results in lower time2go. This optimization can be approximated via sampling in the space of actions or computed in closed form via linear programming if can be expressed in linear form with respect to the actions (this is not implemented yet). Finally, note that we compute the time to go in the parameter space (in this way v, makes some sense). Thus, 'x' is actually 't' and is the second half of 't' (the one giving the velocity parameters).
Definition at line 2612 of file dynamics.c. References TDynamicSpace::action, ComputeAcceleration(), CT_EPSILON, TDynamicSpace::da, DifferenceVector(), TDynamicSpace::dof, FALSE, TDynamicSpace::g, GeneralDotProduct(), GetChartTangentSpace(), GetParameter(), INF, NEW, TDynamicSpace::nie, Norm(), TDynamicSpace::nv, and TMatrixVectorProduct(). Referenced by AddBranchToAtlasDynamicRRT(), GetRRTNNInChart(), and Time2GoNNToTree(). ◆ ApproachState()
Simulates different actions with the aim of approaching a given goal state and identifies the action that approaches most to the goal.
Definition at line 2687 of file dynamics.c. References CT_DELTA, CT_INTEGRATION_TIME, CT_N_DYNAMIC_ACTIONS, TDynamicSpace::da, DeleteTrajectory(), DistanceTopology(), GetActionFromID(), GetParameter(), INF, NEW, NumericIntegration(), TDynamicSpace::nv, randomDouble(), and TDynamicSpace::tp. Referenced by kinobiRRT(), and kinoRRT(). ◆ kinoRRT()
Adds as many branches as necessary to the RRT (using AddBranchToRRT) until a targed configuration is reached (approached at a small distance). The tree extension is performed using the strategy defined in Dalibard, S., Nakhaei, A., Lamiraux, F., and Laumond, J.-P. (2009). Whole-body task planning for a humanoid robot: a way to integrate collision avoidance. In IEEE-RAS International Conference on Humanoid Robots, pages 355-360.
Definition at line 2749 of file dynamics.c. References AddNodeToRRT(), ApproachState(), CS_WD_ERROR_IN_SIMP_EQUATIONS, CS_WD_GENERATE_SIMPLIFIED_POINT, CS_WD_GET_SIMP_JACOBIAN, CS_WD_ORIGINAL_IN_COLLISION, CS_WD_REGENERATE_SOLUTION_POINT, CS_WD_SIMP_INEQUALITIES_HOLD, CT_DELTA, CT_DYNAMIC_GOAL_ERROR, CT_EPSILON, CT_MAX_NODES_RRT, CT_MAX_PLANNING_TIME, CT_SAMPLING, TDynamicSpace::da, DeleteDynamicSpace(), DeleteJacobian(), DeleteStatistics(), DeleteTrajectory(), DistanceTopology(), TDynamicSpace::domain, Error(), EXPLORATION_RRT, FALSE, GetElapsedTime(), GetParameter(), GetRRTMode(), GetRRTNode(), GetRRTNumNodes(), INF, InitDynamicSpace(), InitStatistics(), TDynamicSpace::ne, NEW, NO_UINT, TDynamicSpace::nv, ONE_TREE, PathStart2GoalInRRT(), PointInBoxTopology(), PointInRRT(), RRT_VERBOSE, RRTSample(), RRTValidateSample(), START2GOAL, TDynamicSpace::tp, TRUE, and Warning(). Referenced by main(). ◆ kinobiRRT()
Adds as many branches as necessary to the RRT (using AddBranchToRRT) until a targed configuration is reached (approached at a small distance). The tree extension is performed using the strategy defined in Dalibard, S., Nakhaei, A., Lamiraux, F., and Laumond, J.-P. (2009). Whole-body task planning for a humanoid robot: a way to integrate collision avoidance. In IEEE-RAS International Conference on Humanoid Robots, pages 355-360.
Definition at line 2898 of file dynamics.c. References AddNodeToRRT(), ApproachState(), CS_WD_ERROR_IN_SIMP_EQUATIONS, CS_WD_GENERATE_SIMPLIFIED_POINT, CS_WD_GET_SIMP_JACOBIAN, CS_WD_ORIGINAL_IN_COLLISION, CS_WD_REGENERATE_SOLUTION_POINT, CS_WD_SIMP_INEQUALITIES_HOLD, CT_DELTA, CT_DYNAMIC_GOAL_ERROR, CT_EPSILON, CT_MAX_NODES_RRT, CT_MAX_PLANNING_TIME, CT_SAMPLING, TDynamicSpace::da, DeleteDynamicSpace(), DeleteJacobian(), DeleteStatistics(), DeleteTrajectory(), DistanceTopology(), TDynamicSpace::domain, Error(), FALSE, GetElapsedTime(), GetParameter(), GetRRTMode(), GetRRTNN(), GetRRTNode(), GetRRTNumNodes(), GOAL2START, INF, InitDynamicSpace(), InitStatistics(), TDynamicSpace::ne, NEW, TDynamicSpace::nv, PathStart2GoalInRRT(), PointInBoxTopology(), PointInRRT(), RRT_VERBOSE, RRTSample(), RRTValidateSample(), START2GOAL, TDynamicSpace::tp, TRUE, TWO_TREES, and Warning(). Referenced by main(). ◆ kinoEST()
Adds as many branches as necessary to the EST (using AddBranchToRRT) until a targed configuration is reached (approached at a small distance). The tree extension is performed using the strategy defined in HSU et al.
Definition at line 3096 of file dynamics.c. References AddNodeToRRT(), CS_WD_ERROR_IN_SIMP_EQUATIONS, CS_WD_GENERATE_SIMPLIFIED_POINT, CS_WD_GET_SIMP_JACOBIAN, CS_WD_ORIGINAL_IN_COLLISION, CS_WD_REGENERATE_SOLUTION_POINT, CS_WD_SIMP_INEQUALITIES_HOLD, CT_DELTA, CT_DYNAMIC_GOAL_ERROR, CT_EPSILON, CT_GAMMA, CT_INTEGRATION_TIME, CT_MAX_NODES_RRT, CT_MAX_PLANNING_TIME, CT_N_DYNAMIC_ACTIONS, TDynamicSpace::da, DeleteDynamicSpace(), DeleteJacobian(), DeleteStatistics(), DeleteTrajectory(), DistanceTopology(), TDynamicSpace::domain, Error(), FALSE, GetActionFromID(), GetElapsedTime(), GetParameter(), GetRRTMode(), GetRRTNNInBall(), GetRRTNode(), GetRRTNodeCost(), GetRRTNumNodes(), InitDynamicSpace(), InitStatistics(), TDynamicSpace::ne, NEW, NO_UINT, NumericIntegration(), TDynamicSpace::nv, ONE_TREE, PathStart2GoalInRRT(), PointInBoxTopology(), PointInRRT(), randomDouble(), randomMax(), RRT_VERBOSE, SetRRTNodeCost(), START2GOAL, TDynamicSpace::tp, TRUE, and Warning(). Referenced by main(). ◆ ComputeInverseDynamics()
Computes the input u for the inverse dynamics of a closed kinematic chain.
Definition at line 3270 of file dynamics.c. References TDynamicSpace::A_ID, CT_EPSILON, TDynamicSpace::da, Error(), EvaluatePermutation(), FALSE, GetParameter(), GetPositionJacobian(), HandC(), TDynamicSpace::Jp, TDynamicSpace::lsSize_ID, LSSolve(), TDynamicSpace::mA_ID, MatrixVectorProduct(), TDynamicSpace::Mm, TDynamicSpace::ndxPV, TDynamicSpace::nipe, TDynamicSpace::npv, TDynamicSpace::P, TDynamicSpace::pos, TDynamicSpace::Qa, TDynamicSpace::rhsA_ID, TDynamicSpace::solA_ID, SubMatrixFromMatrix(), SubMatrixFromTMatrix(), and SubtractVector(). Referenced by ConnectDynamicStatesID(), and NextDynamicState(). ◆ NextDynamicState()
Computes next state using the implicit trapezoid method.
Definition at line 3321 of file dynamics.c. References TDynamicSpace::a2j, AccumulateVector(), TDynamicSpace::action, TDynamicSpace::B, BroydenStep(), BroydenUpdateJacobian(), Chart2Manifold(), ComputeAcceleration(), ComputeInverseDynamics(), CT_EPSILON, CT_MAX_NEWTON_ITERATIONS, CT_NEG_LM, TDynamicSpace::da, TDynamicSpace::dof, DynamicStepCtResidue(), DynamicStepResidue(), TDynamicSpace::effort, FALSE, TDynamicSpace::fe, TDynamicSpace::g, GetChartCenter(), GetChartTangentSpace(), GetParameter(), TDynamicSpace::gn, GOAL2START, TDynamicSpace::gy, IdentityMatrix(), INF, TDynamicSpace::J, TDynamicSpace::mB, TDynamicSpace::ndxPV, NextDynamicStateLocalRK4(), TDynamicSpace::nie, TDynamicSpace::nipe, Norm(), TDynamicSpace::npv, TDynamicSpace::nv, PrintMatrix(), PrintTMatrix(), PrintVector(), ResetBroyden(), TDynamicSpace::sJ, SubMatrixFromMatrix(), SubMatrixFromTMatrix(), SumVectorScale(), TMatrixVectorProduct(), TDynamicSpace::tp, TRUE, ValidState(), and TDynamicSpace::xa. Referenced by ConnectDynamicStates(), ConnectDynamicStatesID(), and NewTemptativeSample(). ◆ NextDynamicStateLocalEuler()
Computes next state using the explicit Euler method in local coordinates. The difference with respect NextDynamicStateEuler is that here the final point is foced to be on the manifold. The Euler method is applied in local coordinates the final parameter is projected to the manifold.
Definition at line 3509 of file dynamics.c. References Chart2Manifold(), ComputeAcceleration(), CT_NEG_LM, TDynamicSpace::dof, FALSE, TDynamicSpace::g, GetChartTangentSpace(), GetParameter(), GOAL2START, TDynamicSpace::gy, INF, NextDynamicStateEuler(), TDynamicSpace::nie, Norm(), TDynamicSpace::nv, TDynamicSpace::sJ, SumVectorScale(), TMatrixVectorProduct(), TDynamicSpace::tp, ValidState(), and TDynamicSpace::y. Referenced by NewTemptativeSample(), and NextDynamicStateLocalRK4(). ◆ NextDynamicStateLocalRK4()
Computes next state using the explicit RK4 method in local coordinates. The difference with respect NextDynamicStateRK4 is that here the final point is foced to be on the manifold. The RK4 method is applied in local coordinates the final parameter is projected to the manifold.
Definition at line 3562 of file dynamics.c. References Chart2Manifold(), ComputeAcceleration(), CT_NEG_LM, TDynamicSpace::dof, FALSE, TDynamicSpace::g, GetChartTangentSpace(), GetParameter(), GOAL2START, TDynamicSpace::gy, INF, TDynamicSpace::k1, TDynamicSpace::k2, TDynamicSpace::k3, NextDynamicStateLocalEuler(), NextDynamicStateRK4(), TDynamicSpace::nie, Norm(), TDynamicSpace::nv, TDynamicSpace::sJ, SumVector(), SumVectorScale(), TMatrixVectorProduct(), TDynamicSpace::tp, TRUE, ValidState(), and TDynamicSpace::y. Referenced by NewTemptativeSample(), and NextDynamicState(). ◆ NextDynamicStateEuler()
Computes next state using forward Euler method.
Definition at line 3654 of file dynamics.c. References ComputeAcceleration(), CT_NEG_LM, FALSE, TDynamicSpace::g, GetParameter(), GOAL2START, INF, Norm(), TDynamicSpace::nv, SumVectorScale(), and ValidState(). Referenced by main(), NewTemptativeSample(), and NextDynamicStateLocalEuler(). ◆ NextDynamicStateRK4()
Computes next state using 4th order Runge-Kutta.
Definition at line 3696 of file dynamics.c. References ComputeAcceleration(), CT_NEG_LM, FALSE, TDynamicSpace::g, GetParameter(), GOAL2START, INF, TDynamicSpace::k1, TDynamicSpace::k2, TDynamicSpace::k3, Norm(), TDynamicSpace::nv, SumVector(), SumVectorScale(), TRUE, and ValidState(). Referenced by main(), NewTemptativeSample(), and NextDynamicStateLocalRK4(). ◆ NumericIntegration()
Computes the state after some time using a given numerical procedure to approximte the average acceleration in the given time interval. During the integration we check for possible non-valid dynamic states (this is actually done in the intFunction) and possible collisions with obstacles. In this case, the integration is stopped before compleating the given integration time.
Definition at line 3756 of file dynamics.c. References AddStep2Trajectory(), CS_WD_IN_COLLISION, CT_EPSILON, TDynamicSpace::da, DistanceTopology(), TDynamicSpace::domain, FALSE, GetParameter(), INF, InitTrajectory(), NEW, TDynamicSpace::nv, PointInBoxTopology(), TDynamicSpace::tp, TRUE, and TDynamicSpace::w. Referenced by ApproachState(), kinoEST(), and Simulate(). ◆ Simulate()
Dynamic simulation from a given point applying a given action for the integration time fixed in the paremeter structure using the Euler method
Definition at line 3837 of file dynamics.c. References ActionSpaceDimension(), AddStep2Trajectory(), CS_WD_GENERATE_SIMPLIFIED_POINT, CS_WD_GET_SYSTEM_VARS, CS_WD_INIT_CD, CS_WD_REGENERATE_ORIGINAL_POINT, CS_WD_REGENERATE_SOLUTION_POINT, CT_DELTA, CT_INTEGRATION_TIME, Error(), FALSE, GetParameter(), InitTrajectory(), NEW, NumericIntegration(), TDynamicSpace::nv, START2GOAL, and TDynamicSpace::w. Referenced by main(). ◆ LinearizeDynamics()
Computes the matrices of the linear system and store them in the chart info. Note that the linearization is made around the zero input trajectory.
Definition at line 3921 of file dynamics.c. References TDynamicSpace::action, Chart2Manifold(), ComputeAcceleration(), CT_EPSILON, TDynamicSpace::da, TDynamicSpace::dof, FALSE, TDynamicSpace::fE_LQR, TDynamicSpace::g, GetParameter(), NEW, TDynamicSpace::nie, TDynamicSpace::nv, TDynamicSpace::parallel, PrintMatrix(), PrintVector(), ScaleVector(), SetColumn(), TDynamicSpace::sJ, SubtractVector(), TMatrixVectorProduct(), TDynamicSpace::tp, TDynamicSpace::x0_LQR, TDynamicSpace::x_LQR, and TDynamicSpace::y_LQR. Referenced by UpdateLQRPolicy(). ◆ LQRComputePolicy()
Determines an open loop LQR policy in parameter spac, i.e., find sthe optimal u(t) that connects the initial y0 with the random sample y1 for the linear system of the form y_dot = A*y+B*u+C
Definition at line 4091 of file dynamics.c. References TDynamicSpace::A_LQR, CT_DELTA, CT_TAU, TDynamicSpace::d_LQR, TDynamicSpace::da, dG(), TDynamicSpace::dG_LQR, TDynamicSpace::dof, dr(), TDynamicSpace::dr_LQR, FALSE, TDynamicSpace::G_LQR, TDynamicSpace::Gd, GeneralDotProduct(), GetParameter(), TDynamicSpace::Gnew_LQR, TDynamicSpace::Gtemp_LQR, INF, TDynamicSpace::iR, TDynamicSpace::iRBt, TDynamicSpace::lsSize_LQR, LSSolveCond(), TDynamicSpace::mA_LQR, TDynamicSpace::mAt, PrintMatrix(), PrintVector(), TDynamicSpace::r_LQR, TDynamicSpace::rhsA_LQR, TDynamicSpace::rnew_LQR, TDynamicSpace::rtemp_LQR, TDynamicSpace::solA_LQR, SubMatrixFromTMatrix(), SumVectorScale(), TDynamicSpace::topt, and TRUE. ◆ LQRComputePolicy_t()
Alternative version of LQRComputePolicy where G is computed as an integral in time (not in G itself).
Definition at line 4322 of file dynamics.c. References TDynamicSpace::A_LQR, CT_DELTA, CT_TAU, TDynamicSpace::d0_LQR, TDynamicSpace::d_LQR, TDynamicSpace::da, TDynamicSpace::dG_LQR, dGt(), TDynamicSpace::dof, TDynamicSpace::eA_LQR, FALSE, TDynamicSpace::G_LQR, TDynamicSpace::Gd, GeneralDotProduct(), GetParameter(), INF, TDynamicSpace::iR, TDynamicSpace::iRBt, TDynamicSpace::lsSize_LQR, LSSolveCond(), TDynamicSpace::mA_LQR, TDynamicSpace::mAt, MatrixVectorProduct(), Norm(), PrintMatrix(), PrintVector(), TDynamicSpace::r_LQR, TDynamicSpace::rhsA_LQR, TDynamicSpace::solA_LQR, SubMatrixFromTMatrix(), SubtractVector(), SumVector(), SumVectorScale(), TDynamicSpace::topt, and TRUE. ◆ LQRPolicy()
Determines the optimal action for a given time from the policy computed in LQRComputePolicy.
Definition at line 4548 of file dynamics.c. References TDynamicSpace::a2j, TDynamicSpace::da, TDynamicSpace::eA_LQR, TDynamicSpace::effort, Error(), TDynamicSpace::Gd, TDynamicSpace::iRBt, TDynamicSpace::lsSize_LQR, TDynamicSpace::mAt, MatrixExponential(), MatrixVectorProduct(), TDynamicSpace::rtemp_LQR, and TDynamicSpace::topt. Referenced by NewTemptativeSample(). ◆ ActionSpaceDimension()
Returns the dimension of the action space. The action space can be seen as a box in Rn space with n the value returned by this function. Any point in this box is a valid action. The limits of the box are the maximum forces and torques of the actuators.
Definition at line 4602 of file dynamics.c. References TDynamicSpace::da. Referenced by AtlasRRTSimulate(), InitAtlasRRT(), and Simulate(). ◆ GetActionFromID()
Defines an action given an identifier. This mapping can be fixed (the same action is returned given an identifer) or varible (a random action is returned each time the function is used with the same indentifier). The identifier is from 0 to N_DYNAMIC_ACTIONS-1. The size of the action vector is given by ActionSpaceDimension
Definition at line 4607 of file dynamics.c. References TDynamicSpace::a2j, TDynamicSpace::da, TDynamicSpace::effort, FALSE, randomDouble(), and TRUE. Referenced by AddBranchToAtlasDynamicRRT(), ApproachState(), and kinoEST(). ◆ PrintDynamicsDefines()
Prints the defines in chart.h This is used only for debug purposes.
Definition at line 4664 of file dynamics.c. References CUT_AT_LINK, DEBUG_DYNAMICS, DEBUG_HandC, DEBUG_HandC_FJH, DYNAMICS_ONE_ACTION_CONNECT, DYNAMICS_ONE_ACTION_EXTEND, EULER_LQR_COMPUTE_POLICY, EXPLICIT_CRF, EXPLICIT_CRM, HandC_EQ_INV, HandC_FJH, HandC_Thread, MAX_J, PRINT_J, RANDOM_DYNAMIC_ACTION, SATURATE_ACTIONS, START_BROYDEN_ON_MANIFOLD, T2G_METRIC, T2G_METRIC_INSIDE_CONNECT, T2G_METRIC_INSIDE_EXTEND, T2G_METRIC_NN_CONNECT, T2G_METRIC_NN_EXTEND, USE_HTxSAV, and USE_XUPTR. Referenced by PrintAtlasRRTDefines(). ◆ DeleteDynamicSpace()
Destructor. Frees the memory included in a dynamic space strucure.
Definition at line 4693 of file dynamics.c. References TDynamicSpace::A, TDynamicSpace::a2j, TDynamicSpace::a2x, TDynamicSpace::A_ID, TDynamicSpace::A_LQR, TDynamicSpace::action, TDynamicSpace::B, TDynamicSpace::bJ, TDynamicSpace::bJp, TDynamicSpace::cJ, TDynamicSpace::d0_LQR, TDynamicSpace::d_LQR, DeleteBox(), DeleteBroyden(), DeleteHandC(), DeleteHessian(), DeleteJacobian(), DeleteLS(), DeleteNHessian(), DeleteNJacobian(), TDynamicSpace::dG_LQR, TDynamicSpace::dGtemp_LQR, TDynamicSpace::domain, TDynamicSpace::dr_LQR, TDynamicSpace::eA_LQR, TDynamicSpace::effort, TDynamicSpace::fE_LQR, FreeHessianEvaluationAsVectors(), TDynamicSpace::g, TDynamicSpace::G_LQR, TDynamicSpace::Gd, TDynamicSpace::gn, TDynamicSpace::Gnew_LQR, TDynamicSpace::Gtemp_LQR, TDynamicSpace::gy, TDynamicSpace::Hp, TDynamicSpace::Hpv, TDynamicSpace::iR, TDynamicSpace::iRBt, TDynamicSpace::J, TDynamicSpace::j, TDynamicSpace::Jot, TDynamicSpace::Jp, TDynamicSpace::k1, TDynamicSpace::k2, TDynamicSpace::k3, TDynamicSpace::l, TDynamicSpace::mAt, TDynamicSpace::Mm, TDynamicSpace::ndxOE, TDynamicSpace::ndxOV, TDynamicSpace::ndxPE, TDynamicSpace::ndxPV, TDynamicSpace::ndxVE, TDynamicSpace::ndxVV, TDynamicSpace::nHp, TDynamicSpace::nJp, TDynamicSpace::noe, TDynamicSpace::nov, TDynamicSpace::npe, TDynamicSpace::npv, TDynamicSpace::o, TDynamicSpace::oEqs, TDynamicSpace::P, TDynamicSpace::pEqs, TDynamicSpace::pos, TDynamicSpace::pVars, TDynamicSpace::pvEqs, TDynamicSpace::pvVars, TDynamicSpace::r_LQR, TDynamicSpace::rnew_LQR, TDynamicSpace::rtemp_LQR, TDynamicSpace::selEqs, TDynamicSpace::sHp, TDynamicSpace::sJoo, TDynamicSpace::sJop, TDynamicSpace::sJp, TDynamicSpace::tp, TDynamicSpace::vel, TDynamicSpace::x0_LQR, TDynamicSpace::x_LQR, TDynamicSpace::xa, TDynamicSpace::y, and TDynamicSpace::y_LQR. Referenced by DeleteAtlasRRT(), kinobiRRT(), kinoEST(), kinoRRT(), and main(). |
Follow us!