initXml(TiXmlElement *elt) can call initXml(TiXmlElement *elt, pr2_mechanism_model::Robot *robot) with NULL as the second argument. Then only the if statement and a->command_.enable_ = true; need a little modifying and a lot of code duplication would be avoided