Message type can't be found with catkin_make
So I'm trying to make a publisher to publish some data from a speed controller and I know how I can get the data. I decided to use a custom message almost the same to the Pose.msg in turtlesim (with fewer fields). However whenever I run catkin make I get this error.
/home/ros/catkin_ws/src/bot/src/wheeldata.cpp: In function ‘int main(int, char**)’:
/home/ros/catkin_ws/src/bot/src/wheeldata.cpp:19:36: error: ‘Pose’ was not declared in this scope
/home/ros/catkin_ws/src/bot/src/wheeldata.cpp:19:36: note: suggested alternative:
/home/ros/catkin_ws/devel/include/bot/Pose.h:85:45: note: ‘bot::Pose’
/home/ros/catkin_ws/src/bot/src/wheeldata.cpp:19:59: error: no matching function for call to ‘ros::NodeHandle::advertise(const char [10], int)’
/home/ros/catkin_ws/src/bot/src/wheeldata.cpp:19:59: note: candidates are:
/opt/ros/hydro/include/ros/node_handle.h:236:15: note: template<class M> ros::Publisher ros::NodeHandle::advertise(const string&, uint32_t, bool)
/opt/ros/hydro/include/ros/node_handle.h:300:13: note: template<class M> ros::Publisher ros::NodeHandle::advertise(const string&, uint32_t, const SubscriberStatusCallback&, const SubscriberStatusCallback&, const VoidConstPtr&, bool)
/home/ros/catkin_ws/src/bot/src/wheeldata.cpp:29:8: error: expected ‘;’ before ‘p’
/home/ros/catkin_ws/src/bot/src/wheeldata.cpp:30:3: error: ‘p’ was not declared in this scope
make[2]: *** [bot/CMakeFiles/wheeldata.dir/src/wheeldata.cpp.o] Error 1
make[1]: *** [bot/CMakeFiles/wheeldata.dir/all] Error 2
make: *** [all] Error 2
Invoking "make" failed
Here is the CMakeList.txt:
cmake_minimum_required(VERSION 2.8.3)
project(bot)
find_package(catkin REQUIRED COMPONENTS
roscpp
std_msgs
message_generation
bot
)
################################################
## Declare ROS messages, services and actions ##
################################################
## Generate messages in the 'msg' folder
add_message_files( DIRECTORY msg
FILES
Pose.msg
)
## Generate added messages and services with any dependencies listed here
#generate_messages(
# DEPENDENCIES
# std_msgs
#)
catkin_package(CATKIN_DEPENDS
roscpp
std_msgs
message_runtime
)
catkin_package()
###########
## Build ##
###########
## Specify additional locations of header files
## Your package locations should be listed before other locations
# include_directories(include)
include_directories(
${catkin_INCLUDE_DIRS}
)
## Add cmake target dependencies of the executable/library
## as an example, message headers may need to be generated before nodes
# add_dependencies(bot_node bot_generate_messages_cpp)
# include_directories(include ${catkin_INCLUDE_DIRS})
add_executable(wheeldata src/wheeldata.cpp)
target_link_libraries(wheeldata ${catkin_LIBRARIES})
add_dependencies(wheeldata bot_generate_messages_cpp)
Here is the package.xml:
<?xml version="1.0"?>
<package>
<name>bot</name>
<version>0.0.0</version>
<description>The bot package</description>
<!-- The *_depend tags are used to specify dependencies -->
<!-- Dependencies can be catkin packages or system dependencies -->
<!-- Examples: -->
<!-- Use build_depend for packages you need at compile time: -->
<build_depend>message_generation</build_depend>
<!-- Use buildtool_depend for build tool packages: -->
<!-- <buildtool_depend>catkin</buildtool_depend> -->
<!-- Use run_depend for packages you need at runtime: -->
<run_depend>message_runtime</run_depend>
<!-- Use test_depend for packages you need only for testing: -->
<!-- <test_depend>gtest</test_depend> -->
<buildtool_depend>catkin</buildtool_depend>
<build_depend>roscpp</build_depend>
<build_depend>rospy</build_depend>
<build_depend>std_msgs</build_depend>
<run_depend>roscpp</run_depend>
<run_depend>rospy</run_depend>
<run_depend>std_msgs</run_depend>
<!-- The export tag contains other, unspecified, tags -->
<export>
<!-- You can specify that this package is a metapackage here: -->
<!-- <metapackage/> -->
<!-- Other tools can ...