lowerleg_func_old.cpp File Reference
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include "lowerleg_func.h"
Include dependency graph for lowerleg_func_old.cpp:

Functions

int read_tibia (char *filename, tibia &tib1)
void set_LINK_id (tibia &tib)
 Set LINK properties based on label.
int read_LINK (FILE *fp, LINK &lnk)
 Read LINK structure.
int read_collar (FILE *fp, collar &col)
 Read collar structure from file.
int read_sensor (FILE *fp, sensor &snsr)
 Read Sensor information.
int read_optional (FILE *fp, collar_info &col_info)
 Function to read optional collar info.
int read_external (FILE *fp, external_info &extrn_data)
 Function to read external info.
int conv_accl_id (int accl_id)
 Convert accl id numbers to Device ID numbers.

Detailed Description


Function Documentation

int conv_accl_id ( int  accl_id)

Convert accl id numbers to Device ID numbers.

int read_collar ( FILE *  fp,
collar col 
)

Read collar structure from file.

The collar definition is provided as follows in the file:

  • After the word "collar" & collar number (1 or 2), a list of LINK labels that define the collar are provided. This list is space separated. The list ends with the word "end".
  • The word "left" is written to indicate succession of LINKs in the collar in left direction. After the word, the list of LINK labels is given and the list must end with the word "end"
  • The word "right" is written to indicate succession of LINKs in the collar in right direction. After the word, the list of LINK labels is given and the list must end with the word "end"
Returns:
0 if no error, 1 if error in collar definition in file

References collar::LINK_labels, collar::nb_LINKs, NB_LINKS_MAX, collar::shape_left, and collar::shape_right.

int read_external ( FILE *  fp,
external_info extrn_data 
)

Function to read external info.

This function reads the data written between the words "external" and "end_external". If calibrated distance is stored in the file, the flag known_dist is set to 1. If the data is about the free unkown sensors, then the flag free_param_state is set to 1 by the funtion. The data to be read must be stored in the order as mentioned in the Section Optional.

References external_info::body_point, external_info::f_plate_type, external_info::ref_point, external_info::sensor_id, external_info::sensor_param_count, external_info::sensor_parameters, and external_info::sensor_type.

int read_LINK ( FILE *  fp,
LINK lnk 
)

Read LINK structure.

Read LINK label

Read co-ordinates of the reference screw points.

Read left hinge axis

Read right hinge axis

Check if this is end of LINK definition.

If not, then read 1st optional angle data

Set angle_data flag to 1 if angles are defined

Check for end & if not, read 2nd angle data. Set flag to 2

If last word is not "end" return error. Else return 0

References LINK::angle_1, LINK::angle_1_LINK, LINK::angle_2, LINK::angle_2_LINK, LINK::angle_data, LINK::label, LINK::left_axis, LINK::P1, LINK::P2, LINK::P3, LINK::P4, and LINK::right_axis.

int read_optional ( FILE *  fp,
collar_info col_info 
)

Function to read optional collar info.

This function reads the data written between the words "optional" and "end_optional". If calibrated distance is stored in the file, the flag known_dist is set to 1. If the data is about the free unkown sensors, then the flag free_param_state is set to 1 by the funtion. The data to be read must be stored in the order as mentioned in the Section Optional.

References collar_info::collar_ids, collar_info::dist, collar_info::dist_intvl, collar_info::free_param, collar_info::free_param_count, collar_info::free_param_state, collar_info::known_dist, collar_info::LINK_labels, collar_info::P1, collar_info::P2, and collar_info::sensor_id.

int read_sensor ( FILE *  fp,
sensor snsr 
)

Read Sensor information.

Read sensor data from file.

This function reads the sensor information from the file. The sensor type is assumed to have been already read into the sensor structure.

The first word is sensor label_id.

Next is the link label on which the sensor is attached

Next is co-ordinates of the point where sensor is attached

Depending on the type of sensor, the next information varies, hence we use if-else conditional statements to check for all and read accordingly.

passive/active wire must have stiffness details

Accelerometer must have rotation matrix details.

Optical marker needs only point label information

-Force sensors needs information about axis normal to plane of sensor (in link frame)

Free sensor may have rotation matrix details.

Free sensor may also have additional parameter details.

References sensor::free_param, sensor::label_id, sensor::LINK_label, sensor::nb_pulley, sensor::normal_axis, sensor::point_label, sensor::rot_matrix, sensor::sensor_type, sensor::stiffness, sensor::xa, sensor::ya, and sensor::za.

int read_tibia ( char *  filename,
tibia tib1 
)

Returns:
0 if no error; 1 if error in collar definitions in file; 2 if error in LINK definitions in file; 3 if error in origin definition in file; 10 if file pointer fp is NULL

Read the collar definitions

Get total number of LINKs in collar 1 AND collar 2

Read origin definition

Read collar definitions and assign location numbers to LINKs

Start reading LINKs, there must be TOTAL_LINKS number of LINK definitions.

Read sensor data

First up to NB_PASS_WIRES_MAX number of passive wires

Next, up to NB_ACT_WIRES_MAX number of active wires

Next, up to NB_ACCL_MAX number of accelerometers

Next up to NB_OPTI_MARKER_MAX number of optical markers.

Next up to NB_FORCE_SENS_MAX number of optical markers.

Finally up to NB_FREE_SENSORS_MAX number of optical markers.

If present, start reading optional data

References tibia::accelerometers, tibia::accl_count, tibia::act_wire_count, tibia::active_wires, tibia::C, tibia::col, tibia::col_LINKs, tibia::extern_data_count, tibia::extrn_data, tibia::force_count, tibia::force_sensors, tibia::free_count, tibia::free_sensors, LINK::label, collar::LINK_labels, origin::lnk, NB_ACCL_MAX, NB_ACT_WIRES_MAX, NB_EXTERN_INFO_MAX, NB_FORCE_SENS_MAX, NB_FREE_SENSORS_MAX, collar::nb_LINKs, NB_OPT_DATA_MAX, NB_OPTI_MARKER_MAX, NB_PASS_WIRES_MAX, tibia::opt_col_count, tibia::opt_col_data, tibia::opti_count, tibia::optical, tibia::pass_wire_count, tibia::passive_wires, read_collar(), read_external(), read_LINK(), read_optional(), read_sensor(), sensor::sensor_type, set_LINK_id(), origin::xa, and origin::ya.

Here is the call graph for this function:

void set_LINK_id ( tibia tib)

Set LINK properties based on label.

This function reads the LINK label and writes the position details for the LINK, for each LINK in the tibia.

The collar on which it is located, the location on collar (as ordered in the collar definition)

References tibia::col, tibia::col_LINKs, collar::LINK_labels, LINK::location, collar::nb_LINKs, NB_LINKS_MAX, collar::shape_left, and collar::shape_right.

 All Data Structures Files Functions Variables Typedefs Defines