40 const std::unordered_map<std::string, std::string>
43 const std::regex
MAIL_REGEX(
"\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,63}\\b", std::regex::icase);
49 unsigned long int timestamp_i;
75 if (package_path_or_name.empty())
77 throw std::runtime_error(
"Please specify a configuration package path to load.");
80 if (std::filesystem::is_directory(package_path_or_name))
99 if (!std::filesystem::is_directory(share_dir))
101 throw std::runtime_error(
"The specified path is not a directory or is not accessible.");
108 std::filesystem::path relative_path;
112 std::filesystem::path config_path =
config_pkg_path_ / SETUP_ASSISTANT_FILE;
113 if (!std::filesystem::is_regular_file(config_path))
115 throw std::runtime_error(
"The chosen package location exists but was not created using MoveIt Setup Assistant. "
116 "If this is a mistake, provide the missing file: " +
117 config_path.string());
120 std::ifstream input_stream(config_path);
121 if (!input_stream.good())
123 throw std::runtime_error(
"Unable to open file for reading " + config_path.string());
129 const YAML::Node& doc = YAML::Load(input_stream);
131 const YAML::Node& title_node = doc[
"moveit_setup_assistant_config"];
135 std::string yaml_key =
name;
143 if (backwards_match !=
BACKWARDS_KEY_LOOKUP.end() && title_node[backwards_match->second].IsDefined())
145 yaml_key = backwards_match->second;
152 catch (YAML::ParserException& e)
154 throw std::runtime_error(
"Error parsing " + config_path.string() +
": " + e.what());
160 emitter << YAML::BeginMap;
162 emitter << YAML::Key <<
"moveit_setup_assistant_config";
163 emitter << YAML::Value << YAML::BeginMap;
167 YAML::Node node = config->saveToYaml();
172 emitter << YAML::Key << config->getName();
173 emitter << YAML::Value << node;
175 emitter << YAML::EndMap;
182 for (
const auto& config :
config_data_->getConfigured())
197 std::stringstream deps;
200 deps <<
" <exec_depend>" << dependency <<
"</exec_depend>\n";
208 return author_name_.find_first_not_of(
' ') != std::string::npos;
223 #include <pluginlib/class_list_macros.hpp>
PLUGINLIB_EXPORT_CLASS(cached_ik_kinematics_plugin::CachedIKKinematicsPlugin< kdl_kinematics_plugin::KDLKinematicsPlugin >, kinematics::KinematicsBase)
PackageSettingsConfig & parent_
bool writeYaml(YAML::Emitter &emitter) override
bool hasValidEmail() const
void collectVariables(std::vector< TemplateVariable > &variables) override
Collect key/value pairs for use in templates.
std::string author_name_
Name of the author of this config.
bool hasValidName() const
GeneratedTime config_pkg_generated_timestamp_
Timestamp when configuration package was generated, if it was previously generated.
void setPackagePath(const std::filesystem::path &package_path)
void loadPrevious(const std::filesystem::path &package_path, const YAML::Node &node) override
Overridden method to load THIS config's data variables.
void setPackageName(const std::string &package_name)
std::string author_email_
Email of the author of this config.
std::set< std::string > package_dependencies_
YAML::Node saveToYaml() const override
Optionally save "meta" information for saving in the .setup_assistant yaml file.
void loadExisting(const std::string &package_path_or_name)
Method for loading the contents of the .setup_assistant file into all the configs.
std::string new_package_name_
Name of the new package that is being (or going) to be generated, based on user specified save path.
std::filesystem::path config_pkg_path_
Loaded configuration package path - if an existing package was loaded, holds that path.
where all the data for each part of the configuration is stored.
std::shared_ptr< DataWarehouse > config_data_
long int toEpoch(const GeneratedTime &t)
Convert a GeneratedTime to an integral epoch (using system_clock)
bool getYamlProperty(const YAML::Node &node, const std::string &key, T &storage, const T &default_value=T())
std::filesystem::path getSharePath(const std::string &package_name)
Return a path for the given package's share folder.
const std::regex MAIL_REGEX("\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,63}\\b", std::regex::icase)
bool extractPackageNameFromPath(const std::filesystem::path &path, std::string &package_name, std::filesystem::path &relative_filepath)
GeneratedTime fromEpoch(long int epoch)
Convert an integral epoch to GeneratedTime (using system_clock)
const std::unordered_map< std::string, std::string > BACKWARDS_KEY_LOOKUP({ { "urdf", "URDF" }, { "srdf", "SRDF" }, { "package_settings", "CONFIG" } })
Simple Key/value pair for templates.