IFRA-Cranfield / ros2_SimRealRobotControl

This repository provides ready-to-use ROS2 (Humble) packages to execute simple programs and sequences and control different Industrial and Collaborative Robots using ROS 2.
Apache License 2.0
85 stars 10 forks source link

Cannot build ros2srrc_execution #7

Closed vanderlvoff closed 3 months ago

vanderlvoff commented 10 months ago

I followed the instructions including adding improved move_group_interface_improved.h However colcon build fails with: OS: Ubuntu 22.04.3 LTS ROS2: Humble Moveit2: 2.5.5

/usr/bin/ld: CMakeFiles/robmove.dir/src/robmove.cpp.o: in function `ActionServer::execute(std::shared_ptr<rclcpp_action::ServerGoalHandle<ros2srrc_data::action::Robmove> >)':
robmove.cpp:(.text._ZN12ActionServer7executeESt10shared_ptrIN13rclcpp_action16ServerGoalHandleIN13ros2srrc_data6action7RobmoveEEEE[_ZN12ActionServer7executeESt10shared_ptrIN13rclcpp_action16ServerGoalHandleIN13ros2srrc_data6action7RobmoveEEEE]+0x81b): undefined reference to `moveit::planning_interface::MoveGroupInterface::execute(moveit::planning_interface::MoveGroupInterface::Plan const&)'
/usr/bin/ld: CMakeFiles/move.dir/src/move.cpp.o: in function `ActionServer::execute(std::shared_ptr<rclcpp_action::ServerGoalHandle<ros2srrc_data::action::Move> >)':
move.cpp:(.text._ZN12ActionServer7executeESt10shared_ptrIN13rclcpp_action16ServerGoalHandleIN13ros2srrc_data6action4MoveEEEE[_ZN12ActionServer7executeESt10shared_ptrIN13rclcpp_action16ServerGoalHandleIN13ros2srrc_data6action4MoveEEEE]+0x16bf): undefined reference to `moveit::planning_interface::MoveGroupInterface::execute(moveit::planning_interface::MoveGroupInterface::Plan const&)'
/usr/bin/ld: move.cpp:(.text._ZN12ActionServer7executeESt10shared_ptrIN13rclcpp_action16ServerGoalHandleIN13ros2srrc_data6action4MoveEEEE[_ZN12ActionServer7executeESt10shared_ptrIN13rclcpp_action16ServerGoalHandleIN13ros2srrc_data6action4MoveEEEE]+0x1de3): undefined reference to `moveit::planning_interface::MoveGroupInterface::execute(moveit::planning_interface::MoveGroupInterface::Plan const&)'
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/robmove.dir/build.make:366: robmove] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:195: CMakeFiles/robmove.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/move.dir/build.make:518: move] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:143: CMakeFiles/move.dir/all] Error 2
/usr/bin/ld: CMakeFiles/sequence.dir/src/sequence.cpp.o: in function `ActionServer::execute(std::shared_ptr<rclcpp_action::ServerGoalHandle<ros2srrc_data::action::Sequence> >)':
sequence.cpp:(.text._ZN12ActionServer7executeESt10shared_ptrIN13rclcpp_action16ServerGoalHandleIN13ros2srrc_data6action8SequenceEEEE[_ZN12ActionServer7executeESt10shared_ptrIN13rclcpp_action16ServerGoalHandleIN13ros2srrc_data6action8SequenceEEEE]+0x1641): undefined reference to `moveit::planning_interface::MoveGroupInterface::execute(moveit::planning_interface::MoveGroupInterface::Plan const&)'
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/sequence.dir/build.make:526: sequence] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:169: CMakeFiles/sequence.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed   <<< ros2srrc_execution [2.01s, exited with code 2]

UPDATE: After deleting all the code built with these warnings:

[Processing: ros2srrc_execution]                               
--- stderr: ros2srrc_execution                                       
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/robmove.cpp: In function ‘moveit::planning_interface::MoveGroupInterface::Plan plan_ROB()’:
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/robmove.cpp:74:108: warning: ‘using MoveItErrorCode = class moveit::core::MoveItErrorCode’ is deprecated: Use moveit::core::MoveItErrorCode [-Wdeprecated-declaration]
   74 |     bool success = (move_group_interface_ROB.plan(my_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);
      |                                                                                                            ^~~~~~~
In file included from /home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/robmove.cpp:41:
/opt/ros/humble/include/moveit/move_group_interface/move_group_interface_improved.h:71:7: note: declared here
   71 | using MoveItErrorCode [[deprecated("Use moveit::core::MoveItErrorCode")]] = moveit::core::MoveItErrorCode;
      |       ^~~~~~~~~~~~~~~
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/robmove.cpp: In member function ‘rclcpp_action::GoalResponse ActionServer::handle_goal(const GoalUUID&, std::shared_ptr<const ros2srrc_data::action::Robmove_Goal_<std::allocator<void> > >)’:
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/robmove.cpp:115:77: warning: unused parameter ‘uuid’ [-Wunused-parameter]
  115 |     rclcpp_action::GoalResponse handle_goal(const rclcpp_action::GoalUUID & uuid, std::shared_ptr<const Robmove::Goal> goal)
      |                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/robmove.cpp: In member function ‘void ActionServer::execute(std::shared_ptr<rclcpp_action::ServerGoalHandle<ros2srrc_data::action::Robmove> >)’:
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/robmove.cpp:178:17: warning: comparison with string literal results in unspecified behavior [-Waddress]
  178 |         if (RES == "PLANNING: OK"){
      |             ~~~~^~~~~~~~~~~~~~~~~
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/robmove.cpp:180:122: warning: ‘using MoveItErrorCode = class moveit::core::MoveItErrorCode’ is deprecated: Use moveit::core::MoveItErrorCode [-Wdeprecated-declarations]
  180 |             bool ExecSUCCESS = (move_group_interface_ROB.execute(MyPlan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);
      |                                                                                                                          ^~~~~~~
In file included from /home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/robmove.cpp:41:
/opt/ros/humble/include/moveit/move_group_interface/move_group_interface_improved.h:71:7: note: declared here
   71 | using MoveItErrorCode [[deprecated("Use moveit::core::MoveItErrorCode")]] = moveit::core::MoveItErrorCode;
      |       ^~~~~~~~~~~~~~~
In file included from /opt/ros/humble/include/rclcpp/rclcpp/logging.hpp:24,
                 from /opt/ros/humble/include/rclcpp/rclcpp/client.hpp:40,
                 from /opt/ros/humble/include/rclcpp/rclcpp/callback_group.hpp:24,
                 from /opt/ros/humble/include/rclcpp/rclcpp/any_executable.hpp:20,
                 from /opt/ros/humble/include/rclcpp/rclcpp/memory_strategy.hpp:25,
                 from /opt/ros/humble/include/rclcpp/rclcpp/memory_strategies.hpp:18,
                 from /opt/ros/humble/include/rclcpp/rclcpp/executor_options.hpp:20,
                 from /opt/ros/humble/include/rclcpp/rclcpp/executor.hpp:37,
                 from /opt/ros/humble/include/rclcpp/rclcpp/executors/multi_threaded_executor.hpp:25,
                 from /opt/ros/humble/include/rclcpp/rclcpp/executors.hpp:21,
                 from /opt/ros/humble/include/rclcpp/rclcpp/rclcpp.hpp:155,
                 from /home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/robmove.cpp:34:
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/robmove.cpp: In function ‘int main(int, char**)’:
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/robmove.cpp:244:25: warning: format ‘%s’ expects argument of type ‘char*’, but argument 5 has type ‘std::__cxx11::basic_string<char>’ [-Wformat=]
  244 |     RCLCPP_INFO(logger, "MoveGroupInterface object created for ROBOT: %s", ROBname);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/robmove.cpp:244:72: note: format string is defined here
  244 |     RCLCPP_INFO(logger, "MoveGroupInterface object created for ROBOT: %s", ROBname);
      |                                                                       ~^
      |                                                                        |
      |                                                                        char*
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/mover.cpp: In function ‘MoveRSTRUCT MoveRAction(ros2srrc_data::msg::Joint, std::vector<double, std::allocator<double> >, std::string)’:
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/mover.cpp:201:27: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
  201 |     } else if (InputJoint = "NotValid"){
      |                ~~~~~~~~~~~^~~~~~~~~~~~
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/move.cpp: In function ‘moveit::planning_interface::MoveGroupInterface::Plan plan_ROB()’:
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/move.cpp:130:108: warning: ‘using MoveItErrorCode = class moveit::core::MoveItErrorCode’ is deprecated: Use moveit::core::MoveItErrorCode [-Wdeprecated-declarations]
  130 |     bool success = (move_group_interface_ROB.plan(my_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);
      |                                                                                                            ^~~~~~~
In file included from /home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/include/ros2srrc_execution/movej.h:43,
                 from /home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/move.cpp:31:
/opt/ros/humble/include/moveit/move_group_interface/move_group_interface_improved.h:71:7: note: declared here
   71 | using MoveItErrorCode [[deprecated("Use moveit::core::MoveItErrorCode")]] = moveit::core::MoveItErrorCode;
      |       ^~~~~~~~~~~~~~~
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/move.cpp: In function ‘moveit::planning_interface::MoveGroupInterface::Plan plan_EE()’:
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/move.cpp:149:107: warning: ‘using MoveItErrorCode = class moveit::core::MoveItErrorCode’ is deprecated: Use moveit::core::MoveItErrorCode [-Wdeprecated-declarations]
  149 |     bool success = (move_group_interface_EE.plan(my_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);
      |                                                                                                           ^~~~~~~
In file included from /home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/include/ros2srrc_execution/movej.h:43,
                 from /home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/move.cpp:31:
/opt/ros/humble/include/moveit/move_group_interface/move_group_interface_improved.h:71:7: note: declared here
   71 | using MoveItErrorCode [[deprecated("Use moveit::core::MoveItErrorCode")]] = moveit::core::MoveItErrorCode;
      |       ^~~~~~~~~~~~~~~
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/move.cpp: In member function ‘rclcpp_action::GoalResponse ActionServer::handle_goal(const GoalUUID&, std::shared_ptr<const ros2srrc_data::action::Move_Goal_<std::allocator<void> > >)’:
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/move.cpp:199:16: warning: unused variable ‘speed’ [-Wunused-variable]
  199 |         double speed = goal->speed;
      |                ^~~~~
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/move.cpp:193:41: warning: unused parameter ‘uuid’ [-Wunused-parameter]
  193 |         const rclcpp_action::GoalUUID & uuid,
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/move.cpp: In member function ‘void ActionServer::execute(std::shared_ptr<rclcpp_action::ServerGoalHandle<ros2srrc_data::action::Move> >)’:
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/move.cpp:422:122: warning: ‘using MoveItErrorCode = class moveit::core::MoveItErrorCode’ is deprecated: Use moveit::core::MoveItErrorCode [-Wdeprecated-declarations]
  422 |             bool ExecSUCCESS = (move_group_interface_ROB.execute(MyPlan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);
      |                                                                                                                          ^~~~~~~
In file included from /home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/include/ros2srrc_execution/movej.h:43,
                 from /home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/move.cpp:31:
/opt/ros/humble/include/moveit/move_group_interface/move_group_interface_improved.h:71:7: note: declared here
   71 | using MoveItErrorCode [[deprecated("Use moveit::core::MoveItErrorCode")]] = moveit::core::MoveItErrorCode;
      |       ^~~~~~~~~~~~~~~
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/mover.cpp: In function ‘MoveRSTRUCT MoveRAction(ros2srrc_data::msg::Joint, std::vector<double, std::allocator<double> >, std::string)’:
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/mover.cpp:201:27: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
  201 |     } else if (InputJoint = "NotValid"){
      |                ~~~~~~~~~~~^~~~~~~~~~~~
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/sequence.cpp: In function ‘moveit::planning_interface::MoveGroupInterface::Plan plan_ROB()’:
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/sequence.cpp:143:108: warning: ‘using MoveItErrorCode = class moveit::core::MoveItErrorCode’ is deprecated: Use moveit::core::MoveItErrorCode [-Wdeprecated-declarations]
  143 |     bool success = (move_group_interface_ROB.plan(my_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);
      |                                                                                                            ^~~~~~~
In file included from /home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/include/ros2srrc_execution/movej.h:43,
                 from /home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/sequence.cpp:31:
/opt/ros/humble/include/moveit/move_group_interface/move_group_interface_improved.h:71:7: note: declared here
   71 | using MoveItErrorCode [[deprecated("Use moveit::core::MoveItErrorCode")]] = moveit::core::MoveItErrorCode;
      |       ^~~~~~~~~~~~~~~
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/sequence.cpp: In function ‘moveit::planning_interface::MoveGroupInterface::Plan plan_EE()’:
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/sequence.cpp:162:107: warning: ‘using MoveItErrorCode = class moveit::core::MoveItErrorCode’ is deprecated: Use moveit::core::MoveItErrorCode [-Wdeprecated-declarations]
  162 |     bool success = (move_group_interface_EE.plan(my_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);
      |                                                                                                           ^~~~~~~
In file included from /home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/include/ros2srrc_execution/movej.h:43,
                 from /home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/sequence.cpp:31:
/opt/ros/humble/include/moveit/move_group_interface/move_group_interface_improved.h:71:7: note: declared here
   71 | using MoveItErrorCode [[deprecated("Use moveit::core::MoveItErrorCode")]] = moveit::core::MoveItErrorCode;
      |       ^~~~~~~~~~~~~~~
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/sequence.cpp: In function ‘bool ATTACH(ros2srrc_data::msg::Linkattacher)’:
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/sequence.cpp:205:18: warning: unused variable ‘attachOK’ [-Wunused-variable]
  205 |         if (bool attachOK = RES->success) {
      |                  ^~~~~~~~
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/sequence.cpp: In function ‘bool DETACH(ros2srrc_data::msg::Linkattacher)’:
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/sequence.cpp:233:18: warning: unused variable ‘detachOK’ [-Wunused-variable]
  233 |         if (bool detachOK = RES->success) {
      |                  ^~~~~~~~
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/sequence.cpp: In member function ‘rclcpp_action::GoalResponse ActionServer::handle_goal(const GoalUUID&, std::shared_ptr<const ros2srrc_data::action::Sequence_Goal_<std::allocator<void> > >)’:
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/sequence.cpp:321:41: warning: unused parameter ‘uuid’ [-Wunused-parameter]
  321 |         const rclcpp_action::GoalUUID & uuid,
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/sequence.cpp: In member function ‘void ActionServer::execute(std::shared_ptr<rclcpp_action::ServerGoalHandle<ros2srrc_data::action::Sequence> >)’:
/home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/sequence.cpp:561:130: warning: ‘using MoveItErrorCode = class moveit::core::MoveItErrorCode’ is deprecated: Use moveit::core::MoveItErrorCode [-Wdeprecated-declarations]
  561 |                     bool ExecSUCCESS = (move_group_interface_ROB.execute(MyPlan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);
      |                                                                                                                                  ^~~~~~~
In file included from /home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/include/ros2srrc_execution/movej.h:43,
                 from /home/ubuntu/dev_ws/src/ros2_SimRealRobotControl/ros2srrc_execution/src/sequence.cpp:31:
/opt/ros/humble/include/moveit/move_group_interface/move_group_interface_improved.h:71:7: note: declared here
   71 | using MoveItErrorCode [[deprecated("Use moveit::core::MoveItErrorCode")]] = moveit::core::MoveItErrorCode;
      |       ^~~~~~~~~~~~~~~
---
Finished <<< ros2srrc_execution [50.5s]

Summary: 30 packages finished [1min 12s]
  1 package had stderr output: ros2srrc_execution
pruthvidarshanss commented 9 months ago

Hello there, even i facing the same issue of ros2_srrc_execution stderr output, let me know if anyone have a solution for this issue.

vanderlvoff commented 9 months ago

Hello there, even i facing the same issue of ros2_srrc_execution stderr output, let me know if anyone have a solution for this issue.

I just removed the build, install, and logs (everything except for src) folders and rebuilt everything. And for some reason, it worked. Are you having exactly the same error log?

pruthvidarshanss commented 9 months ago

Yes, i did had the same error log as you.

Well actually, we have to run colcon build twice back-to-back, and then i did not find any errors during the build and simulation worked smoothly.

vanderlvoff commented 9 months ago

Yes, i did had the same error log as you.

Well actually, we have to run colcon build twice back-to-back, and then i did not find any errors during the build and simulation worked smoothly.

Glad to hear it works. Looks like building it twice is a part of the workflow (speaking sarcastically).

hhz0328 commented 8 months ago

Still colcon build fails can you tell me how to solve it

pruthvidarshanss commented 8 months ago

Well it worked for me after i executed colcon build twice back-to-back at the last step. I suggest you to follow the exact procedure as mentioned in the README file and at the last step colcon build it twice. Worked for me.

hhz0328 commented 8 months ago

thanks