@@ -475,6 +475,9 @@ afSensorType ADFUtils::getSensorTypeFromString(const string &a_str)
475
475
else if (a_str.compare (" Resistance" ) == 0 || a_str.compare (" resistance" ) == 0 || a_str.compare (" RESISTANCE" ) == 0 ){
476
476
type = afSensorType::RESISTANCE;
477
477
}
478
+ else if (a_str.compare (" Contact" ) == 0 || a_str.compare (" contact" ) == 0 || a_str.compare (" CONTACT" ) == 0 ){
479
+ type = afSensorType::CONTACT;
480
+ }
478
481
479
482
return type;
480
483
}
@@ -1982,6 +1985,9 @@ bool ADFLoader_1_0::loadSensorAttribs(YAML::Node *a_node, afSensorAttributes *at
1982
1985
}
1983
1986
case afSensorType::RESISTANCE:{
1984
1987
return loadResistanceSensorAttribs (a_node, (afResistanceSensorAttributes*)attribs);
1988
+ }
1989
+ case afSensorType::CONTACT:{
1990
+ return loadContactSensorAttribs (a_node, (afContactSensorAttributes*)attribs);
1985
1991
}
1986
1992
break ;
1987
1993
default :{
@@ -2117,7 +2123,7 @@ bool ADFLoader_1_0::loadResistanceSensorAttribs(YAML::Node *a_node, afResistance
2117
2123
{
2118
2124
YAML::Node& node = *a_node;
2119
2125
if (node.IsNull ()){
2120
- cerr << " ERROR! ACTUATOR 'S YAML CONFIG DATA IS NULL\n " ;
2126
+ cerr << " ERROR! SENSOR 'S YAML CONFIG DATA IS NULL\n " ;
2121
2127
return 0 ;
2122
2128
}
2123
2129
ADFUtils::saveRawData (a_node, attribs);
@@ -2163,6 +2169,51 @@ bool ADFLoader_1_0::loadResistanceSensorAttribs(YAML::Node *a_node, afResistance
2163
2169
return result;
2164
2170
}
2165
2171
2172
+ bool ADFLoader_1_0::loadContactSensorAttribs (YAML::Node *a_node, afContactSensorAttributes *attribs)
2173
+ {
2174
+ YAML::Node& node = *a_node;
2175
+ if (node.IsNull ()){
2176
+ cerr << " ERROR! SENSOR'S YAML CONFIG DATA IS NULL\n " ;
2177
+ return 0 ;
2178
+ }
2179
+ ADFUtils::saveRawData (a_node, attribs);
2180
+
2181
+ bool result = true ;
2182
+
2183
+ YAML::Node nameNode = node[" name" ];
2184
+ YAML::Node namespaceNode = node[" namespace" ];
2185
+ YAML::Node parentNameNode = node[" parent" ];
2186
+ YAML::Node visibleNode = node[" visible" ];
2187
+ YAML::Node visibleSizeNode = node[" visible size" ];
2188
+ YAML::Node publishFrequencyNode = node[" publish frequency" ];
2189
+ YAML::Node distanceThresholdNode = node[" distance threshold" ];
2190
+ YAML::Node processContactDetailsNode = node[" process contact details" ];
2191
+
2192
+ ADFUtils::getIdentificationAttribsFromNode (a_node, &attribs->m_identificationAttribs );
2193
+ ADFUtils::getHierarchyAttribsFromNode (a_node, &attribs->m_hierarchyAttribs );
2194
+ ADFUtils::getCommunicationAttribsFromNode (a_node, &attribs->m_communicationAttribs );
2195
+ ADFUtils::getPluginAttribsFromNode (a_node, &attribs->m_pluginAttribs );
2196
+
2197
+
2198
+ if (visibleNode.IsDefined ()){
2199
+ attribs->m_visible = visibleNode.as <bool >();
2200
+ }
2201
+
2202
+ if (visibleSizeNode.IsDefined ()){
2203
+ attribs->m_visibleSize = visibleSizeNode.as <double >();
2204
+ }
2205
+
2206
+ if (distanceThresholdNode.IsDefined ()){
2207
+ attribs->m_distanceThreshold = distanceThresholdNode.as <double >();
2208
+ }
2209
+
2210
+ if (processContactDetailsNode.IsDefined ()){
2211
+ attribs->m_processContactDetails = processContactDetailsNode.as <bool >();
2212
+ }
2213
+
2214
+ return result;
2215
+ }
2216
+
2166
2217
bool ADFLoader_1_0::loadActuatorAttribs (YAML::Node *a_node, afActuatorAttributes *attribs)
2167
2218
{
2168
2219
YAML::Node& node = *a_node;
@@ -2729,6 +2780,10 @@ bool ADFLoader_1_0::loadModelAttribs(YAML::Node *a_node, afModelAttributes *attr
2729
2780
senAttribs = new afResistanceSensorAttributes ();
2730
2781
break ;
2731
2782
}
2783
+ case afSensorType::CONTACT:{
2784
+ senAttribs = new afContactSensorAttributes ();
2785
+ break ;
2786
+ }
2732
2787
default :
2733
2788
break ;
2734
2789
}
0 commit comments