How to include generated .h action files? [closed]

asked 2020-06-03 08:12:59 -0500

MartensCedric gravatar image

updated 2020-06-03 08:17:26 -0500

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?

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by MartensCedric
close date 2020-06-03 12:43:38.917047

Comments

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

MartensCedric gravatar image MartensCedric  ( 2020-06-03 08:15:36 -0500 )edit

By adding add_dependencies(planner-server ${cuarl_rover_planner_EXPORTED_TARGETS}), I do solve this issue but now im getting an undefined reference to `ros::init(int&, char**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int)'

MartensCedric gravatar image MartensCedric  ( 2020-06-03 09:00:46 -0500 )edit