mbs_sensor.c
Go to the documentation of this file.
1//---------------------------
2// UCL-CEREM-MBS
3//
4// @version MBsysLab_s 1.7.a
5//
6// Creation : 2009
7// Last update : 18/02/2009
8//---------------------------
9//
10
11#include<stdlib.h>
12#include "mbs_sensor2.h"
13
14void allocate_sensor(MbsSensor* psens, int njoint)
15{
16 int j;
17
18 for (j = 1; j <= 6; j++)
19 {
20 psens->J[j] = (double*) calloc(njoint + 1, sizeof(double));
21 psens->J[j][0] = njoint;
22 }
23}
24
25void init_sensor(MbsSensor* psens, int njoint)
26{
27 int i, j;
28
29 for (i = 1; i <= 3; i++)
30 {
31 psens->P[i] = 0.0;
32 psens->V[i] = 0.0;
33 psens->A[i] = 0.0;
34 psens->OM[i] = 0.0;
35 psens->OMP[i] = 0.0;
36 for (j = 1; j <= 3; j++)
37 {
38 psens->R[i][j] = 0.0;
39 }
40 }
41 for (i = 1; i <= 6; i++)
42 for (j = 1; j <= njoint; j++)
43 {
44 psens->J[i][j] = 0.0;
45 }
46
47}
48
50{
51 int j;
52
53 for (j = 1; j <= 6; j++)
54 {
55 free(psens->J[j]);
56 }
57}
void free_sensor(MbsSensor *psens)
Free the memory of MbsSensor structure.
Definition mbs_sensor.c:49
void allocate_sensor(MbsSensor *psens, int njoint)
Allocate the Jacobian matrix of the MbsSensor according to the number of joints in the multibody syst...
Definition mbs_sensor.c:14
void init_sensor(MbsSensor *psens, int njoint)
Initialize all fields of MbsSensor structure to 0.
Definition mbs_sensor.c:25
double OM[4]
Angular velocity vector of the sensor expressed in the inertial frame: .
Definition mbs_sensor2.h:28
double V[4]
Velocity vector of the sensor expressed in the inertial frame: .
Definition mbs_sensor2.h:26
double OMP[4]
Angular acceleration vector of the sensor expressed in the inertial frame: .
Definition mbs_sensor2.h:32
double P[4]
Position vector of the sensor expressed in the inertial frame: .
Definition mbs_sensor2.h:21
double A[4]
Acceleration vector of the sensor expressed in the inertial frame: .
Definition mbs_sensor2.h:30
double * J[7]
Jacobian matrix of the sensor: .
Definition mbs_sensor2.h:37
double R[4][4]
Rotation matrix from the inertial frame to the sensor frame: .
Definition mbs_sensor2.h:24