-
Notifications
You must be signed in to change notification settings - Fork 946
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assistant: load additional file with kinematics parameters #1997
Conversation
Thanks for submitting this PR @simonschmeisser. Just to make it extra clear: the functionality contributed is not OPW specific, correct? It is essentially a way to configure an additional This mechanism could be used by / with other plugins as well, it seems? |
Yes of course, thanks for pointing this out. This is completely agnostic of course and could be used with other plugins that require configuration (eg |
moveit_setup_assistant/src/widgets/configuration_files_widget.cpp
Outdated
Show resolved
Hide resolved
moveit_setup_assistant/templates/moveit_config_pkg_template/launch/moveit_rviz.launch
Outdated
Show resolved
Hide resolved
moveit_setup_assistant/templates/moveit_config_pkg_template/launch/run_benchmark_ompl.launch
Outdated
Show resolved
Hide resolved
Funny coincidence, I actually started implementing something to address the same problem this weekend and planned to post something about it today. :) But you're approach is way more generic. I experimented with adding extra attributes to GroupMetaData in Does this mean we have to start thinking about releasing the plugin? |
192d52f
to
24140ac
Compare
With the current implementation, the extra file is completely optional. So there is no requirement for the OPW kinematics plugin to be present (or any plugin for that matter). But from my point-of-view, I would say: yes, please release the plugin. Don't let @davetcoleman know though: before you know it, he'll want to integrate it into |
37dcd53
to
c5687f6
Compare
be3c1e5
to
9a14e19
Compare
@v4hn I changed this to master in order to follow the normal workflow, could you please do a review or tag someone who could/should ;) @davetcoleman is probably too busy to even read this tag |
9a14e19
to
12aa7d7
Compare
Codecov Report
@@ Coverage Diff @@
## master #1997 +/- ##
==========================================
+ Coverage 54.04% 54.06% +0.02%
==========================================
Files 319 319
Lines 24997 25030 +33
==========================================
+ Hits 13509 13533 +24
- Misses 11488 11497 +9
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some remarks...
for (TiXmlElement* kinematics_parameter_file = kinematics_group->FirstChildElement("rosparam"); | ||
kinematics_parameter_file; kinematics_parameter_file = kinematics_parameter_file->NextSiblingElement("rosparam")) | ||
{ | ||
const char* ns = kinematics_parameter_file->Attribute("ns"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get the role of the ns
attribute here, which doesn't exist in the template file:
https://github.com/ros-planning/moveit/blob/4d3062164bf03ebb74c57d5eba0e3e50438481ba/moveit_setup_assistant/templates/moveit_config_pkg_template/launch/planning_context.launch#L19-L22
Shouldn't you check for the existence of the file
attribute instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the namespace is written in the block template "KINEMATICS_PARAMETERS_FILE_NAMES_BLOCK" (which is a bit ugly because there is no proper templating library with for loops like grantlee ...) and contains the name of the JointModelGroup
// find the kinematics section | ||
TiXmlHandle doc(&launch_document); | ||
TiXmlElement* kinematics_group = doc.FirstChild("launch").FirstChild("group").ToElement(); | ||
if (!kinematics_group) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check and warning here are somewhat superfluous given the other check below.
bool MoveItConfigData::extractPackageNameFromPath(const std::string& path, std::string& package_name, | ||
std::string& relative_filepath) const | ||
{ | ||
// Get the path to urdf, save filename |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adapt the comment?
std::vector<std::string> path_parts; // holds each folder name in vector | ||
|
||
// Copy path into vector of parts | ||
for (fs::path::iterator it = file_directory.begin(); it != file_directory.end(); ++it) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use range-based for?
sub_path /= path_parts[segment_count]; | ||
|
||
// decide if we should remember this directory name because it is topmost, in case it is the package/stack name | ||
if (segment_count == segment_length - 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of checking this condition in the loop, you can move the assignment out from the loop:
package_name = path_parts[segment_length - 1]
@@ -1118,6 +1121,18 @@ void ConfigurationFilesWidget::loadTemplateStrings() | |||
addTemplateString("[ROS_CONTROLLERS]", controllers.str()); | |||
} | |||
|
|||
std::string kinematics_parameters_files_block; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment to this section as for the others?
moveit_setup_assistant/templates/moveit_config_pkg_template/launch/moveit_rviz.launch
Show resolved
Hide resolved
moveit_setup_assistant/templates/moveit_config_pkg_template/launch/run_benchmark_ompl.launch
Show resolved
Hide resolved
@@ -19,6 +19,7 @@ | |||
<!-- Load default settings for kinematics; these settings are overridden by settings in a node's namespace --> | |||
<group ns="$(arg robot_description)_kinematics"> | |||
<rosparam command="load" file="$(find [GENERATED_PACKAGE_NAME])/config/kinematics.yaml"/> | |||
[KINEMATICS_PARAMETERS_FILE_NAMES_BLOCK] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See below
[KINEMATICS_PARAMETERS_FILE_NAMES_BLOCK] | |
[KINEMATICS_PARAMETERS_FILE_NAMES_BLOCK] |
moveit_setup_assistant/src/widgets/configuration_files_widget.cpp
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for this great simplification of the (old) code. This makes it much more readable.
// Create a subpath based on the outer loops length | ||
for (int segment_count = 0; segment_count < segment_length; ++segment_count) | ||
ROS_DEBUG_STREAM("checking in " << sub_path.make_preferred().string()); | ||
if (fs::is_regular_file(sub_path / "package.xml") || fs::is_regular_file(sub_path / "manifest.xml")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't you want to drop support for manifest.xml
? I would strongly support this.
Thanks for your work @simonschmeisser ! |
I'd love to see this backported to melodic as well, what would I need to do for that? And thanks for reviewing and merging! |
File a backport PR or wait for someone (we'll talk about it at the meeting later)
to look through all new patches in master and backport everything as needed). :-)
|
add extra field kinematics_parameters_file add kinematics parameters files in launchfiles read in kinematics_parameter_files from planning_context.launch add button and file dialog to select file resolve choosen file to relative file move template cache invalidation to beginning of export - cache has to be cleaned before *each* export, not just the first Otherwise changes will not be included in the second run stop loading kinematic parameters in run_benchmark_ompl.launch - It's redundant there Remove support for manifest.xml - obsolete since ... indigo?
haha! i love these remarks. i catch up on my github emails every World MoveIt Day... |
Description
This adds an option in MoveIt setup assistant to setup an additional yaml file with parameters for the kinematic solver(s). The main motivation for this is to improve integration of
opw_kinematics
[1] via themoveit_opw_kinematics_plugin
[2]. Currently the kinematic chain needs to be described in parameters in thekinematics.yaml
file. This makes it inconvenient to reuse the information from outside MoveIt (e.g.descartes
) as other setups typically have no access to the group names defined in SRDF. This and alternative approaches was discussed at length in [3].The plan is to distribute a MoveIt - independent YAML file along with the URDF description as can be seen in [4]. The user would then select the YAML file distributed along with the URDF file by ROS-Industrial. A separate entry is added in launch/planning_scene.launch per group to load this parameter file.
Adding this feature would allow dropping ikfast generated code for ros-i repositories, significantly reducing maintenance effort by going from 1k+ lines of code per robot to 9 lines of parameters.
1: https://github.com/Jmeyer1292/opw_kinematics
2: https://github.com/JeroenDM/moveit_opw_kinematics_plugin
3: ros-industrial/fanuc#245
4: ros-industrial/fanuc#284
@gavanderhoorn @JeroenDM
As I'm currently running melodic-devel and would hope for this to be backported, this PR is against melodic-devel. Once discussed I can rebase against master if this is more convenient for whoever does the merge.