DYNAMICS C API
C-compatible interface to the DYNAMICS library
Loading...
Searching...
No Matches
Matrix and general kinematics

Functions

void c_matmul (int m, int n, int k, double alpha, const double *a, int lda, const double *b, int ldb, double beta, double *c, int ldc)
 Multiply two column-major matrices: c = alpha*a*b + beta*c.
 
double c_q_factor (double zeta)
 Compute the Q factor from a damping ratio.
 
double c_estimate_bandwidth (double fn, double zeta)
 Estimate the half-power bandwidth.
 
double c_logarithmic_decrement (double x1, double x2, int n)
 Compute logarithmic decrement from two peaks.
 
double c_damping_from_log_decrement (double delta)
 Convert logarithmic decrement to damping ratio.
 
void c_find_free_response_properties (int n, const double *t, const double *x, double s, int np, double *delta, double *fn, double *x1, double *x2, double *t1, double *t2)
 Extract damping and frequency properties from a free response.
 
double c_rise_time (double wn, double zeta)
 Compute the 10-to-90 percent rise time.
 
double c_find_settling_amplitude (int n, const double *x)
 Find the settled response amplitude.
 
double c_damping_from_fractional_overshoot (int n, const double *x)
 Estimate damping from fractional overshoot.
 
void c_evaluate_step_response (int n, double wn, double zeta, double xs, const double *t, double *x)
 Evaluate a second-order step response.
 
void c_rotate_x (double angle, double *r, int ldr)
 Build a rotation matrix about the x axis.
 
void c_rotate_y (double angle, double *r, int ldr)
 Build a rotation matrix about the y axis.
 
void c_rotate_z (double angle, double *r, int ldr)
 Build a rotation matrix about the z axis.
 
void c_rotate (const double i[3], const double j[3], const double k[3], double *r, int ldr)
 Build a rotation matrix from three basis vectors.
 
void c_acceleration_transform (const double alpha[3], const double omega[3], const double a[3], const double x[3], double *r, int ldr)
 Build an acceleration transformation matrix.
 
void c_velocity_transform (const double omega[3], const double v[3], const double x[3], double *r, int ldr)
 Build a velocity transformation matrix.
 
void c_determine_local_stability (int n, const double *a, int lda, double complex *ev, int *flag)
 Classify the eigenvalues of a linearized system for local stability.
 
void c_dh_forward_kinematics_table (const c_dh_table *tbl, double *T, int ldt)
 Compute forward kinematics from a Denavit-Hartenberg table.
 
void c_dh_forward_kinematics (int n, const double *alpha, const double *a, const double *theta, const double *d, double *T, int ldt)
 Compute serial Denavit-Hartenberg forward kinematics.
 
void c_dh_forward_kinematics_2 (const double *T1, int ldt1, const double *T2, int ldt2, double *T, int ldt)
 Multiply two homogeneous transforms.
 
void c_dh_forward_kinematics_3 (const double *T1, int ldt1, const double *T2, int ldt2, const double *T3, int ldt3, double *T, int ldt)
 Multiply three homogeneous transforms.
 
void c_dh_forward_kinematics_4 (const double *T1, int ldt1, const double *T2, int ldt2, const double *T3, int ldt3, const double *T4, double *T, int ldt)
 Multiply four homogeneous transforms.
 
void c_dh_forward_kinematics_5 (const double *T1, int ldt1, const double *T2, int ldt2, const double *T3, int ldt3, const double *T4, int ldt4, const double *T5, int ldt5, double *T, int ldt)
 Multiply five homogeneous transforms.
 
void c_dh_forward_kinematics_6 (const double *T1, int ldt1, const double *T2, int ldt2, const double *T3, int ldt3, const double *T4, int ldt4, const double *T5, int ldt5, const double *T6, int ldt6, double *T, int ldt)
 Multiply six homogeneous transforms.
 
void c_dh_forward_kinematics_7 (const double *T1, int ldt1, const double *T2, int ldt2, const double *T3, int ldt3, const double *T4, int ldt4, const double *T5, int ldt5, const double *T6, int ldt6, const double *T7, int ldt7, double *T, int ldt)
 Multiply seven homogeneous transforms.
 
void c_dh_forward_kinematics_8 (const double *T1, int ldt1, const double *T2, int ldt2, const double *T3, int ldt3, const double *T4, int ldt4, const double *T5, int ldt5, const double *T6, int ldt6, const double *T7, int ldt7, const double *T8, int ldt8, double *T, int ldt)
 Multiply eight homogeneous transforms.
 
void c_dh_jacobian (int n, const double *alpha, const double *a, const double *theta, const double *d, const int *jtypes, double *jac, int ldjac)
 Compute a Denavit-Hartenberg linkage Jacobian.
 
void c_dh_matrix (double alpha, double a, double theta, double d, double *T, int ldt)
 Build one Denavit-Hartenberg homogeneous transform.
 
void c_dh_rotate_x (double alpha, double *T, int ldt)
 Build the Denavit-Hartenberg x-axis rotation matrix.
 
void c_dh_rotate_z (double theta, double *T, int ldt)
 Build the Denavit-Hartenberg z-axis rotation matrix.
 
void c_dh_translate_x (double a, double *T, int ldt)
 Build the Denavit-Hartenberg x translation matrix.
 
void c_dh_translate_z (double d, double *T, int ldt)
 Build the Denavit-Hartenberg z translation matrix.
 
void c_jacobian_generating_vector (const double *d, const double *k, const double *R, int ldr, int jtype, double jvec[6])
 Generate one joint Jacobian column.
 
void c_solve_inverse_kinematics (int njoints, int neqn, const c_vecfcn mdl, const double *qo, const double *constraints, const double *qmax, const double *qmin, double *jvar, double *resid, c_iteration_behavior *ib, void *user_data)
 Solve a nonlinear inverse-kinematics problem.
 
void c_to_angle_axis (const double *r, int ldr, double *angle, double axis[3])
 Convert a rotation matrix to angle-axis form.
 

Detailed Description

Function Documentation

◆ c_matmul()

void c_matmul ( int  m,
int  n,
int  k,
double  alpha,
const double *  a,
int  lda,
const double *  b,
int  ldb,
double  beta,
double *  c,
int  ldc 
)

Multiply two column-major matrices: c = alpha*a*b + beta*c.

Parameters
mRows of a and c.
nColumns of b and c.
kInner dimension.
alphaScale factor for a*b.
aFirst matrix.
ldaLeading dimension of a.
bSecond matrix.
ldbLeading dimension of b.
betaScale factor for c.
cMatrix updated in place.
ldcLeading dimension of c.

◆ c_q_factor()

double c_q_factor ( double  zeta)

Compute the Q factor from a damping ratio.

Parameters
zetaDamping ratio.
Returns
Q factor.

◆ c_estimate_bandwidth()

double c_estimate_bandwidth ( double  fn,
double  zeta 
)

Estimate the half-power bandwidth.

Parameters
fnNatural frequency.
zetaDamping ratio.
Returns
Bandwidth.

◆ c_logarithmic_decrement()

double c_logarithmic_decrement ( double  x1,
double  x2,
int  n 
)

Compute logarithmic decrement from two peaks.

Parameters
x1First peak.
x2Second peak.
nPeak separation in cycles.
Returns
Logarithmic decrement.

◆ c_damping_from_log_decrement()

double c_damping_from_log_decrement ( double  delta)

Convert logarithmic decrement to damping ratio.

Parameters
deltaLogarithmic decrement.
Returns
Damping ratio.

◆ c_find_free_response_properties()

void c_find_free_response_properties ( int  n,
const double *  t,
const double *  x,
double  s,
int  np,
double *  delta,
double *  fn,
double *  x1,
double *  x2,
double *  t1,
double *  t2 
)

Extract damping and frequency properties from a free response.

Parameters
nSample count.
tSample times.
xResponse samples.
sSettling threshold.
npNumber of periods to use.
deltaOutput logarithmic decrement.
fnOutput natural frequency.
x1Output first peak.
x2Output second peak.
t1Output first peak time.
t2Output second peak time.

◆ c_rise_time()

double c_rise_time ( double  wn,
double  zeta 
)

Compute the 10-to-90 percent rise time.

Parameters
wnUndamped natural frequency.
zetaDamping ratio.
Returns
Rise time.

◆ c_find_settling_amplitude()

double c_find_settling_amplitude ( int  n,
const double *  x 
)

Find the settled response amplitude.

Parameters
nSample count.
xResponse samples.
Returns
Settling amplitude.

◆ c_damping_from_fractional_overshoot()

double c_damping_from_fractional_overshoot ( int  n,
const double *  x 
)

Estimate damping from fractional overshoot.

Parameters
nSample count.
xResponse samples.
Returns
Damping ratio.

◆ c_evaluate_step_response()

void c_evaluate_step_response ( int  n,
double  wn,
double  zeta,
double  xs,
const double *  t,
double *  x 
)

Evaluate a second-order step response.

Parameters
nSample count.
wnUndamped natural frequency.
zetaDamping ratio.
xsStep amplitude.
tSample times.
xOutput response samples.

◆ c_rotate_x()

void c_rotate_x ( double  angle,
double *  r,
int  ldr 
)

Build a rotation matrix about the x axis.

Parameters
angleRotation angle in radians.
rOutput 3-by-3 matrix.
ldrLeading dimension of r.

◆ c_rotate_y()

void c_rotate_y ( double  angle,
double *  r,
int  ldr 
)

Build a rotation matrix about the y axis.

Parameters
angleRotation angle in radians.
rOutput 3-by-3 matrix.
ldrLeading dimension of r.

◆ c_rotate_z()

void c_rotate_z ( double  angle,
double *  r,
int  ldr 
)

Build a rotation matrix about the z axis.

Parameters
angleRotation angle in radians.
rOutput 3-by-3 matrix.
ldrLeading dimension of r.

◆ c_rotate()

void c_rotate ( const double  i[3],
const double  j[3],
const double  k[3],
double *  r,
int  ldr 
)

Build a rotation matrix from three basis vectors.

Parameters
iFirst basis vector.
jSecond basis vector.
kThird basis vector.
rOutput matrix.
ldrLeading dimension of r.

◆ c_acceleration_transform()

void c_acceleration_transform ( const double  alpha[3],
const double  omega[3],
const double  a[3],
const double  x[3],
double *  r,
int  ldr 
)

Build an acceleration transformation matrix.

Parameters
alphaAngular acceleration.
omegaAngular velocity.
aLinear acceleration.
xPosition vector.
rOutput matrix.
ldrLeading dimension of r.

◆ c_velocity_transform()

void c_velocity_transform ( const double  omega[3],
const double  v[3],
const double  x[3],
double *  r,
int  ldr 
)

Build a velocity transformation matrix.

Parameters
omegaAngular velocity.
vLinear velocity.
xPosition vector.
rOutput matrix.
ldrLeading dimension of r.

◆ c_determine_local_stability()

void c_determine_local_stability ( int  n,
const double *  a,
int  lda,
double complex *  ev,
int *  flag 
)

Classify the eigenvalues of a linearized system for local stability.

Parameters
nMatrix order.
aSystem matrix.
ldaLeading dimension of a.
evOutput eigenvalues.
flagOutput stability classification.

◆ c_dh_forward_kinematics_table()

void c_dh_forward_kinematics_table ( const c_dh_table *  tbl,
double *  T,
int  ldt 
)

Compute forward kinematics from a Denavit-Hartenberg table.

Parameters
tblParameter table.
TOutput transform.
ldtLeading dimension of T.

◆ c_dh_forward_kinematics()

void c_dh_forward_kinematics ( int  n,
const double *  alpha,
const double *  a,
const double *  theta,
const double *  d,
double *  T,
int  ldt 
)

Compute serial Denavit-Hartenberg forward kinematics.

Parameters
nNumber of joints.
alphaLink twists.
aLink lengths.
thetaJoint angles.
dLink offsets.
TOutput transform.
ldtLeading dimension of T.

◆ c_dh_forward_kinematics_2()

void c_dh_forward_kinematics_2 ( const double *  T1,
int  ldt1,
const double *  T2,
int  ldt2,
double *  T,
int  ldt 
)

Multiply two homogeneous transforms.

Parameters
T1First transform.
ldt1Leading dimension of T1.
T2Second transform.
ldt2Leading dimension of T2.
TOutput transform.
ldtLeading dimension of T.

◆ c_dh_forward_kinematics_3()

void c_dh_forward_kinematics_3 ( const double *  T1,
int  ldt1,
const double *  T2,
int  ldt2,
const double *  T3,
int  ldt3,
double *  T,
int  ldt 
)

Multiply three homogeneous transforms.

Parameters
T1First transform.
ldt1Leading dimension of T1.
T2Second transform.
ldt2Leading dimension of T2.
T3Third transform.
ldt3Leading dimension of T3.
TOutput transform.
ldtLeading dimension of T.

◆ c_dh_forward_kinematics_4()

void c_dh_forward_kinematics_4 ( const double *  T1,
int  ldt1,
const double *  T2,
int  ldt2,
const double *  T3,
int  ldt3,
const double *  T4,
double *  T,
int  ldt 
)

Multiply four homogeneous transforms.

Arguments follow c_dh_forward_kinematics_3 and add T4/ldt4.

◆ c_dh_forward_kinematics_5()

void c_dh_forward_kinematics_5 ( const double *  T1,
int  ldt1,
const double *  T2,
int  ldt2,
const double *  T3,
int  ldt3,
const double *  T4,
int  ldt4,
const double *  T5,
int  ldt5,
double *  T,
int  ldt 
)

Multiply five homogeneous transforms.

Arguments follow c_dh_forward_kinematics_3 and add T4/ldt4 and T5/ldt5.

◆ c_dh_forward_kinematics_6()

void c_dh_forward_kinematics_6 ( const double *  T1,
int  ldt1,
const double *  T2,
int  ldt2,
const double *  T3,
int  ldt3,
const double *  T4,
int  ldt4,
const double *  T5,
int  ldt5,
const double *  T6,
int  ldt6,
double *  T,
int  ldt 
)

Multiply six homogeneous transforms.

Arguments follow c_dh_forward_kinematics_3 and add T4/ldt4, T5/ldt5, and T6/ldt6.

◆ c_dh_forward_kinematics_7()

void c_dh_forward_kinematics_7 ( const double *  T1,
int  ldt1,
const double *  T2,
int  ldt2,
const double *  T3,
int  ldt3,
const double *  T4,
int  ldt4,
const double *  T5,
int  ldt5,
const double *  T6,
int  ldt6,
const double *  T7,
int  ldt7,
double *  T,
int  ldt 
)

Multiply seven homogeneous transforms.

Arguments follow c_dh_forward_kinematics_3 and add T4/ldt4 through T7/ldt7.

◆ c_dh_forward_kinematics_8()

void c_dh_forward_kinematics_8 ( const double *  T1,
int  ldt1,
const double *  T2,
int  ldt2,
const double *  T3,
int  ldt3,
const double *  T4,
int  ldt4,
const double *  T5,
int  ldt5,
const double *  T6,
int  ldt6,
const double *  T7,
int  ldt7,
const double *  T8,
int  ldt8,
double *  T,
int  ldt 
)

Multiply eight homogeneous transforms.

Arguments follow c_dh_forward_kinematics_3 and add T4/ldt4 through T8/ldt8.

◆ c_dh_jacobian()

void c_dh_jacobian ( int  n,
const double *  alpha,
const double *  a,
const double *  theta,
const double *  d,
const int *  jtypes,
double *  jac,
int  ldjac 
)

Compute a Denavit-Hartenberg linkage Jacobian.

Parameters
nJoint count.
alphaLink twists.
aLink lengths.
thetaJoint angles.
dLink offsets.
jtypesJoint types.
jacOutput Jacobian.
ldjacLeading dimension of jac.

◆ c_dh_matrix()

void c_dh_matrix ( double  alpha,
double  a,
double  theta,
double  d,
double *  T,
int  ldt 
)

Build one Denavit-Hartenberg homogeneous transform.

Parameters
alphaLink twist.
aLink length.
thetaJoint angle.
dLink offset.
TOutput transform.
ldtLeading dimension of T.

◆ c_dh_rotate_x()

void c_dh_rotate_x ( double  alpha,
double *  T,
int  ldt 
)

Build the Denavit-Hartenberg x-axis rotation matrix.

Parameters
alphaRotation angle.
TOutput matrix.
ldtLeading dimension of T.

◆ c_dh_rotate_z()

void c_dh_rotate_z ( double  theta,
double *  T,
int  ldt 
)

Build the Denavit-Hartenberg z-axis rotation matrix.

Parameters
thetaRotation angle.
TOutput matrix.
ldtLeading dimension of T.

◆ c_dh_translate_x()

void c_dh_translate_x ( double  a,
double *  T,
int  ldt 
)

Build the Denavit-Hartenberg x translation matrix.

Parameters
aTranslation distance.
TOutput matrix.
ldtLeading dimension of T.

◆ c_dh_translate_z()

void c_dh_translate_z ( double  d,
double *  T,
int  ldt 
)

Build the Denavit-Hartenberg z translation matrix.

Parameters
dTranslation distance.
TOutput matrix.
ldtLeading dimension of T.

◆ c_jacobian_generating_vector()

void c_jacobian_generating_vector ( const double *  d,
const double *  k,
const double *  R,
int  ldr,
int  jtype,
double  jvec[6] 
)

Generate one joint Jacobian column.

Parameters
dJoint position vector.
kJoint axis.
RRotation matrix.
ldrLeading dimension of R.
jtypeJoint type.
jvecOutput six-vector.

◆ c_solve_inverse_kinematics()

void c_solve_inverse_kinematics ( int  njoints,
int  neqn,
const c_vecfcn  mdl,
const double *  qo,
const double *  constraints,
const double *  qmax,
const double *  qmin,
double *  jvar,
double *  resid,
c_iteration_behavior *  ib,
void *  user_data 
)

Solve a nonlinear inverse-kinematics problem.

Parameters
njointsNumber of joint variables.
neqnNumber of equations.
mdlResidual callback.
qoInitial joint variables.
constraintsConstraint values.
qmaxUpper bounds.
qminLower bounds.
jvarOutput joint variables.
residOutput residual.
ibOutput iteration statistics.
user_dataOpaque caller data forwarded to mdl.

◆ c_to_angle_axis()

void c_to_angle_axis ( const double *  r,
int  ldr,
double *  angle,
double  axis[3] 
)

Convert a rotation matrix to angle-axis form.

Parameters
rRotation matrix.
ldrLeading dimension of r.
angleOutput angle in radians.
axisOutput unit axis.