ros-aldebaran / romeo_moveit_actions

Simple actions (pick and place) based on MoveIt for Romeo, Pepper, and Nao
10 stars 10 forks source link

Linking externally this package #3

Open lluissalord opened 8 years ago

lluissalord commented 8 years ago

I have tried to use the Action class from my package, and it gave me the error of non existing file or directory for #include in romeo_moveit_actions/action.hpp:17:25. I have fix that error changing in romeo_moveit_actions/action.hpp from:

#include <metablock.hpp>
#include <postures.hpp>

for:

#include "metablock.hpp"
#include "postures.hpp"

And I think that should made the same change in romeo_moveit_actions/simplepickplace.hpp.

The problem is that now it gives me error of undefined references with tha functions of Action class. I think that my CMakeLists is okay with:

cmake_minimum_required(VERSION 2.8.3)
project(romeo_grasper)

## Find catkin macros and libraries
find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  std_msgs
  geometry_msgs
  moveit_ros_planning_interface
  romeo_moveit_actions
)

# This will install python libraries
catkin_python_setup()

catkin_package(CATKIN_DEPENDS roscpp rospy geometry_msgs std_msgs romeo_moveit_actions)

include_directories( include
        ${catkin_INCLUDE_DIRS})
add_executable(romeo_grasper_object src/romeo_grasper_driver.cpp src/romeograspingobject.cpp)
target_link_libraries(romeo_grasper_object
        ${catkin_LIBRARIES})
add_dependencies(romeo_grasper_object ${catkin_EXPORTED_TARGETS})

install(TARGETS romeo_grasper_object
        RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})

#And this will install python nodes
catkin_install_python(PROGRAMS nodes/moveit.py
    DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})

install(DIRECTORY config launch
   DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)

Any idea of where is the problem?

Thank you! Lluis

nlyubova commented 8 years ago

@lluissalord thank you for comments. Just clean build and devel and re-compile everything. I've got the same issue as https://groups.google.com/a/rethinkrobotics.com/forum/#!msg/brr-users/leiUI4CSTaA/J8G_4AroCQAJ Will try to fix it

Also true that I've changed the name of this project for few times before, so it is possible that something is missing. Could you print your error?

lluissalord commented 8 years ago

The error that gives me is the following:

Linking CXX executable /home/lluis/catkin_ws/devel/lib/romeo_grasper/romeo_grasper_object
[ 87%] Built target nao_dcm_driver
[ 93%] Built target romeo_dcm_driver
CMakeFiles/romeo_grasper_object.dir/src/romeograspingobject.cpp.o: En la función `RomeoGrasperObject::simpleGrasperSetup()':
romeograspingobject.cpp:(.text+0x1524): referencia a `moveit_simple_actions::Action::Action(ros::NodeHandle*, boost::shared_ptr<moveit_visual_tools::MoveItVisualTools>&, std::string, std::string)' sin definir
romeograspingobject.cpp:(.text+0x15fa): referencia a `moveit_simple_actions::Action::Action(ros::NodeHandle*, boost::shared_ptr<moveit_visual_tools::MoveItVisualTools>&, std::string, std::string)' sin definir
romeograspingobject.cpp:(.text+0x17f1): referencia a `MetaBlock::MetaBlock(std::string, ros::Time, geometry_msgs::Pose_<std::allocator<void> >, unsigned int, double, double)' sin definir
CMakeFiles/romeo_grasper_object.dir/src/romeograspingobject.cpp.o: En la función `RomeoGrasperObject::newPlanningAndExecutePoseGoal()':
romeograspingobject.cpp:(.text+0x2b3d): referencia a `moveit_simple_actions::Action::graspPlan(MetaBlock*, std::string)' sin definir
romeograspingobject.cpp:(.text+0x2b9b): referencia a `moveit_simple_actions::Action::graspPlan(MetaBlock*, std::string)' sin definir
romeograspingobject.cpp:(.text+0x307d): referencia a `moveit_simple_actions::Action::executeAction()' sin definir
romeograspingobject.cpp:(.text+0x309e): referencia a `moveit_simple_actions::Action::executeAction()' sin definir
collect2: error: ld returned 1 exit status
make[2]: *** [/home/lluis/catkin_ws/devel/lib/romeo_grasper/romeo_grasper_object] Error 1
make[1]: *** [romeo_grasper/CMakeFiles/romeo_grasper_object.dir/all] Error 2
make: *** [all] Error 2
Invoking "make -j8 -l8" failed

Note: is in spanish but the error "referencia a ... sin definir" means "undefined reference".

I have changed the CMakeLists to solve some of the undefined reference that I had with moveit_visual_tools but I couldn't fix the others.

CMakeLists:

cmake_minimum_required(VERSION 2.8.3)
project(romeo_grasper)

## Find catkin macros and libraries
find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  std_msgs
  std_srvs
  geometry_msgs
  moveit_ros_planning_interface
  romeo_moveit_actions
  moveit_visual_tools
)

# This will install python libraries
catkin_python_setup()

include_directories(include ${catkin_INCLUDE_DIRS})

# What will find when others package find_package this
catkin_package(
    INCLUDE_DIRS include
    LIBRARIES ${PROJECT_NAME}
    CATKIN_DEPENDS roscpp rospy geometry_msgs std_msgs std_srvs moveit_ros_planning_interface romeo_moveit_actions moveit_visual_tools
)

add_executable(romeo_grasper_object src/romeo_grasper_driver.cpp src/romeograspingobject.cpp)
add_dependencies(romeo_grasper_object ${catkin_EXPORTED_TARGETS})
target_link_libraries(romeo_grasper_object ${catkin_LIBRARIES})

install(TARGETS romeo_grasper_object
        RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})

#And this will install python nodes
catkin_install_python(PROGRAMS nodes/moveit.py
    DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})

install(DIRECTORY config launch
   DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
lluissalord commented 8 years ago

Removing the files in /build and /devel and using in the action.hpp:

#include <metablock.hpp>
#include <postures.hpp>

I get the error:

In file included from /home/lluis/catkin_ws/src/romeo_grasper/include/romeo_grasper/romeograspingobject.h:20:0,
                 from /home/lluis/catkin_ws/src/romeo_grasper/src/romeograspingobject.cpp:1:
/home/lluis/catkin_ws/src/romeo/romeo_moveit_actions/include/romeo_moveit_actions/action.hpp:17:25: fatal error: metablock.hpp: No existe el archivo o el directorio
 #include <metablock.hpp>
                         ^
compilation terminated.

That means the file or directory doesn't exist.

nlyubova commented 8 years ago

try the changes like this https://github.com/nlyubova/romeo_moveit_actions/commit/21150ad744637130a9e1c1a0f1339690e5930f8b

lluissalord commented 8 years ago

I think I have tried this yet, but I will test again

lluissalord commented 8 years ago

I think that better to don't change the INCLUDE_DIRS include because now in my headers I have to use:

#include <action.hpp>
#include <metablock.hpp>

instead of:

#include <romeo_moveit_actions/action.hpp>
#include <romeo_moveit_actions/metablock.hpp>

It seems that continue with the same error as before

lluissalord commented 8 years ago

Now with another clean installation it doesn't report the error of non existing file or directory. But I don't find the way of fixing the problem with undefined references.

nlyubova commented 8 years ago

did you try to add the package to "package.xml" to ?

lluissalord commented 8 years ago

Yes, this is the package.xml

...

  <build_depend>roscpp</build_depend>
  <build_depend>rospy</build_depend>
  <build_depend>std_msgs</build_depend>
  <build_depend>std_srvs</build_depend>
  <build_depend>geometry_msgs</build_depend>
  <build_depend>romeo_moveit_actions</build_depend>
  <build_depend>moveit_ros_planning_interface</build_depend>
  <build_depend>moveit_visual_tools</build_depend>

  <run_depend>roscpp</run_depend>
  <run_depend>rospy</run_depend>
  <run_depend>std_msgs</run_depend>
  <run_depend>std_srvs</run_depend>
  <run_depend>geometry_msgs</run_depend>
  <run_depend>romeo_bringup</run_depend>
  <run_depend>romeo_moveit_actions</run_depend>
  <run_depend>romeo_moveit_config</run_depend>
  <run_depend>moveit_ros_planning_interface</run_depend>
  <run_depend>moveit_visual_tools</run_depend>

  <buildtool_depend>catkin</buildtool_depend>
</package>