Ask Your Question
0

error: cannot convert ‘moveit::planning_interface::MoveItErrorCode’ to ‘bool’ in assignment result_ = group.plan(my_plan); and Invoking "make -j8 -l8" failed

asked 2018-11-01 07:37:59 -0600

ruxuan.kuang521 gravatar image

updated 2018-11-01 08:12:49 -0600

gvdhoorn gravatar image

Your environment

  • ROS Distro: [Kinetic]
  • OS Version: Ubuntu 16.04
  • Source or Binary build?
  • If binary, which release version?
  • If source, which git commit or tag?

Im using ubuntu 16.04 to do a kinova arm project and i install kinova package, after when i catkin_make it, it should error from 96%.

and the errir code is

[ 98%] Building CXX object kinova-ros/kinova_moveit/kinova_arm_moveit_demo/CMakeFiles/pick_place.dir/src/pick_place.cpp.o
In file included from /home/ruxuan/catkin_ws/src/kinova-ros/kinova_moveit/kinova_arm_moveit_demo/src/motion_plan.cpp:1:0:
/opt/ros/kinetic/include/moveit/move_group_interface/move_group.h:43:2: warning: #warning "This header is deprecated and will go away in ROS lunar." "Please use moveit/move_group_interface/move_group_interface.h" "and the class MoveGroupInterface instead of MoveGroup" [-Wcpp]
 #warning "This header is deprecated and will go away in ROS lunar."\
  ^
In file included from /home/ruxuan/catkin_ws/src/kinova-ros/kinova_moveit/kinova_arm_moveit_demo/include/test_accuracy.h:15:0,
                 from /home/ruxuan/catkin_ws/src/kinova-ros/kinova_moveit/kinova_arm_moveit_demo/src/test_accuracy.cpp:3:
/opt/ros/kinetic/include/moveit/move_group_interface/move_group.h:43:2: warning: #warning "This header is deprecated and will go away in ROS lunar." "Please use moveit/move_group_interface/move_group_interface.h" "and the class MoveGroupInterface instead of MoveGroup" [-Wcpp]
 #warning "This header is deprecated and will go away in ROS lunar."\
  ^
In file included from /home/ruxuan/catkin_ws/src/kinova-ros/kinova_moveit/kinova_arm_moveit_demo/include/pick_place.h:15:0,
                 from /home/ruxuan/catkin_ws/src/kinova-ros/kinova_moveit/kinova_arm_moveit_demo/src/pick_place.cpp:1:
/opt/ros/kinetic/include/moveit/move_group_interface/move_group.h:43:2: warning: #warning "This header is deprecated and will go away in ROS lunar." "Please use moveit/move_group_interface/move_group_interface.h" "and the class MoveGroupInterface instead of MoveGroup" [-Wcpp]
 #warning "This header is deprecated and will go away in ROS lunar."\
  ^
/home/ruxuan/catkin_ws/src/kinova-ros/kinova_moveit/kinova_arm_moveit_demo/src/motion_plan.cpp: In function ‘int main(int, char**)’:
/home/ruxuan/catkin_ws/src/kinova-ros/kinova_moveit/kinova_arm_moveit_demo/src/motion_plan.cpp:31:46: warning: ‘MoveGroup’ is deprecated [-Wdeprecated-declarations]
   moveit::planning_interface::MoveGroup group("arm");
                                              ^
In file included from /home/ruxuan/catkin_ws/src/kinova-ros/kinova_moveit/kinova_arm_moveit_demo/src/motion_plan.cpp:1:0:
/opt/ros/kinetic/include/moveit/move_group_interface/move_group.h:56:7: note: declared here
 class MoveGroup : public MoveGroupInterface
       ^
/home/ruxuan/catkin_ws/src/kinova-ros/kinova_moveit/kinova_arm_moveit_demo/src/motion_plan.cpp:76:36: error: cannot convert ‘moveit::planning_interface::MoveItErrorCode’ to ‘bool’ in initialization
   bool success = group.plan(my_plan);
                                    ^
/home/ruxuan/catkin_ws/src/kinova-ros/kinova_moveit/kinova_arm_moveit_demo/src/motion_plan.cpp:126:11: error: cannot convert ‘moveit::planning_interface::MoveItErrorCode’ to ‘bool’ in assignment
   success = group.plan(my_plan);
           ^
/home/ruxuan/catkin_ws/src/kinova-ros/kinova_moveit/kinova_arm_moveit_demo/src/motion_plan.cpp:176:11: error: cannot convert ‘moveit::planning_interface::MoveItErrorCode’ to ‘bool’ in assignment
   success = group.plan(my_plan);
           ^
/home/ruxuan/catkin_ws/src/kinova-ros/kinova_moveit/kinova_arm_moveit_demo/src/motion_plan.cpp:271:11: error: cannot convert ‘moveit::planning_interface::MoveItErrorCode’ to ‘bool’ in assignment
   success = group.plan(my_plan);
           ^
In file included from /home/ruxuan/catkin_ws/src/kinova-ros/kinova_moveit/kinova_arm_moveit_demo/src/test_accuracy.cpp:3:0:
/home/ruxuan/catkin_ws/src/kinova-ros/kinova_moveit/kinova_arm_moveit_demo/include/test_accuracy.h:52:48: warning: ‘MoveGroup’ is deprecated [-Wdeprecated-declarations]
         moveit ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2018-11-01 08:28:58 -0600

So the main issue here is that at one point, MoveGroupInterface::plan() returned a bool: true if successful, and false otherwise. However, MoveGroupInterface::plan() now returns a MoveItErrorCode (see here), which is much more detailed and can say why a plan failed. However, code written to expect a bool won't compile anymore with this change, as the MoveItErrorCode type is not implicitly convertible to a bool.

As mentioned in the Migration document of MoveIt, this can be fixed by changing the code that compiles with MoveIt to use static_cast<bool>(move_group.plan()), instead of the old move_group.plan(). Since you are trying to compile with the Kinova Robot project, you would have to go to the lines shown in the above compile error, say motion.plan.cpp:76, and replace

bool success = group.plan(my_plan);

with

bool success = static_cast<bool>(group.plan(my_plan);

Changing all of those errors should allow the Kinova project to compile.

edit flag offensive delete link more

Comments

Hi, So that means I should check all cpp files in the Kinova MoveIt folder right? Sincerely

ruxuan.kuang521 gravatar imageruxuan.kuang521 ( 2018-11-01 09:00:18 -0600 )edit

Just the ones that are mentioned in the compiler errors above: It seems to be only kinova_moveit/kinova_arm_moveit_demo/src/motion_plan.cpp.

BryceWilley gravatar imageBryceWilley ( 2018-11-01 09:24:24 -0600 )edit

will do! ill keep you update, recently im struggling with midterm not really have much time to continue this, but ill definitely let you know when i got time to fix this at the end of this week. really appreciated!

ruxuan.kuang521 gravatar imageruxuan.kuang521 ( 2018-11-01 10:01:17 -0600 )edit

Hi, i think another issue comes up. /home/ruxuan/catkin_ws/src/kinovaros/kinova_moveit/kinova_arm_moveit_demo/src/pick_place.cpp:658:21: error: cannot convert ‘moveit::planning_interface::MoveItErrorCode’ to ‘bool’ in assignment result_ = group.plan(my_plan); whats the solution for this?

ruxuan.kuang521 gravatar imageruxuan.kuang521 ( 2018-11-07 20:19:33 -0600 )edit

It seems the motion_plan.cpp file in the Kinova project only includes the move_group.h file, even though the code that allows you to use a static_cast<bool>(...) lives in...

BryceWilley gravatar imageBryceWilley ( 2018-11-07 21:14:20 -0600 )edit

moveit_group_interface.h. Try adding #include <moveit/move_group_interface/move_group_interface.h> at the top or ...

BryceWilley gravatar imageBryceWilley ( 2018-11-07 21:15:49 -0600 )edit

Simply use the equivalent expression instead: group.plan(my_plan) == moveit_msgs::MoveItErrorCodes::SUCCESS;

BryceWilley gravatar imageBryceWilley ( 2018-11-07 21:18:21 -0600 )edit

hi, i add static_cast <bool>(...) on those and the cmake works fine right now. and now a new problem comes out. could u please check this issue? https://answers.ros.org/question/3078...</bool>

ruxuan.kuang521 gravatar imageruxuan.kuang521 ( 2018-11-07 22:23:41 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-11-01 07:37:59 -0600

Seen: 414 times

Last updated: Nov 01 '18