57   if (!node.IsDefined())
 
   83   return urdf_config_->getRobotName() + 
".ros2_control.xacro";
 
   93   std::vector<std::pair<std::string, std::string>> arguments;
 
   94   arguments.push_back(std::make_pair(
"initial_positions_file", 
"initial_positions.yaml"));
 
  100   std::string command = 
"<xacro:";
 
  102   command += 
"_ros2_control name=\"FakeSystem\" initial_positions_file=\"$(arg initial_positions_file)\"/>";
 
  107                        std::vector<std::string>& interface_names)
 
  109   for (
const tinyxml2::XMLElement* el = joint_el->FirstChildElement(element_name.c_str()); el != 
nullptr;
 
  110        el = el->NextSiblingElement())
 
  112     interface_names.push_back(el->Attribute(
"name"));
 
  124   for (
const std::string& group_name : srdf_config->getGroupNames())
 
  126     for (
const std::string& joint_name : srdf_config->getJointNames(group_name, 
true, 
false))  
 
  137   tinyxml2::XMLDocument urdf_xml;
 
  138   using tinyxml2::XMLElement;
 
  141   urdf_xml.Parse(urdf_config->getURDFContents().c_str());
 
  142   for (XMLElement* control_el = urdf_xml.FirstChildElement(
"ros2_control"); control_el != 
nullptr;
 
  143        control_el = control_el->NextSiblingElement())
 
  145     for (XMLElement* joint_el = control_el->FirstChildElement(
"joint"); joint_el != 
nullptr;
 
  146          joint_el = joint_el->NextSiblingElement())
 
  148       std::string joint_name = joint_el->Attribute(
"name");
 
  178     std::vector<double> joint_value;
 
  181     joint_value.push_back(0.0);
 
  188 void uniqueMerge(std::vector<std::string>& 
main, 
const std::vector<std::string>& addition)
 
  190   for (
const std::string& s : addition)
 
  192     if (std::find(
main.begin(), 
main.end(), s) == 
main.end())
 
  202   const auto& it = interfaces.find(joint_name);
 
  203   if (it == interfaces.end())
 
  225   for (
const std::string& joint_name : joint_names)
 
  234   std::string joints = 
"";
 
  235   const std::string tab = 
"            ";
 
  248     joints += 
"<joint name=\"" + joint_name + 
"\">\n";
 
  252       joints += 
"    <command_interface name=\"";
 
  253       joints += command_interface;
 
  259       joints += 
"    <state_interface name=\"";
 
  260       joints += state_interface;
 
  261       if (state_interface == 
"position")
 
  265         joints += 
"      <param name=\"initial_value\">${initial_positions['";
 
  266         joints += joint_name;
 
  267         joints += 
"']}</param>\n";
 
  269         joints += 
"    </state_interface>\n";
 
  277     joints += 
"</joint>\n";
 
  283   emitter << YAML::Comment(
"Default initial positions for " + 
parent_.
urdf_config_->getRobotName() +
 
  284                            "'s ros2_control fake system");
 
  285   emitter << YAML::Newline;
 
  286   emitter << YAML::BeginMap;
 
  288     emitter << YAML::Key << 
"initial_positions";
 
  289     emitter << YAML::Value;
 
  290     emitter << YAML::BeginMap;
 
  293       emitter << YAML::Key << pair.first;
 
  295       const std::vector<double>& jv = pair.second;
 
  297       emitter << YAML::Value;
 
  307     emitter << YAML::EndMap;
 
  309   emitter << YAML::EndMap;
 
  322 #include <pluginlib/class_list_macros.hpp>   
PLUGINLIB_EXPORT_CLASS(cached_ik_kinematics_plugin::CachedIKKinematicsPlugin< kdl_kinematics_plugin::KDLKinematicsPlugin >, kinematics::KinematicsBase)
 
std::shared_ptr< URDFConfig > urdf_config_
 
void onInit() override
Overridable initialization method.
 
where all the data for each part of the configuration is stored.
 
std::shared_ptr< DataWarehouse > config_data_
 
ControlXacroConfig & parent_
 
bool writeYaml(YAML::Emitter &emitter) override
 
std::unordered_map< std::string, ControlInterfaces > original_joint_interfaces_
A list of all joints used by the current SRDF groups.
 
bool hasAllControlTagsInOriginal() const
 
ControlInterfaces default_ci_
 
void loadPrevious(const std::filesystem::path &, const YAML::Node &node) override
Loads the configuration from an existing MoveIt configuration.
 
std::string getJointsXML() const
Return the additional joint xml needed for ros2_control tags.
 
YAML::Node saveToYaml() const override
Optionally save "meta" information for saving in the .setup_assistant yaml file.
 
void onInit() override
Overridable initialization method.
 
std::unordered_map< std::string, ControlInterfaces > new_joint_interfaces_
 
std::string getFilepath() const override
The file path to use in the <xacro:include> tag.
 
std::vector< std::string > joint_names_
 
bool hasChanges() const override
Returns if the xacro and its properties have changed, resulting in the whole urdf needing regeneratio...
 
std::vector< std::pair< std::string, std::string > > getArguments() const override
Returns a list of name/value pairs for arguments that the modified urdf should have.
 
std::vector< std::string > getCommands() const override
Return a list of additional commands that need to be inserted after the xacro is included.
 
const ControlInterfaces getControlInterfaces(const std::vector< std::string > &joint_names) const
Get all the control interfaces for all of the specified joint names.
 
srdf::Model::GroupState initial_group_state_
 
void loadFromDescription()
Load the original command interfaces from the original (unmodified) URDF.
 
void setControlInterfaces(const ControlInterfaces &ci)
Use the specified controller interfaces for all the lacking joints.
 
bool isConfigured() const override
Return true if this part of the configuration is completely set up.
 
ControlInterfaces available_ci_
 
void collectVariables(std::vector< TemplateVariable > &variables) override
Collect key/value pairs for use in templates.
 
bool getControlInterfaceHelper(const std::unordered_map< std::string, ControlInterfaces > &interfaces, const std::string &joint_name, ControlInterfaces &ci)
 
void uniqueMerge(std::vector< std::string > &main, const std::vector< std::string > &addition)
 
std::vector< std::string > getAvailableInterfaceNames()
 
void getInterfaceNames(const tinyxml2::XMLElement *joint_el, const std::string &element_name, std::vector< std::string > &interface_names)
 
bool getYamlProperty(const YAML::Node &node, const std::string &key, T &storage, const T &default_value=T())
 
Simple Key/value pair for templates.
 
std::vector< std::string > state_interfaces
 
std::vector< std::string > command_interfaces
 
int main(int argc, char **argv)