@@ -639,7 +639,6 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
639
639
const auto element_name = element->Name ();
640
640
const auto element_ID = element->Attribute (" ID" );
641
641
642
- // TODO: Pull out this node type logic
643
642
auto node_type = convertFromString<NodeType>(element_name);
644
643
// name used by the factory
645
644
std::string type_ID;
@@ -684,8 +683,6 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
684
683
685
684
PortsRemapping port_remap;
686
685
NonPortAttributes other_attributes;
687
- // Only relevant for subtrees
688
- bool do_autoremap = false ;
689
686
690
687
// Parse ports and validate them where we can.
691
688
for (const XMLAttribute* att = element->FirstAttribute (); att; att = att->Next ())
@@ -733,16 +730,22 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
733
730
734
731
port_remap[port_name] = port_value;
735
732
}
736
- else if (node_type == NodeType::SUBTREE && port_name == " _autoremap" )
737
- {
738
- do_autoremap = convertFromString<bool >(port_value);
739
- }
740
733
else if (!IsReservedAttribute (port_name))
741
734
{
742
735
other_attributes[port_name] = port_value;
743
736
}
744
737
}
745
738
739
+ bool do_autoremap = false ;
740
+ if (node_type == NodeType::SUBTREE)
741
+ {
742
+ const XMLAttribute* auto_remap_ptr = element->FindAttribute (" _autoremap" );
743
+ if (auto_remap_ptr != nullptr )
744
+ {
745
+ do_autoremap = convertFromString<bool >(auto_remap_ptr->Value ());
746
+ }
747
+ }
748
+
746
749
NodeConfig config;
747
750
config.blackboard = blackboard;
748
751
config.path = prefix_path + instance_name;
@@ -778,7 +781,6 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
778
781
// ---------------------------------------------
779
782
TreeNode::Ptr new_node;
780
783
781
- // TODO: in order to set the config at this point, we need the subtree model, which is parsed after this function call in recursivelyCreateSubtree
782
784
if (node_type == NodeType::SUBTREE)
783
785
{
784
786
// check if this subtree has a model. If it does,
@@ -812,7 +814,7 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
812
814
// populate the node config
813
815
for (const auto & [port_name, port_value] : port_remap)
814
816
{
815
- PortDirection direction = PortDirection::INPUT;
817
+ auto direction = PortDirection::INPUT;
816
818
if (subtree_model_it != subtree_models.end ())
817
819
{
818
820
const PortsList& subtree_model_ports = subtree_model_it->second .ports ;
@@ -1013,7 +1015,7 @@ void BT::XMLParser::PImpl::recursivelyCreateSubtree(const std::string& tree_ID,
1013
1015
1014
1016
// Populate the subtree's blackboard with it's port values.
1015
1017
PortsRemapping subtree_remapping = const_node->config ().input_ports ;
1016
- const PortsRemapping output_ports = const_node->config ().output_ports ;
1018
+ const PortsRemapping& output_ports = const_node->config ().output_ports ;
1017
1019
subtree_remapping.insert (output_ports.begin (), output_ports.end ());
1018
1020
for (const auto & [port_name, port_value] : subtree_remapping)
1019
1021
{
0 commit comments