Robotran C Documentation
Macros | Functions
user_Link3DForces_deriv.c File Reference
#include "math.h"
#include "mbs_data.h"
#include "mbs_1D_array.h"

Macros

#define _USE_MATH_DEFINES
 

Functions

double * user_Link3DForces_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_link3d, int i_param)
 Compute the partial derivative of a link3D forces with respect to a generalized coordinate. More...
 
double * user_Link3DForces_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_link3d, int i_param)
 Compute the partial derivative of a link3D forces with respect to a generalized velocity. More...
 
double * user_Link3DForces_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_link3d, int i_param)
 Compute the partial derivative of a link3D forces with respect to a generalized acceleration. More...
 
double * user_Link3DForces_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 *s, double tsim, int i_link3d)
 Compute the partial derivative of a link3D forces with respect to a parameter. More...
 

Macro Definition Documentation

◆ _USE_MATH_DEFINES

#define _USE_MATH_DEFINES

Function Documentation

◆ user_Link3DForces_dp()

double* user_Link3DForces_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 s,
double  tsim,
int  i_link3d 
)

Compute the partial derivative of a link3D forces with respect to a parameter.

Parameters
[in]PxFThe vector "AB" (index starting at 1) with components expressed in frame [P].
[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]RxFThe rotation matrix (index starting at 1) such as [C] = Rxf*[P].
[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]VxFThe differential velocity vector (index starting at 1) with components expressed in frame [P]. The velocities are computed at the coordinates of point "M" linked to parent (Md_p), then linked to children (Md_c) body. The differential velocity vector is : Md_c - Md_p.
[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]OMxFThe differential angular velocity vector (index starting at 1) with components expressed in frame [P]. It is the difference between the parent angular velocity and the children angular velocity.
[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]AxFThe differential acceleration vector (index starting at 1) with components expressed in frame [P]. The accelerations are computed at the coordinates of point "M" linked to parent (Mdd_p), then linked to children (Mdd_c) body. The differential acceleration vector is : Mdd_c - Mdd_p.
[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]OMPxFThe differential angular acceleration vector (index starting at 1) with components expressed in frame [P]. It is the difference between the parent angular acceleration and the children angular acceleration.
[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_link3dThe ID identifying the computed link3D force.
Returns
The partial derivative of the link3D force with respect to generalized parameter i_joint: The content of the returned vector dSWr_link3d_dp is [dF_dq; dMx_dq; ddxF_dq]:
  • Partial derivative of the link3d 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]$

    In 1D, it gives:

    \[d\_Flink3D_{i\_link3D} = \frac{\partial Flink3D_{i\_link3D}}{\partial q_{i\_joint}}\]

    .

◆ user_Link3DForces_dq()

double* user_Link3DForces_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_link3d,
int  i_param 
)

Compute the partial derivative of a link3D forces with respect to a generalized coordinate.

Parameters
[in]PxFThe vector "AB" (index starting at 1) with components expressed in frame [P].
[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]RxFThe rotation matrix (index starting at 1) such as [C] = Rxf*[P].
[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]VxFThe differential velocity vector (index starting at 1) with components expressed in frame [P]. The velocities are computed at the coordinates of point "M" linked to parent (Md_p), then linked to children (Md_c) body. The differential velocity vector is : Md_c - Md_p.
[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]OMxFThe differential angular velocity vector (index starting at 1) with components expressed in frame [P]. It is the difference between the parent angular velocity and the children angular velocity.
[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]AxFThe differential acceleration vector (index starting at 1) with components expressed in frame [P]. The accelerations are computed at the coordinates of point "M" linked to parent (Mdd_p), then linked to children (Mdd_c) body. The differential acceleration vector is : Mdd_c - Mdd_p.
[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]OMPxFThe differential angular acceleration vector (index starting at 1) with components expressed in frame [P]. It is the difference between the parent angular acceleration and the children angular acceleration.
[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_link3dThe ID identifying the computed link3D force
[in]i_paramThe id of the parameter.
Returns
The partial derivative of the link3D force with respect to generalized coordinate i_joint: The content of the returned vector dSWr_link3d_dq is [dF_dq; dMx_dq; ddxF_dq]:
  • Partial derivative of the link3d 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]$

    In 1D, it gives:

    \[d\_Flink3D_{i\_link3D} = \frac{\partial Flink3D_{i\_link3D}}{\partial q_{i\_joint}}\]

    .

◆ user_Link3DForces_dqd()

double* user_Link3DForces_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_link3d,
int  i_param 
)

Compute the partial derivative of a link3D forces with respect to a generalized velocity.

Parameters
[in]PxFThe vector "AB" (index starting at 1) with components expressed in frame [P].
[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]RxFThe rotation matrix (index starting at 1) such as [C] = Rxf*[P].
[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]VxFThe differential velocity vector (index starting at 1) with components expressed in frame [P]. The velocities are computed at the coordinates of point "M" linked to parent (Md_p), then linked to children (Md_c) body. The differential velocity vector is : Md_c - Md_p.
[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]OMxFThe differential angular velocity vector (index starting at 1) with components expressed in frame [P]. It is the difference between the parent angular velocity and the children angular velocity.
[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]AxFThe differential acceleration vector (index starting at 1) with components expressed in frame [P]. The accelerations are computed at the coordinates of point "M" linked to parent (Mdd_p), then linked to children (Mdd_c) body. The differential acceleration vector is : Mdd_c - Mdd_p.
[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]OMPxFThe differential angular acceleration vector (index starting at 1) with components expressed in frame [P]. It is the difference between the parent angular acceleration and the children angular acceleration.
[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_link3dThe ID identifying the computed link3D force.
[in]i_paramThe id of the parameter.
Returns
A vector (of size 9, index starting at 0) with the content described for MbsData::mbs_dp->dSWr_link3d_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_Link3DForces_dqdd()

double* user_Link3DForces_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_link3d,
int  i_param 
)

Compute the partial derivative of a link3D forces with respect to a generalized acceleration.

Parameters
[in]PxFThe vector "AB" (index starting at 1) with components expressed in frame [P].
[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]RxFThe rotation matrix (index starting at 1) such as [C] = Rxf*[P].
[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]VxFThe differential velocity vector (index starting at 1) with components expressed in frame [P]. The velocities are computed at the coordinates of point "M" linked to parent (Md_p), then linked to children (Md_c) body. The differential velocity vector is : Md_c - Md_p.
[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]OMxFThe differential angular velocity vector (index starting at 1) with components expressed in frame [P]. It is the difference between the parent angular velocity and the children angular velocity.
[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]AxFThe differential acceleration vector (index starting at 1) with components expressed in frame [P]. The accelerations are computed at the coordinates of point "M" linked to parent (Mdd_p), then linked to children (Mdd_c) body. The differential acceleration vector is : Mdd_c - Mdd_p.
[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]OMPxFThe differential angular acceleration vector (index starting at 1) with components expressed in frame [P]. It is the difference between the parent angular acceleration and the children angular acceleration.
[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_link3dThe ID identifying the computed link3D force.
[in]i_paramThe id of the parameter.
Returns
The partial derivative of the link3D force with respect to generalized acceleration i_joint: The content of the returned vector dSWr_link3d_dqdd is [dF_dq; dMx_dq; ddxF_dq]:
  • Partial derivative of the link3d 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]$

    In 1D, it gives:

    \[d\_Flink3D_{i\_link3D} = \frac{\partial Flink3D_{i\_link3D}}{\partial q_{i\_joint}}\]

    .