No Module named 'laser_line_extraction.msg'
Hi All,
I am trying to import a message type from my ROS package 'laser_line_extraction' into my python script that is located in another ROS package called 'drone'.
The first part of my python script that throws the error is as below.
#!/usr/bin/env python
import rospy
from geometry_msgs.msg import PoseStamped
from std_msgs.msg import Int32, Float32
import numpy as np
import message_filters
from laser_line_extraction.msg import LineSegmentList
Running this script gives the error 'no module named 'laser_line_extraction.msg' exists'. However, when I run
rosmsg show laser_line_extraction/LineSegmentList
It gives the correct message format.
Also, the file 'LineSegmentList.msg' is correctly located within a msg folder of laser_line_extraction.
Both 'drone' and 'laser_line_extraction' are ROS packages within the same catkin_ws/src folder. I have ran catkin_make and sourced the devel/setup.bash to no avail.
After seeing this similar post, I tried to follow the instructions and edit my CMakeLists and the package.xml of the drone ROS package and recompile and source the catkin workspace and this didn't work. However, my problem is different as I am trying to access the ROS message from a different package so there is probably something I have missed.
My drone package.xml main body:
<name>drone</name>
<version>0.0.0</version>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>roscpp</build_depend>
<build_depend>std_msgs</build_depend>
<build_depend>image_transport</build_depend>
<build_depend>laser_line_extraction</build_depend>
<build_depend>message_generation</build_depend>
<run_depend>roscpp</run_depend>
<run_depend>std_msgs</run_depend>
<run_depend>image_transport</run_depend>
<run_depend>laser_line_extraction</run_depend>
<run_depend>message_runtime</run_depend>
</package>
My drone CMakeLIsts file:
cmake_minimum_required(VERSION 2.8.3)
project(drone)
find_package(catkin REQUIRED COMPONENTS
laser_line_extraction
message_generation
)
add_message_files(
FILES
LineSegment.msg
LineSegmentList.msg
)
generate_messages(
DEPENDENCIES
laser_line_extraction)
catkin_package(
CATKIN_DEPENDS roscpp std_msgs image_transport laser_line_extraction
)
include_directories(
${catkin_INCLUDE_DIRS}
)
I am running Ubuntu 16.04 and ROS kinetic using Python 2.7