lowerleg_func.h File Reference

Declarations for functions necessary to read structures from config files. More...

#include "lowerleg_struct.h"
Include dependency graph for lowerleg_func.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int read_leg (char *filename, tibia &tib, femur &fem, vector< vector< double > > &frame_refs)
int read_tibia (FILE *fp, tibia &tib)
 Read tibia structure from file.
int read_femur (FILE *fp, femur &fem)
 Read femur structure from file.
int read_collar (FILE *fp, collar &col)
 Read collar structure from file.
int read_LINK (FILE *fp, LINK &lnk)
 Read LINK structure.
void set_LINK_id (tibia &tib)
 Set LINK properties based on label.
int read_sensor (FILE *fp, sensor &snsr)
 Read sensor data from file.
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.
int read_frame_refs (FILE *fp, vector< vector< double > > &frame_refs)
 Read MARIONET frame reference points expressed in MARIONET's reference frame.
int get_act_pos (tibia &tibmeasure, femur &femmeasure, vector< vector< double > > &data_v, int userQuit, unsigned int *act_tib, unsigned int *act_fem)
int get_act_pos_encaps (leg *legdata)
int write_act_pos_epi (FILE *fp, vector< vector< double > > datapoints)
int start_active_prol (tibia tibmeasure, femur femmeasure, unsigned int *act_tib, unsigned int *act_fem)
int write_active_headers (FILE *filep_act, tibia tib, femur fem, char *datestr, char *file)

Detailed Description

Declarations for functions necessary to read structures from config files.


Function Documentation

int conv_accl_id ( int  accl_id)

Convert accl id numbers to Device ID numbers.

This function converts the accelerometer id defined in the file to the actual accelerometer serial number printed on the acclerometer body

Referenced by write_accl_headers().

Here is the caller graph for this function:

int get_act_pos ( tibia tibmeasure,
femur femmeasure,
vector< vector< double > > &  data_v,
int  userQuit,
unsigned int *  act_tib,
unsigned int *  act_fem 
)
int get_act_pos_encaps ( leg legdata)
int read_collar ( FILE *  fp,
collar col 
)

Read collar structure from file.

This function is called inside the read_tibia function and contains functions that read the collar data in the file. This function gets called 2 times for each tibia structure.

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.

Referenced by read_femur(), and read_tibia().

Here is the caller graph for this function:

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.

Referenced by read_femur(), and read_tibia().

Here is the caller graph for this function:

int read_femur ( FILE *  fp,
femur fem 
)

Read femur structure from file.

This function reads the femur structure as defined in the input config file given by filename. The output returned is 0 if no errors, & 1 if file has errors.

To read the femur details, the config file MUST contain the femur details after the tibia details as, follows:

  • First word is "collar" followed by the number: 1.
  • Collar 1 definition (see Section col for specifics on collar definition). Femur has only 1 collar in use #ifndef DOXYGEN_SHOULD_SKIP_THIS
    • The words "collar 2" followed by collar 2 definition. #endif
  • The word "origin" followed by definition of origin as follows:
    • LINK label on which origin is located
    • The x,y,z co-ordinates of the location in the LINK frame
  • The word LINK followed by each LINK defintion. For specifics on LINK definition see documentation for read_LINK(FILE *fp, LINK *lnk).
  • The LINK definition section ends with the word "end_LINK".
  • Sensor definitions. The words "sensors" is written to indicate the beginning of sensor definitions, and ends with "end_sensors". See the documentation for the read_sensor(FILE *fp,sensor *snsr) for details.

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.

Referenced by read_leg().

Here is the call graph for this function:

Here is the caller graph for this function:

int read_frame_refs ( FILE *  fp,
vector< vector< double > > &  frame_refs 
)

Read MARIONET frame reference points expressed in MARIONET's reference frame.

Points are stored in the file in the order of: Ox, Oy, O, The last line of the config file is "end_refs"

Referenced by read_leg().

Here is the caller graph for this function:

int read_leg ( char *  filename,
tibia tib,
femur fem,
vector< vector< double > > &  frame_refs 
)

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

References read_femur(), read_frame_refs(), and read_tibia().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

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

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.

Referenced by read_femur(), and read_tibia().

Here is the caller graph for this function:

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.

Referenced by read_femur(), and read_tibia().

Here is the caller graph for this function:

int read_sensor ( FILE *  fp,
sensor snsr 
)

Read sensor data from file.

This function reads the sensor data from the file. It stores the sensor type, and accordingly reads the correct parameters corresponding to the sensor type.

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.

active wires must have number of pulleys

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.

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.

Referenced by read_femur(), and read_tibia().

Here is the caller graph for this function:

int read_tibia ( FILE *  fp,
tibia tib 
)

Read tibia structure from file.

This function reads the tibia structure as defined in the input config file given by filename. The output returned is 0 if no errors, & 1 if file has errors.

To read the tibia details, the config file MUST be as follows:

  • First word is "collar" followed by the number: 1.
  • Collar 1 definition (see Section col for specifics on collar definition.
  • The words "collar 2" followed by collar 2 definition.
  • The word "origin" followed by definition of origin as follows:
    • LINK label on which origin is located
    • The x,y,z co-ordinates of the location in the LINK frame
  • The word LINK followed by each LINK defintion. For specifics on LINK definition see documentation for read_LINK(FILE *fp, LINK *lnk).
  • The LINK definition section ends with the word "end_LINK".
  • Sensor definitions. The words "sensors" is written to indicate the beginning of sensor definitions, and ends with "end_sensors". See the documentation for the read_sensor(FILE *fp,sensor *snsr) for details.

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.

Referenced by read_leg().

Here is the call graph for this function:

Here is the caller 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.

Referenced by read_femur(), and read_tibia().

Here is the caller graph for this function:

int start_active_prol ( tibia  tibmeasure,
femur  femmeasure,
unsigned int *  act_tib,
unsigned int *  act_fem 
)
int write_act_pos_epi ( FILE *  fp,
vector< vector< double > >  datapoints 
)
int write_active_headers ( FILE *  filep_act,
tibia  tib,
femur  fem,
char *  datestr,
char *  file 
)
 All Data Structures Files Functions Variables Typedefs Defines