Skip to content

Compile error in moveit_cpp_tutorial: ‘moveit_cpp’ was not declared in this scope; did you mean ‘moveit_cpp_ptr’? #613

Open

Description

@robotrapta

Description

I'm getting a compiler error when following the getting started instructions for the tutorial on a clean Ubuntu 20.04+Noetic machine. (Arm64 FWIW)

Overview of your issue here.

Your environment

  • ROS Distro: Noetic
  • OS Version: Ubuntu 20.04 Linux ip-172-31-3-122 5.4.0-1039-aws Added Trac-IK tutorial #41-Ubuntu SMP Wed Feb 24 23:14:54 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux
  • Source or Binary build? Source
  • If binary, which release version?
  • If source, which git commit or tag? 186f9c4

Steps to reproduce

On a fresh EC2 graviton instance with Ubuntu 20.04, install Noetic, and follow the tutorial setup instructions https://ros-planning.github.io/moveit_tutorials/doc/getting_started/getting_started.html

When I get to catkin build it crashes. Same results regardless of whether I include MoveIt source or not.

Expected behaviour

Successful build

Backtrace or Console output

Errors     << moveit_tutorials:make /home/ubuntu/ws_moveit/logs/moveit_tutorials/build.make.000.log                                           
/home/ubuntu/ws_moveit/src/moveit_tutorials/doc/moveit_cpp/src/moveit_cpp_tutorial.cpp: In function ‘int main(int, char**)’:
/home/ubuntu/ws_moveit/src/moveit_tutorials/doc/moveit_cpp/src/moveit_cpp_tutorial.cpp:34:42: error: ‘moveit_cpp’ was not declared in this scope; did you mean ‘moveit_cpp_ptr’?
   34 |   auto moveit_cpp_ptr = std::make_shared<moveit_cpp::MoveItCpp>(nh);
      |                                          ^~~~~~~~~~
      |                                          moveit_cpp_ptr
/home/ubuntu/ws_moveit/src/moveit_tutorials/doc/moveit_cpp/src/moveit_cpp_tutorial.cpp:34:30: error: parse error in template argument list
   34 |   auto moveit_cpp_ptr = std::make_shared<moveit_cpp::MoveItCpp>(nh);
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ubuntu/ws_moveit/src/moveit_tutorials/doc/moveit_cpp/src/moveit_cpp_tutorial.cpp:34:67: error: no matching function for call to ‘make_shared<<expression error> >(ros::NodeHandle&)’
   34 |   auto moveit_cpp_ptr = std::make_shared<moveit_cpp::MoveItCpp>(nh);
      |                                                                   ^
In file included from /usr/include/c++/9/memory:81,
                 from /usr/include/boost/config/no_tr1/memory.hpp:21,
                 from /usr/include/boost/smart_ptr/shared_ptr.hpp:23,
                 from /usr/include/boost/shared_ptr.hpp:17,
                 from /opt/ros/noetic/include/ros/forwards.h:37,
                 from /opt/ros/noetic/include/ros/common.h:37,
                 from /opt/ros/noetic/include/ros/ros.h:43,
                 from /home/ubuntu/ws_moveit/src/moveit_tutorials/doc/moveit_cpp/src/moveit_cpp_tutorial.cpp:1:
/usr/include/c++/9/bits/shared_ptr.h:714:5: note: candidate: ‘template<class _Tp, class ... _Args> std::shared_ptr<_Tp> std::make_shared(_Args&& ...)’
  714 |     make_shared(_Args&&... __args)
      |     ^~~~~~~~~~~
/usr/include/c++/9/bits/shared_ptr.h:714:5: note:   template argument deduction/substitution failed:
/home/ubuntu/ws_moveit/src/moveit_tutorials/doc/moveit_cpp/src/moveit_cpp_tutorial.cpp:34:67: error: template argument 1 is invalid
   34 |   auto moveit_cpp_ptr = std::make_shared<moveit_cpp::MoveItCpp>(nh);
      |                                                                   ^
/home/ubuntu/ws_moveit/src/moveit_tutorials/doc/moveit_cpp/src/moveit_cpp_tutorial.cpp:37:35: error: parse error in template argument list
   37 |   auto planning_components = std::make_shared<moveit_cpp::PlanningComponent>(PLANNING_GROUP, moveit_cpp_ptr);
      |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [doc/moveit_cpp/CMakeFiles/moveit_cpp_tutorial.dir/build.make:63: doc/moveit_cpp/CMakeFiles/moveit_cpp_tutorial.dir/src/moveit_cpp_tutorial.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:4801: doc/moveit_cpp/CMakeFiles/moveit_cpp_tutorial.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:141: all] Error 2
cd /home/ubuntu/ws_moveit/build/moveit_tutorials; catk

Activity

  1. welcome commented on Mar 17, 2021

    @welcome

    Thanks for reporting an issue. Because we're a volunteer community, providing a pull request with suggested changes is always welcomed.

  2. robotrapta commented on Mar 17, 2021

    @robotrapta
    Author

    Looks like 186f9c4 might have caused this? Rolling back to edb533c makes the error go away.

    @henningkayser

  3. rhaschke commented on Mar 18, 2021

    @rhaschke
    Contributor

    Yes, #549 caused this, which goes in sync with moveit/moveit1#2127, moveit/moveit_msgs#95, and moveit/moveit_resources#47. Until the next release is out, you will need to build all those packages from source to use the latest versions. Alternatively, rollback moveit_tutorials as suggested in #613 (comment).

  4. henningkayser commented on Mar 18, 2021

    @henningkayser
    Member

    @robotrapta sorry for the inconvenience

  5. robotrapta commented on Mar 18, 2021

    @robotrapta
    Author

    No worries! I understand that multi-package upgrades are tricky, but necessary for long-term code health.

    I have what I need. Maybe leave this open until the release is done so it's easier for others to find the workaround? Do search engines prioritize open issues vs closed? IDK.

  6. added a commit that references this issue on Mar 21, 2021
    ac523e5
  7. GoBeyond2017 commented on Mar 25, 2021

    @GoBeyond2017

    if you look up the source code of the MoveItCpp class, you will find the MoveItCpp's namespace is moveit::planning_interface not moveit_cpp, so replace the moveit_cpp with moveit::planning_interface, then it works.

  8. lucbettaieb commented on Apr 21, 2021

    @lucbettaieb

    @rhaschke
    Leaving a comment to share that it ain't great that the solution for fixing tutorial code is to wait for it to sync up with other released packages that as of over a month later, still don't seem to be finished. (I'm using noetic)

    If the namespaces are aliased, I'm throwing in a +1 for reopening and merging #614 so that future travelers aren't tripped up by this. Then, when things are synced, just change the namespacing back.

    Otherwise, at minimum, leave a temporary note in the example code...? This bug is dumb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions