I/O
[Motion Package]
Collaboration diagram for I/O:
|
Detailed Description
CLARAty File I/O Package The CLARAty File I/O Package, as part of the Motion Package implements file I/O for Mechanism_Model objects.
Mechanism_Model mech_model; Mechanism_Model_IO sample_model("sample1.xml", mech_model); sample_model.load("sample2.xml", mech_model); sample_model.save("sampleCopy.xml", mech_model);
Enumeration Type Documentation
enum claraty::Mechanism_Model_IO::ATTRIBUTE [inherited] |
Definition at line 92 of file mechanism_model_io.h.
00093 { NAME = 0, 00094 VERSION, 00095 ZERO_POSITION};
enum claraty::Mechanism_Model_IO::MODEL_FILE_TYPE [inherited] |
Definition at line 97 of file mechanism_model_io.h.
00098 { ME_BODY_DATA, 00099 DH_CRAIG_DATA, 00100 DH_PAUL_DATA, 00101 UNSPECIFIED};
Function Documentation
| static bool claraty::Mechanism_Model_IO::_add_DH_parameter_model_data | ( | Mechanism_Model & | mm, | |
| std::string | attach_to_node, | |||
| Transform & | offset | |||
| ) | [static, private, inherited] |
| static void claraty::Mechanism_Model_IO::_add_ME_Body_model_data | ( | Mechanism_Model & | mm, | |
| std::string | attach_to_node, | |||
| Transform & | offset | |||
| ) | [static, private, inherited] |
| bool claraty::Mechanism_Model_IO::_are_attributes_compatible | ( | Mechanism_Model & | mm | ) | [static, private, inherited] |
Compare the version in the current XML file data to the version in the mech_model object. Return false if the mech_model version is incompatible with the current file.
- Returns:
- TRUE is successful, FALSE if not
Definition at line 99 of file mechanism_model_io.cc.
References claraty::Mechanism_Model_IO::MECHANISM_MODEL_ATTRIBUTES.
00101 { 00102 00103 //string mechanism_model_tag("Mechanism_Model"); 00104 string attribute_values[MECHANISM_MODEL_ATTRIBUTES]; 00105 string attribute_names [MECHANISM_MODEL_ATTRIBUTES]; 00106 /* 00107 if (!_p_parser->has_tag_name(mechanism_model_tag)) 00108 return false; // Not a Mechanism_Model file 00109 00110 // Get the Mechanism_Model node 00111 pug::xml_node mech_model_elem = 00112 _p_parser->document().first_element_by_name("Mechanism_Model"); 00113 // Get the Mechanism_Model attributes 00114 00115 attribute_names[NAME] = "name"; 00116 attribute_names[VERSION] = "version"; 00117 attribute_values[NAME] = ""; 00118 attribute_values[VERSION] = ""; 00119 attribute_values[ZERO_POSITION] = "false"; 00120 00121 if (!mech_model_elem.empty()) { 00122 _p_parser->attribute_values_by_name(attribute_names, 00123 mech_model_elem, 00124 MECHANISM_MODEL_ATTRIBUTES, 00125 attribute_values); 00126 if ((mm.get_version() != "") 00127 && (attribute_values[1] != mm.get_version())) 00128 return false; 00129 else { 00130 mm.set_name(attribute_values[NAME]); 00131 mm.set_version(attribute_values[VERSION]); 00132 return string_eat_bool(attribute_values[ZERO_POSITION], _zero_position); 00133 } 00134 00135 } 00136 else 00137 return false; 00138 */ 00139 return true; 00140 }
| static void claraty::Mechanism_Model_IO::_attach_body_to_tree | ( | ME_Body * | p_me_body, | |
| Tree< ME_Body > & | temp_body_tree, | |||
| std::string | parent_name | |||
| ) | [static, private, inherited] |
| bool claraty::Mechanism_Model_IO::_extract_model_type | ( | pug::xml_node | dh_param_elem | ) | [static, private, inherited] |
Set the DH model type: Craig or Paul
- Parameters:
-
[in] dh_param_elem pug xml node in parser containing DH data
- Returns:
- If inconsistant return false, other returns true.
Definition at line 480 of file mechanism_model_io.cc.
References claraty::Mechanism_Model_IO::_model_file_type, claraty::Mechanism_Model_IO::_p_parser, claraty::Mechanism_Model_IO::DH_CRAIG_DATA, claraty::Mechanism_Model_IO::DH_PAUL_DATA, claraty::Parameter_Parser::has_attribute_match(), and claraty::Mechanism_Model_IO::UNSPECIFIED.
00481 { 00482 if (_p_parser->has_attribute_match(dh_param_elem, "type", "DH_Craig")) 00483 { 00484 // Using Craig's DH model format 00485 // Check for inconsistant model formats in DH_Block 00486 if ((_model_file_type != Mechanism_Model_IO::DH_CRAIG_DATA) 00487 && (_model_file_type != Mechanism_Model_IO::UNSPECIFIED)) 00488 { 00489 return false; 00490 } 00491 _model_file_type = Mechanism_Model_IO::DH_CRAIG_DATA; 00492 } 00493 else // Using Paul's DH model format 00494 { 00495 // Check for inconsistant model formats in DH_Block 00496 if ((_model_file_type != Mechanism_Model_IO::DH_PAUL_DATA) 00497 && (_model_file_type != Mechanism_Model_IO::UNSPECIFIED)) 00498 { 00499 return false; 00500 } 00501 _model_file_type = Mechanism_Model_IO::DH_PAUL_DATA; 00502 } 00503 return true; 00504 }
Here is the call graph for this function:

| static void claraty::Mechanism_Model_IO::_extract_parse_tree_data | ( | Mechanism_Model & | mm, | |
| std::string | nodename, | |||
| Transform & | offset | |||
| ) | [static, private, inherited] |
| static void claraty::Mechanism_Model_IO::_insert_tree_in_mechanism_model | ( | Mechanism_Model & | mm, | |
| std::string | nodename, | |||
| Tree< ME_Body > & | temp_body_tree | |||
| ) | [static, private, inherited] |
| static bool claraty::Mechanism_Model_IO::load | ( | std::string | filename, | |
| Mechanism_Model & | mm, | |||
| std::string | mount_node = "", |
|||
| Transform | mount_offset = Transform::identity | |||
| ) | [static, inherited] |
Referenced by claraty::N_2DOF_Planar_Arm::N_2DOF_Planar_Arm().
Variable Documentation
Mechanism_Model_IO::MODEL_FILE_TYPE claraty::Mechanism_Model_IO::_model_file_type [static, private, inherited] |
Type of model file: ME_BODY_DATA, DH_CRAIG_DATA or DH_PAUL_DATA
Definition at line 137 of file mechanism_model_io.h.
Referenced by claraty::Mechanism_Model_IO::_extract_model_type().
Parameter_Parser * claraty::Mechanism_Model_IO::_p_parser [static, private, inherited] |
Pointer to the parser currently being read
Definition at line 134 of file mechanism_model_io.h.
Referenced by claraty::Transform_IO::_extract_DH_params_attributes(), claraty::Mechanism_Model_IO::_extract_model_type(), claraty::Transform_IO::_extract_position_attributes(), claraty::Transform_IO::_extract_quaternion_attributes(), claraty::Transform_IO::_extract_rot_x_attributes(), claraty::Transform_IO::_extract_rot_y_attributes(), claraty::Transform_IO::_extract_rot_z_attributes(), claraty::Transform_IO::_extract_three_angle_set_attributes(), claraty::ME_Joint_IO::_joint_constraint_attributes(), claraty::ME_Joint_IO::_joint_limits_attributes(), claraty::ME_Joint_IO::_joint_stiffness_attributes(), claraty::Mass_Properties_IO::_set_inertia_attributes(), claraty::ME_Joint_IO::extract_from_parse_tree(), claraty::ME_Body_IO::extract_from_parse_tree(), claraty::Display_Graphics_IO::extract_from_parse_tree(), claraty::Bounding_Shape_IO::extract_from_parse_tree(), claraty::N_3D_Object_IO::extract_from_parse_tree(), claraty::Mass_Properties_IO::extract_from_parse_tree(), and claraty::Frame_IO::extract_from_parse_tree().
bool claraty::Mechanism_Model_IO::_zero_position [static, private, inherited] |
Definition at line 140 of file mechanism_model_io.h.
Referenced by claraty::Frame_IO::convert_to_internal_format(), and claraty::ME_Body_IO::extract_from_parse_tree().
const int claraty::Mechanism_Model_IO::MECHANISM_MODEL_ATTRIBUTES = 3 [static, inherited] |
Definition at line 90 of file mechanism_model_io.h.
Referenced by claraty::Mechanism_Model_IO::_are_attributes_compatible().