MTSOS: writing dynamics functions
In order to compile MTSOS the user must provide a function for calculating the dynamics given a point in configuration space .
Although it is possible to write the dynamics in MATLAB, doing so will incur a significant performance penalty, so users are encouraged to write their dynamics functions directly in C.
For details about the form the dynamics take, users should see Minimum-Time Speed Optimization Over a Fixed Path.
MATLAB
If the user must write the function in MATLAB, change the compiler to point to dynamics_matlab.c instead of dynamics_front.c.
This will cause the algorithm to look to dynamics_mat.m for the dynamics.
The name of this file can be changed in dynamics_matlab.c.
[R M C d] = dynamics_mat(S,S_prime,variables)
Inputs
Outputs
R | a length vector consisting of the , , matrices evaluated at the configurations in S in column first order and concatenated |
M | a length vector consisting of the , , matrices evaluated at the configurations in S in column first order and concatenated |
C | a length vector consisting of the , , matrices evaluated at the configurations in S in column first order and concatenated (recall that , where for and is the ith element of the vector ) C should be evaluated using S as and S_prime in place of ![dot{q}](eqs/3014381538757108489-130.png) |
d | a length vector consisting of the , matrices evaluated at the configurations in S and concatenated
|
C
- int so_dynamics(const double* S_middle, const double* S_prime, int S_length, int State_size,
int U_size, const double* variables, int variables_length, double* R_dynamics,
double* M_dynamics, double* C_dynamics, double* d_dynamics)
Inputs
Note: these are all constant.
Outputs
Allocated, but unitialized, arrays are provided for the user to populate.
In particular, if an array needs to be zero, the values must be set to zero, do not assume any values in the arrays.
|