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

Use emulated time in action-based controller #899

Merged
merged 5 commits into from
Nov 18, 2022

Conversation

galou
Copy link
Contributor

@galou galou commented Dec 9, 2021

Signed-off-by: Gaël Écorchard gael.ecorchard@cvut.cz

Description

future.wait_for() should not be used with a time obtained from node_->now() because of the mix between simulated and system time. This PR fix the issue that the action server would time out with a very slow simulated time.

Note that for technical reasons (cf. below) I cannot compile main but that same changes compile when based on foxy.

PS: can someone point me to the documentation to test a PR on the main branch? I use Foxy and I'm struggling with compiling the main branch. The documentation states that I could base my PR on foxy but my last PR was rejected because of this.

Checklist

  • Required by CI: Code is auto formatted using clang-format
  • Extend the tutorials / documentation reference
  • Document API changes relevant to the user in the MIGRATION.md notes
  • Create tests, which fail without this PR reference
  • Include a screenshot if changing a GUI
  • While waiting for someone to review your request, please help review another open pull request to support the maintainers

@vatanaksoytezer
Copy link
Contributor

vatanaksoytezer commented Dec 9, 2021

Hi @galou thanks a lot for the contributions!

PS: can someone point me to the documentation to test a PR on the main branch? I use Foxy and I'm struggling with compiling the main branch. The documentation states that I could base my PR on foxy but my last PR was rejected because of this.

We should update the documentation on this, it was a recent effort we have taken to merge everything to main and backport if there are no API / ABI breaks.

main branch would compile on both galactic and rolling. It should be sufficient to follow the source build instructions on the MoveIt website to build our main branch. Let me know if you have any troubles while doing so, and I'll be happy to help

@vatanaksoytezer
Copy link
Contributor

Oh, also CI seems broken right now (not related to your PR), I'm working on fixing it.

@galou
Copy link
Contributor Author

galou commented Dec 9, 2021

@vatanaksoytezer thanks for offering your help. I start the discussion here, please write me if it should continue elsewhere. The error I get with Rolling is:

--- stderr: moveit_hybrid_planning                                             
/usr/bin/ld: CMakeFiles/hybrid_planning_demo_node.dir/hybrid_planning_demo_node.cpp.o: in function `rclcpp_action::Client<moveit_msgs::action::HybridPlanner>::Client(std::shared_ptr<rclcpp::node_interfaces::NodeBaseInterface>, std::shared_ptr<rclcpp::node_interfaces::NodeGraphInterface>, std::shared_ptr<rclcpp::node_interfaces::NodeLoggingInterface>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rcl_action_client_options_t const&)':
/opt/ros/rolling/include/rclcpp_action/client.hpp:422: undefined reference to `rosidl_action_type_support_t const* rosidl_typesupport_cpp::get_action_type_support_handle<moveit_msgs::action::HybridPlanner>()'
collect2: error: ld returned 1 exit status
make[2]: *** [test/CMakeFiles/hybrid_planning_demo_node.dir/build.make:330: test/hybrid_planning_demo_node] Error 1
make[1]: *** [CMakeFiles/Makefile2:577: test/CMakeFiles/hybrid_planning_demo_node.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
---
Failed   <<< moveit_hybrid_planning [13.8s, exited with code 2]

@tylerjw
Copy link
Member

tylerjw commented Dec 9, 2021

I bet that is because you need a newer version of moveit_msgs. Currently in ros2 if you have a package installed (into /opt) and have it in your workspace it doesn't correctly use the one in your workspace which can cause errors like this. Assuming you have moveit_msgs in your workspace, try uninstalling it with apt and re-building.

sudo apt remove ros-rolling-moveit-msgs

This is something that is on the Humble roadmap and should hopefully be fixed soon in colcon in a way that can work even if you can't upgrade to Humble right away.

@galou
Copy link
Contributor Author

galou commented Dec 9, 2021

The issue with moveit_msgs is solved, I managed to compile on Rolling. Thanks!

@vatanaksoytezer
Copy link
Contributor

vatanaksoytezer commented Dec 23, 2021

@galou there seems a few legitimate build errors on this PR in CI, do you mind fixing them? I think this is a really nice PR that we would like to merge soon.

@codecov
Copy link

codecov bot commented Feb 22, 2022

Codecov Report

Base: 50.95% // Head: 50.95% // No change to project coverage 👍

Coverage data is based on head (fda1223) compared to base (edc4fea).
Patch has no changes to coverable lines.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #899   +/-   ##
=======================================
  Coverage   50.95%   50.95%           
=======================================
  Files         378      378           
  Lines       31658    31658           
=======================================
  Hits        16129    16129           
  Misses      15529    15529           
Impacted Files Coverage Δ
...dl_kinematics_plugin/src/kdl_kinematics_plugin.cpp 78.79% <0.00%> (-1.13%) ⬇️
moveit_core/robot_state/src/robot_state.cpp 47.83% <0.00%> (-0.07%) ⬇️
...nning_scene_monitor/src/planning_scene_monitor.cpp 45.65% <0.00%> (+0.44%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@vatanaksoytezer
Copy link
Contributor

@galou do you mind running pre-commit for this PR? I think it all looks good, we just need the correct formatting to merge.

@galou
Copy link
Contributor Author

galou commented Feb 22, 2022

The pre-commit hook was not configured on my system, sorry.

Signed-off-by: Gaël Écorchard <gael.ecorchard@cvut.cz>
We need to keep track of the node in order to get the time from it.

Signed-off-by: Gaël Écorchard <gael.ecorchard@cvut.cz>
Signed-off-by: Gaël Écorchard <gael.ecorchard@cvut.cz>
Signed-off-by: Gaël Écorchard <gael.ecorchard@cvut.cz>
Copy link
Member

@tylerjw tylerjw left a comment

Choose a reason for hiding this comment

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

I rebased these changes and tested them locally, and they seem to work. Approving and merging assuming CI passes.

@AndyZe
Copy link
Member

AndyZe commented Nov 17, 2022

@tylerjw let's not jump the gun. 2 reviews needed. Hopefully I'll approve soon.

@tylerjw tylerjw merged commit b6fcac8 into moveit:main Nov 18, 2022
@galou galou deleted the sim_time_action_controller branch November 18, 2022 08:22
@tylerjw tylerjw added the backport-foxy Mergify label that triggers a PR backport to Foxy label Nov 18, 2022
mergify bot pushed a commit that referenced this pull request Nov 18, 2022
(cherry picked from commit b6fcac8)

# Conflicts:
#	moveit_plugins/moveit_simple_controller_manager/include/moveit_simple_controller_manager/action_based_controller_handle.h
@tylerjw tylerjw added backport-galactic Mergify label that triggers a PR backport to Galactic backport-humble Mergify label that triggers a PR backport to Humble labels Nov 18, 2022
mergify bot pushed a commit that referenced this pull request Nov 18, 2022
mergify bot pushed a commit that referenced this pull request Nov 18, 2022
henningkayser pushed a commit that referenced this pull request Nov 18, 2022
(cherry picked from commit b6fcac8)

Co-authored-by: Gaël Écorchard <gael.ecorchard@cvut.cz>
tylerjw pushed a commit that referenced this pull request Nov 19, 2022
(cherry picked from commit b6fcac8)

Co-authored-by: Gaël Écorchard <gael.ecorchard@cvut.cz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-foxy Mergify label that triggers a PR backport to Foxy backport-galactic Mergify label that triggers a PR backport to Galactic backport-humble Mergify label that triggers a PR backport to Humble
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants