Robotran C Documentation
Macros | Functions
user_ExtForces_deriv.c File Reference

Definition of the derivative of the user external forces. More...

#include "math.h"
#include "mbs_data.h"

Macros

#define _USE_MATH_DEFINES
 

Functions

double * user_ExtForces_dq (double PxF[4], double d_PxF[4], double RxF[4][4], double d_RxF[4][4], double VxF[4], double d_VxF[4], double OMxF[4], double d_OMxF[4], double AxF[4], double d_AxF[4], double OMPxF[4], double d_OMPxF[4], MbsData *mbs_data, double tsim, int i_force, int i_joint)
 Compute the partial derivative of an user-specified external force with respect to a generalized coordinate. More...
 
double * user_ExtForces_dqd (double PxF[4], double d_PxF[4], double RxF[4][4], double d_RxF[4][4], double VxF[4], double d_VxF[4], double OMxF[4], double d_OMxF[4], double AxF[4], double d_AxF[4], double OMPxF[4], double d_OMPxF[4], MbsData *mbs_data, double tsim, int i_force, int i_joint)
 Compute the partial derivative of an user-specified external force with respect to a generalized velocity. More...
 
double * user_ExtForces_dqdd (double PxF[4], double d_PxF[4], double RxF[4][4], double d_RxF[4][4], double VxF[4], double d_VxF[4], double OMxF[4], double d_OMxF[4], double AxF[4], double d_AxF[4], double OMPxF[4], double d_OMPxF[4], MbsData *mbs_data, double tsim, int i_force, int i_joint)
 Compute the partial derivative of an user-specified external force with respect to a generalized acceleration. More...
 
double * user_ExtForces_dp (double PxF[4], double d_PxF[4], double RxF[4][4], double d_RxF[4][4], double VxF[4], double d_VxF[4], double OMxF[4], double d_OMxF[4], double AxF[4], double d_AxF[4], double OMPxF[4], double d_OMPxF[4], MbsData *mbs_data, double tsim, int i_force)
 

Detailed Description

Definition of the derivative of the user external forces.

Creation date: October 2020

Author
Robotran Team

(c) Universite catholique de Louvain

Macro Definition Documentation

◆ _USE_MATH_DEFINES

#define _USE_MATH_DEFINES

Function Documentation

◆ user_ExtForces_dp()

double* user_ExtForces_dp ( double  PxF[4],
double  d_PxF[4],
double  RxF[4][4],
double  d_RxF[4][4],
double  VxF[4],
double  d_VxF[4],
double  OMxF[4],
double  d_OMxF[4],
double  AxF[4],
double  d_AxF[4],
double  OMPxF[4],
double  d_OMPxF[4],
MbsData mbs_data,
double  tsim,
int  i_force 
)

◆ user_ExtForces_dq()

double* user_ExtForces_dq ( double  PxF[4],
double  d_PxF[4],
double  RxF[4][4],
double  d_RxF[4][4],
double  VxF[4],
double  d_VxF[4],
double  OMxF[4],
double  d_OMxF[4],
double  AxF[4],
double  d_AxF[4],
double  OMPxF[4],
double  d_OMPxF[4],
MbsData s,
double  tsim,
int  i_force,
int  i_joint 
)

Compute the partial derivative of an user-specified external force with respect to a generalized coordinate.

Parameters
[in]PxFposition vector (index starting at 1) of the force sensor expressed in the inertial frame: $PxF(1:3)=[P_x; P_y; P_z]$.
[in]d_PxFthe partial derivative of PxF with respect to the generalized coordinate of joint i_joint: $d\_PxF = \frac{\partial PxF}{\partial q_{i\_joint}}$.
[in]RxFrotation matrix (index starting at 1) from the inertial frame to the force sensor frame: $[\hat{\mathbf{X}}^S]=RxF(1:3,1:3).[\hat{\mathbf{X}}^0]$
[in]d_RxFthe partial derivative of matrix RxF with respect to the generalized coordinate of joint i_joint: $d\_RxF = \frac{\partial RxF}{\partial q_{i\_joint}}$.
[in]VxFvelocity vector (index starting at 1) of the force sensor expressed in the inertial frame: $VxF(1:3)=[V_x; V_y; V_z]$.
[in]d_VxFthe partial derivative of VxF with respect to the generalized coordinate of joint i_joint: $d\_VxF = \frac{\partial VxF}{\partial q_{i\_joint}}$.
[in]OMxFangular velocity vector (index starting at 1) of the force sensor expressed in the inertial frame: $OMxF(1:3)=[\omega_x; \omega_y; \omega_z]$.
[in]d_OMxFthe partial derivative of OMxF with respect to the generalized coordinate of joint i_joint: $d\_OMxF = \frac{\partial OMxF}{\partial q_{i\_joint}}$.
[in]AxFacceleration vector (index starting at 1) of the force sensor expressed in the inertial frame: $AxF(1:3)=[A_x; A_y; A_z]$.
[in]d_AxFthe partial derivative of AxF with respect to the generalized coordinate of joint i_joint: $d\_AxF = \frac{\partial AxF}{\partial q_{i\_joint}}$.
[in]OMPxFangular acceleration vector (index starting at 1) of the force sensor expressed in the inertial frame: $OMPxF(1:3)=[\dot\omega_x; \dot\omega_y; \dot\omega_z]$.
[in]d_OMPxFthe partial derivative of OMPxF with respect to the generalized coordinate of joint i_joint: $d\_OMPxF = \frac{\partial OMPxF}{\partial q_{i\_joint}}$.
[in,out]sthe MbsData structure of the model on which the force is computed.
[in]tsimthe current time of the simulation
[in]i_forcethe ID identifying the computed force sensor.
[in]i_jointthe index of the generalized coordinate.
Returns
A vector (of size 9, index starting at 0) with the content described for MbsData::mbs_dp->dSWr_dq

The content of the returned vector dSWr_dq is [dF_dq; dMx_dq; ddxF_dq]:

  • Partial derivative of the force components (expressed in the inertial frame): dF_dq = $\left[\frac{\partial Fx}{\partial q_{i\_joint}} ; \frac{\partial Fy}{\partial q_{i\_joint}} ; \frac{\partial Fz}{\partial q_{i\_joint}}\right]$
  • Partial derivative of the pure torque components (expressed in the inertial frame): dM_dq = $\left[\frac{\partial Mx}{\partial q_{i\_joint}} ; \frac{\partial My}{\partial q_{i\_joint}} ; \frac{\partial Mz}{\partial q_{i\_joint}}\right]$
  • Partial derivative of the application point local coordinates vector (expressed in the body-fixed frame): ddxF_dq = $\left[\frac{\partial dxF}{\partial q_{i\_joint}} ; \frac{\partial dxF}{\partial q_{i\_joint}} ; \frac{\partial dxF}{\partial q_{i\_joint}}\right]$

◆ user_ExtForces_dqd()

double* user_ExtForces_dqd ( double  PxF[4],
double  d_PxF[4],
double  RxF[4][4],
double  d_RxF[4][4],
double  VxF[4],
double  d_VxF[4],
double  OMxF[4],
double  d_OMxF[4],
double  AxF[4],
double  d_AxF[4],
double  OMPxF[4],
double  d_OMPxF[4],
MbsData s,
double  tsim,
int  i_force,
int  i_joint 
)

Compute the partial derivative of an user-specified external force with respect to a generalized velocity.

Parameters
[in]PxFposition vector (index starting at 1) of the force sensor expressed in the inertial frame: $PxF(1:3)=[P_x; P_y; P_z]$.
[in]d_PxFthe partial derivative of PxF with respect to the generalized velocity of joint i_joint: $d\_PxF = \frac{\partial PxF}{\partial \dot{q}_{i\_joint}}$.
[in]RxFrotation matrix (index starting at 1) from the inertial frame to the force sensor frame: $[\hat{\mathbf{X}}^S]=RxF(1:3,1:3).[\hat{\mathbf{X}}^0]$
[in]d_RxFthe partial derivative of matrix RxF with respect to the generalized velocity of joint i_joint: $d\_RxF = \frac{\partial RxF}{\partial \dot{q}_{i\_joint}}$.
[in]VxFvelocity vector (index starting at 1) of the force sensor expressed in the inertial frame: $VxF(1:3)=[V_x; V_y; V_z]$.
[in]d_VxFthe partial derivative of VxF with respect to the generalized velocity of joint i_joint: $d\_VxF = \frac{\partial VxF}{\partial \dot{q}_{i\_joint}}$.
[in]OMxFangular velocity vector (index starting at 1) of the force sensor expressed in the inertial frame: $OMxF(1:3)=[\omega_x; \omega_y; \omega_z]$.
[in]d_OMxFthe partial derivative of OMxF with respect to the generalized velocity of joint i_joint: $d\_OMxF = \frac{\partial OMxF}{\partial \dot{q}_{i\_joint}}$.
[in]AxFacceleration vector (index starting at 1) of the force sensor expressed in the inertial frame: $AxF(1:3)=[A_x; A_y; A_z]$.
[in]d_AxFthe partial derivative of AxF with respect to the generalized velocity of joint i_joint: $d\_AxF = \frac{\partial AxF}{\partial \dot{q}_{i\_joint}}$.
[in]OMPxFangular acceleration vector (index starting at 1) of the force sensor expressed in the inertial frame: $OMPxF(1:3)=[\dot\omega_x; \dot\omega_y; \dot\omega_z]$.
[in]d_OMPxFthe partial derivative of OMPxF with respect to the generalized velocity of joint i_joint: $d\_OMPxF = \frac{\partial OMPxF}{\partial \dot{q}_{i\_joint}}$.
[in,out]sthe MbsData structure of the model on which the force is computed.
[in]tsimthe current time of the simulation
[in]i_forcethe ID identifying the computed force sensor.
[in]i_jointthe index of the generalized velocity.
Returns
A vector (of size 9, index starting at 0) with the content described for MbsData::mbs_dp->dSWr_dqd

The content of the returned vector dSWr_dqd is [dF_dqd; dMx_dqd; ddxF_dqd]:

  • Partial derivative of the force components (expressed in the inertial frame): dF_dqd = $\left[\frac{\partial Fx}{\partial \dot{q}_{i\_joint}} ; \frac{\partial Fy}{\partial \dot{q}_{i\_joint}} ; \frac{\partial Fz}{\partial \dot{q}_{i\_joint}}\right]$
  • Partial derivative of the pure torque components (expressed in the inertial frame): dM_dqd = $\left[\frac{\partial Mx}{\partial \dot{q}_{i\_joint}} ; \frac{\partial My}{\partial \dot{q}_{i\_joint}} ; \frac{\partial Mz}{\partial \dot{q}_{i\_joint}}\right]$
  • Partial derivative of the application point local coordinates vector (expressed in the body-fixed frame): ddxF_dqd = $\left[\frac{\partial dxF}{\partial \dot{q}_{i\_joint}} ; \frac{\partial dxF}{\partial \dot{q}_{i\_joint}} ; \frac{\partial dxF}{\partial \dot{q}_{i\_joint}}\right]$

◆ user_ExtForces_dqdd()

double* user_ExtForces_dqdd ( double  PxF[4],
double  d_PxF[4],
double  RxF[4][4],
double  d_RxF[4][4],
double  VxF[4],
double  d_VxF[4],
double  OMxF[4],
double  d_OMxF[4],
double  AxF[4],
double  d_AxF[4],
double  OMPxF[4],
double  d_OMPxF[4],
MbsData s,
double  tsim,
int  i_force,
int  i_joint 
)

Compute the partial derivative of an user-specified external force with respect to a generalized acceleration.

Parameters
[in]PxFposition vector (index starting at 1) of the force sensor expressed in the inertial frame: $PxF(1:3)=[P_x; P_y; P_z]$.
[in]d_PxFthe partial derivative of PxF with respect to the generalized velocity of joint i_joint: $d\_PxF = \frac{\partial PxF}{\partial \dot{q}_{i\_joint}}$.
[in]RxFrotation matrix (index starting at 1) from the inertial frame to the force sensor frame: $[\hat{\mathbf{X}}^S]=RxF(1:3,1:3).[\hat{\mathbf{X}}^0]$
[in]d_RxFthe partial derivative of matrix RxF with respect to the generalized velocity of joint i_joint: $d\_RxF = \frac{\partial RxF}{\partial \dot{q}_{i\_joint}}$.
[in]VxFvelocity vector (index starting at 1) of the force sensor expressed in the inertial frame: $VxF(1:3)=[V_x; V_y; V_z]$.
[in]d_VxFthe partial derivative of VxF with respect to the generalized velocity of joint i_joint: $d\_VxF = \frac{\partial VxF}{\partial \dot{q}_{i\_joint}}$.
[in]OMxFangular velocity vector (index starting at 1) of the force sensor expressed in the inertial frame: $OMxF(1:3)=[\omega_x; \omega_y; \omega_z]$.
[in]d_OMxFthe partial derivative of OMxF with respect to the generalized velocity of joint i_joint: $d\_OMxF = \frac{\partial OMxF}{\partial \dot{q}_{i\_joint}}$.
[in]AxFacceleration vector (index starting at 1) of the force sensor expressed in the inertial frame: $AxF(1:3)=[A_x; A_y; A_z]$.
[in]d_AxFthe partial derivative of AxF with respect to the generalized velocity of joint i_joint: $d\_AxF = \frac{\partial AxF}{\partial \dot{q}_{i\_joint}}$.
[in]OMPxFangular acceleration vector (index starting at 1) of the force sensor expressed in the inertial frame: $OMPxF(1:3)=[\dot\omega_x; \dot\omega_y; \dot\omega_z]$.
[in]d_OMPxFthe partial derivative of OMPxF with respect to the generalized velocity of joint i_joint: $d\_OMPxF = \frac{\partial OMPxF}{\partial \dot{q}_{i\_joint}}$.
[in,out]sthe MbsData structure of the model on which the force is computed.
[in]tsimthe current time of the simulation
[in]i_forcethe ID identifying the computed force sensor.
[in]i_jointthe index of the generalized velocity.
Returns
A vector (of size 9, index starting at 0) with the content described for MbsData::mbs_dp->dSWr_dqdd

The content of the returned vector dSWr_dqdd is [dF_dqdd; dMx_dqdd; ddxF_dqdd]:

  • Partial derivative of the force components (expressed in the inertial frame): dF_dqdd = $\left[\frac{\partial Fx}{\partial \ddot{q}_{i\_joint}} ; \frac{\partial Fy}{\partial \ddot{q}_{i\_joint}} ; \frac{\partial Fz}{\partial \ddot{q}_{i\_joint}}\right]$
  • Partial derivative of the pure torque components (expressed in the inertial frame): dM_dqdd = $\left[\frac{\partial Mx}{\partial \ddot{q}_{i\_joint}} ; \frac{\partial My}{\partial \ddot{q}_{i\_joint}} ; \frac{\partial Mz}{\partial \ddot{q}_{i\_joint}}\right]$
  • Partial derivative of the application point local coordinates vector (expressed in the body-fixed frame): ddxF_dqdd = $\left[\frac{\partial dxF}{\partial \ddot{q}_{i\_joint}} ; \frac{\partial dxF}{\partial \ddot{q}_{i\_joint}} ; \frac{\partial dxF}{\partial \ddot{q}_{i\_joint}}\right]$