File with functions for reading tibia and femur from config file. More...
Functions | |
int | read_leg (char *filename, tibia &tib, femur &fem, vector< vector< double > > &frame_refs) |
int | read_tibia (FILE *fp1, tibia &tib1) |
Read tibia structure from file. | |
int | read_femur (FILE *fp1, femur &tib1) |
Read femur structure from file. | |
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. | |
int | read_frame_refs (FILE *fp, vector< vector< double > > &frame_refs) |
Read MARIONET frame reference points expressed in MARIONET's reference frame. |
File with functions for reading tibia and femur from config file.
int conv_accl_id | ( | int | accl_id | ) |
Convert accl id numbers to Device ID numbers.
Referenced by write_accl_headers().
int read_collar | ( | FILE * | fp, |
collar & | col | ||
) |
Read collar structure from file.
The collar definition is provided as follows in the file:
Referenced by read_femur(), and read_tibia().
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.
Referenced by read_femur(), and read_tibia().
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:
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().
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().
References read_femur(), read_frame_refs(), and read_tibia().
Referenced by main().
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
Referenced by read_femur(), and read_tibia().
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.
Referenced by read_femur(), and read_tibia().
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.
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.
Referenced by read_femur(), and read_tibia().
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:
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().
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)
Referenced by read_femur(), and read_tibia().