How to include generated .h action files? [closed]
ifndef TRAJECTORYACTION_HPP
#define TRAJECTORYACTION_HPP
#include <ros/ros.h>
#include <actionlib/server/simple_action_server.h>
#include <string>
#include <cuarl_rover_planner/RoverPlannerAction.h>
namespace cuarl_rover_planner{
class TrajectoryAction {
protected:
ros::NodeHandle nh;
actionlib::SimpleActionServer<cuarl_rover_planner::RoverPlannerAction> as;
public:
TrajectoryAction(ros::NodeHandle& nh);
};
}
#endif //TRAJECTORYACTION_HPP
When I run catkin_make
with my code above, I obtain this error.
/opt/ros/kinetic/include/actionlib/server/simple_action_server.h: In instantiation of ‘class actionlib::SimpleActionServer<cuarl_rover_planner::trajectoryaction>’: /home/cedric/catkin_ws/src/cuarl_rover_planner/cuarl_rover_planner/src/rover_planner/../../include/trajectory-action.hpp:17:53: required from here /opt/ros/kinetic/include/actionlib/action_definition.h:43:50: error: no type named ‘_action_goal_type’ in ‘class cuarl_rover_planner::TrajectoryAction’ typedef typename ActionSpec::_action_goal_type ActionGoal; \
This is because it is looking in the src folder, but this file does exist in ~/catkin_ws/devel/include/cuarl_rover_planner
. The .h file is found in devel since it's generated from my .action file.
How do I properly include my action file into my project?
So I figured out my main issue, it was that I was looking into cuarl-rover-planner instead of cuarl_rover_planner, but I still have another issue related to this problem. I edited the question
By adding
add_dependencies(planner-server ${cuarl_rover_planner_EXPORTED_TARGETS})
, I do solve this issue but now im getting anundefined reference to `ros::init(int&, char**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int)'