41 #include <boost/program_options.hpp> 43 namespace po = boost::program_options;
53 std::string setup_assistant_path;
62 ROS_ERROR_STREAM(
"Could not parse .setup_assistant file from '" << setup_assistant_path <<
"'");
74 const std::vector<std::string>& xacro_args)
76 std::string urdf_string;
82 if (!config_data.
urdf_model_->initString(urdf_string))
88 std::string srdf_string;
101 config_data.
srdf_->disabled_collisions_.clear();
107 double min_collision_fraction,
bool verbose)
110 unsigned int collision_progress;
112 trials > 0, trials, min_collision_fraction, verbose);
115 int main(
int argc,
char* argv[])
117 std::string config_pkg_path;
118 std::string urdf_path;
119 std::string srdf_path;
121 std::string output_path;
123 bool include_default =
false, include_always =
false, keep_old =
false,
verbose =
false;
125 double min_collision_fraction = 1.0;
127 uint32_t never_trials = 0;
129 po::options_description
desc(
"Allowed options");
130 desc.add_options()(
"help",
"show help")(
"config-pkg", po::value(&config_pkg_path),
"path to moveit config package")(
131 "urdf", po::value(&urdf_path),
132 "path to URDF ( or xacro)")(
"srdf", po::value(&srdf_path),
133 "path to SRDF ( or xacro)")(
"output", po::value(&output_path),
"output path for SRDF")
135 (
"xacro-args", po::value<std::vector<std::string> >()->composing(),
"additional arguments for xacro")
137 (
"default", po::bool_switch(&include_default),
"disable default colliding pairs")(
138 "always", po::bool_switch(&include_always),
"disable always colliding pairs")
140 (
"keep", po::bool_switch(&keep_old),
"keep disabled link from SRDF")(
"verbose", po::bool_switch(&
verbose),
143 (
"trials", po::value(&never_trials),
"number of trials for searching never colliding pairs")(
144 "min-collision-fraction", po::value(&min_collision_fraction),
145 "fraction of small sample size to determine links that are alwas colliding");
147 po::positional_options_description pos_desc;
148 pos_desc.add(
"xacro-args", -1);
150 po::variables_map vm;
151 po::store(po::command_line_parser(argc, argv).
options(desc).positional(pos_desc).
run(), vm);
154 if (vm.count(
"help"))
156 std::cout << desc << std::endl;
162 if (!config_pkg_path.empty())
170 else if (urdf_path.empty() || srdf_path.empty())
177 ROS_ERROR_STREAM(
"Please provide a different output file for SRDF xacro input file");
182 if (!urdf_path.empty())
184 if (!srdf_path.empty())
187 std::vector<std::string> xacro_args;
188 if (vm.count(
"xacro-args"))
189 xacro_args = vm[
"xacro-args"].as<std::vector<std::string> >();
191 if (!
setup(config_data, keep_old, xacro_args))
199 size_t skip_mask = 0;
200 if (!include_default)
207 config_data.
srdf_->writeSRDF(output_path.empty() ? config_data.
srdf_path_ : output_path);
int main(int argc, char *argv[])
urdf::ModelSharedPtr urdf_model_
URDF robot model.
bool setPackagePath(const std::string &pkg_path)
bool inputSetupAssistantYAML(const std::string &file_path)
bool createFullURDFPath()
Make the full URDF path using the loaded .setup_assistant data.
static bool isXacroFile(const std::string &path)
planning_scene::PlanningScenePtr getPlanningScene()
Provide a shared planning scene.
srdf::SRDFWriterPtr srdf_
SRDF Data and Writer.
void setCollisionLinkPairs(const moveit_setup_assistant::LinkPairMap &link_pairs, size_t skip_mask=0)
Set list of collision link pairs in SRDF; sorted; with optional filter.
std::string srdf_path_
Full file-system path to srdf.
bool setup(moveit_setup_assistant::MoveItConfigData &config_data, bool keep_old, const std::vector< std::string > &xacro_args)
bool getSetupAssistantYAMLPath(std::string &path)
bool createFullSRDFPath(const std::string &package_path)
Make the full SRDF path using the loaded .setup_assistant data.
static bool loadXmlFileToString(std::string &buffer, const std::string &path, const std::vector< std::string > &xacro_args)
LinkPairMap computeDefaultCollisions(const planning_scene::PlanningSceneConstPtr &parent_scene, unsigned int *progress, const bool include_never_colliding, const unsigned int trials, const double min_collision_faction, const bool verbose)
Generate an adjacency list of links that are always and never in collision, to speed up collision det...
This class is shared with all widgets and contains the common configuration data needed for generatin...
#define ROS_ERROR_STREAM(args)
bool loadSetupAssistantConfig(moveit_setup_assistant::MoveItConfigData &config_data, const std::string &pkg_path)
std::string urdf_path_
Full file-system path to urdf.
void run(ClassLoader *loader)
moveit_setup_assistant::LinkPairMap compute(moveit_setup_assistant::MoveItConfigData &config_data, uint32_t trials, double min_collision_fraction, bool verbose)
std::string config_pkg_path_
Loaded configuration package path - if an existing package was loaded, holds that path...
std::map< std::pair< std::string, std::string >, LinkPairData > LinkPairMap
LinkPairMap is an adjacency list structure containing links in string-based form. Used for disabled l...