Could not find your msg 'messageType' after following ros wiki tutorial step by step.
So I had some trouble with using a custom message type, that's why I decided to follow the tutorials on RosWiki (http://wiki.ros.org/ROS/Tutorials). Unfortunately, this didn't work either. After rosmsg show messageType.msg
it outputted: Could not find msg 'messageType'
I hope that I didn't put too much code :)
I am using Ros Melodic on Ubuntu 18.04 (bionic).
The file 'messageType.msg':
string name
uint32 age
The package.xml file:
<?xml version="1.0"?>
<package format="2">
<name>pack</name>
<version>0.0.0</version>
<description>The description sentence</description>
<maintainer email="max@todo.todo">max</maintainer>
<license>TODO</license>
<build_depend>message_generation</build_depend>
<exec_depend>message_runtime</exec_depend>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>roscpp</build_depend>
<build_depend>rospy</build_depend>
<build_depend>std_msgs</build_depend>
<build_export_depend>roscpp</build_export_depend>
<build_export_depend>rospy</build_export_depend>
<build_export_depend>std_msgs</build_export_depend>
<exec_depend>roscpp</exec_depend>
<exec_depend>rospy</exec_depend>
<exec_depend>std_msgs</exec_depend>
<!-- The export tag contains other, unspecified, tags -->
<export>
<!-- Other tools can request additional information be placed here -->
</export>
</package>
The CMakeLists.txt file:
cmake_minimum_required(VERSION 3.0.2)
project(pack)
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
message_generation
)
add_message_files(
FILES
messageType.msg
)
generate_messages(
DEPENDENCIES
std_msgs
)
catkin_package(
CATKIN_DEPENDS message_runtime
)
include_directories(
# include
${catkin_INCLUDE_DIRS}
)
Don't put all the comments in your code, it makes it harder to read the code, I've removed it for you.
Where is your file
messageType.msg
? Is it in a foldermsg
(or another name that you chose ?), you might need to addDIRECTORY msg
(msg or the name you chose) inadd_message_files
.Moreover have you compiled and sourced before trying to find the message ?
messageType.msg
is indeed in a foldermsg
and I've addedDIRECTORY msg
toadd_message_files
as you said, but afterrosmsg show messageType.msg
, it still outputsCould not find msg 'messageType'
. Oh, and yes, I compiled and sourced before trying.You might need to add more context to your issue because I couldn't reproduce it. I managed to have
rosmsg
working using yourCmakeLists.txt
andpackage.xml
. I only have your issue when I don't source the catkin workspace, what is your output ofrosmsg show pack/messageType
? When you typerosmsg show
and then tabulate, is your packagepack
in the list ?When I type
rosmsg show
and then tabulate it, my packagepack
is not in the list.what is your output of rosmsg show pack/messageType ? I get an error, it is too long for a comment so I'll post it in the next comment
If you don't have your package in the list then you don't have sourced your workspace, have you really done
source devel/setup.bash
? What is the value of the environment variableROS_PACKAGE_PATH
?I'll just post the beginning, because when I try to post the full error, I get a message saying "This content is forbidden".
About the sourcing of the workspace. I did
source /opt/ros/melodic/setup.bash
. When I try to dosource devel/setup.bash
, I get this output:bash: devel/setup.bash: No such file or directory
, but i do have adevel space
so I don't know what's causing this problem.