Skip to content
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

[Ready] Port move_group to ROS2, fix some extra parameters #217

Merged
merged 30 commits into from
Aug 28, 2020
Merged

[Ready] Port move_group to ROS2, fix some extra parameters #217

merged 30 commits into from
Aug 28, 2020

Conversation

ddengster
Copy link
Contributor

@ddengster ddengster commented Jun 16, 2020

Description

Siphoned from PR #187
Accompanies PR #204 if you want things to work beyond compiling. merged!

Other changes include:

  • ompl_interface switched to plugin manager
  • parameters with '/' have been replaced by '.' in planning/planning_request_adapter_plugins/src/fix_start_state_bounds.cpp, planning/planning_scene_monitor/src/planning_scene_monitor.cpp, planning/robot_model_loader/src/robot_model_loader.cpp
  • dynamic reconfigure for planning_scene_monitor and trajectory_execution_manager has been integrated into a callback. You can look at the old definitions in the respective .cfg files

move_group's test has not been ported due to dependencies, see here.

Edit: It's compiling, but should we delay the codecov to another PR?

Checklist

@codecov
Copy link

codecov bot commented Jun 17, 2020

Codecov Report

Merging #217 into master will decrease coverage by 1.22%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #217      +/-   ##
==========================================
- Coverage   47.67%   46.45%   -1.23%     
==========================================
  Files         155      123      -32     
  Lines       15691    12781    -2910     
==========================================
- Hits         7481     5937    -1544     
+ Misses       8210     6844    -1366     
Impacted Files Coverage Δ
.../include/moveit/robot_model/revolute_joint_model.h 0.00% <0.00%> (-100.00%) ⬇️
...ry_processing/time_optimal_trajectory_generation.h 0.00% <0.00%> (-100.00%) ⬇️
...cessing/src/time_optimal_trajectory_generation.cpp 0.00% <0.00%> (-74.59%) ⬇️
...eit_core/collision_detection/src/collision_env.cpp 54.90% <0.00%> (-18.31%) ⬇️
...veit_core/robot_model/src/floating_joint_model.cpp 25.54% <0.00%> (-9.79%) ⬇️
moveit_core/planning_scene/src/planning_scene.cpp 33.68% <0.00%> (-7.05%) ⬇️
moveit_core/robot_state/src/robot_state.cpp 29.79% <0.00%> (-4.44%) ⬇️
...e/src/parameterization/model_based_state_space.cpp 65.97% <0.00%> (-2.78%) ⬇️
...lude/moveit/collision_detection/collision_common.h 77.50% <0.00%> (-2.50%) ⬇️
...bot_state/include/moveit/robot_state/robot_state.h 85.89% <0.00%> (-1.93%) ⬇️
... and 58 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 08b5fd9...6261057. Read the comment docs.

@ddengster ddengster changed the title [WIP] Port move_group to ROS2, fix some extra parameters [Ready] Port move_group to ROS2, fix some extra parameters Jun 29, 2020
moveit_ros/move_group/CMakeLists.txt Outdated Show resolved Hide resolved
moveit_ros/move_group/CMakeLists.txt Outdated Show resolved Hide resolved
Copy link
Member

@henningkayser henningkayser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This really looks almost done, just some minor comments to address.
With declared parameters the demo works out of the box for me (both on Foxy and Eloquent, rebased onto the latest branches). Also, thanks for fixing up the parameter callbacks, do you have a working example for this? The old cfg files can be removed.

moveit_ros/move_group/src/move_group_capability.cpp Outdated Show resolved Hide resolved
RCLCPP_INFO(LOGGER, "MoveGroup debug mode is OFF");

rclcpp::executors::MultiThreadedExecutor executor;
rclcpp::Node::SharedPtr monitor_node = rclcpp::Node::make_shared("monitor_node", opt);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the name be "move_group_node" or something like that? I think the PlanningSceneMonitor will use it's internal thread for monitoring anyway (#230)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this monitor_node is fed into planning_scene_monitor->startStateMonitor to prevent subscribers from never receiving messages. we can wait for #230 to go in first and adjust accordingly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would probably make sense to merge that one first and then adjust it here. Do you see any issues with the implementation in #230? Woudl be great to have a review that is based on an actual use case like this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#230 is merged

moveit_ros/move_group/CMakeLists.txt Outdated Show resolved Hide resolved
@ddengster
Copy link
Contributor Author

ddengster commented Aug 18, 2020

Also, thanks for fixing up the parameter callbacks, do you have a working example for this?

I referenced from these sources:
https://index.ros.org/doc/ros2/Releases/Release-Foxy-Fitzroy/#deprecate-set-on-parameters-set-callback

https://github.com/ros2/rclcpp/blob/master/rclcpp_lifecycle/test/test_lifecycle_node.cpp#L421

edit: removed cfg file b1c82a0

@henningkayser
Copy link
Member

henningkayser commented Aug 18, 2020

@ddengster as this is about to be ready, could you squash the commit history into several chunks before merging? clang-format, clang-tidy fixes, cleanup, rebase etc clutter up the commit history but we really want to keep the meaningful steps in your development.

Comment on lines 211 to 241
desc.set__name("publish_planning_scene");
desc.set__description("Set to True to publish Planning Scenes");
bool publish_planning_scene = node_->declare_parameter("planning_scene_monitor.publish_planning_scene", false, desc);

desc.set__name("publish_geometry_updates");
desc.set__description("Set to True to publish geometry updates of the planning scene");
bool publish_geom_updates = node_->declare_parameter("planning_scene_monitor.publish_geometry_updates", true, desc);

desc.set__name("publish_state_updates");
desc.set__description("Set to True to publish state updates of the planning scene");
bool publish_state_updates = node_->declare_parameter("planning_scene_monitor.publish_state_updates", false, desc);

desc.set__name("publish_transforms_updates");
desc.set__description("Set to True to publish transform updates of the planning scene");
bool publish_transform_updates = node_->declare_parameter("planning_scene_monitor.publish_transforms_updates", false, desc);

desc.set__type(rclcpp::ParameterType::PARAMETER_DOUBLE);
desc.set__name("publish_planning_scene_hz");
desc.set__description("Set the maximum frequency at which planning scene updates are published");
double publish_planning_scene_hz = node_->declare_parameter("planning_scene_monitor.publish_planning_scene_hz", 4.0, desc);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to check if the parameter is declared for the node before declaring it otherwise it will throw an exception, for example, if we create two monitors for the same node

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

has_parameter check before declare/get parameter 7f381b0

@ddengster
Copy link
Contributor Author

@henningkayser i've cut it down to 28 commits, let me know if you want it squashed further

Copy link
Member

@henningkayser henningkayser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, there still seem to be some regressions I tagged with the comments. Commit history is a bit long but it seems very descriptive so I'm fine with it.

if (action_res->error_code.val == moveit_msgs::msg::MoveItErrorCodes::PREEMPTED)
{
//@todo: wait for preempt?
// move_action_server_->setPreempted(action_res, response);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the goal just get canceled here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iirc in ros1 there was setCanceled and setPreempted, i wasn't sure what the difference was. anyway, i changed this to canceled 44c1643

@@ -38,6 +38,8 @@
#include <tf2_ros/transform_listener.h>
#include <moveit/move_group/capability_names.h>
#include <moveit/move_group/move_group_capability.h>
#include <moveit/move_group/move_group_context.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two includes seem redundant. I guess they were removed with the sync but then just added again with the rebase.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed redundant 44c1643

@@ -497,7 +528,7 @@ bool PlanningSceneMonitor::requestPlanningSceneState(const std::string& service_
throw std::runtime_error("requestPlanningSceneState() to self-provided service: " + service_name);
}
// use global namespace for service
auto client = pnode_->create_client<moveit_msgs::srv::GetPlanningScene>(service_name);
auto client = node_->create_client<moveit_msgs::srv::GetPlanningScene>(service_name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert, these and below should be pnode_

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted 44c1643

// reconfigure_impl_ = new DynamicReconfigureImpl(this);

// Set up publishing parameters
rcl_interfaces::msg::ParameterDescriptor desc;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of the lines below is causing a seg-fault, I wasn't able to determine which one but commenting them seems to fix it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you rebase onto #257? It could be the same timing issue

Copy link
Contributor Author

@ddengster ddengster Aug 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed parameter 44c1643

edit: i ran the demo, it seems to be working fine

Copy link
Member

@henningkayser henningkayser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ddengster Looks good to me. Please consider merging https://github.com/ddengster/moveit2/pull/2 first, but then please rebase and lgtm

@henningkayser henningkayser merged commit 273da39 into moveit:master Aug 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants