Importing python module from another ROS package. (Hydro) [closed]
I followed tutorials and other questions relationated with this topic but I can't figure what I'm doing wrong.
http://wiki.ros.org/rqt/Tutorials/Cre...
http://answers.ros.org/question/11794...
http://docs.ros.org/api/catkin/html/h...
I sourced it ( devel/setup.bash in catkin_ws_ruben )
echo $ROS_PACKAGE_PATH
/home/robin/catkin_ws_ruben/src:/opt/ros/hydro/share:/opt/ros/hydro/stacks
and do also catkin_make clean
My problem:
I want to include this node on my my_module.py
from flexbotics_control_nextage_teleop_ps3 import hiro_motion_savingpointsxml
and show me ImportError: No module named flexbotics_control_nextage_teleop_ps3.
/catkin_ws_ruben
/build
/devel
/src
/flexbotics_control_nextage_teleop_ps3
/scripts
|.....
|__init__.py
/src
/flexbotics_control_nextage_teleop_ps3
|hiro_motion_savingpointsxml.py
|__init__.py
/config
/launch
setup.py
__init__.py
CMakeLists.txt
/rqt_mypkg
/scripts
/src
/rqt_mypkg
|my_module.py
|my_module.pyc
|__init__.py
/resource
|MyPlugin.ui
setup.py
__init__.py
package.xml
CMakeLists.txt
rqt_mypkg:
CMakeList
cmake_minimum_required(VERSION 2.8.3)
project(rqt_mypkg)
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
rospy
rqt_gui
rqt_gui_py
std_msgs
flexbotics_control_nextage_teleop_ps3
)
catkin_python_setup()
## Generate added messages and services with any dependencies listed here
generate_messages(
DEPENDENCIES
std_msgs # Or other packages containing msgs
)
###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if you package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES rqt_mypkg
# CATKIN_DEPENDS rospy rqt_gui rqt_gui_py
# DEPENDS system_lib
CATKIN_DEPENDS message_runtime
)
###########
## Build ##
###########
## Specify additional locations of header files
## Your package locations should be listed before other locations
# include_directories(include)
include_directories(
${catkin_INCLUDE_DIRS}
)
install(PROGRAMS src/rqt_mypkg/my_module.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
package:
<?xml version="1.0"?>
<package>
<name>rqt_mypkg</name>
<version>0.0.0</version>
<description>The rqt_mypkg package</description>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>rospy</build_depend>
<build_depend>rqt_gui</build_depend>
<build_depend>rqt_gui_py</build_depend>
<build_depend>message_generation</build_depend>
<build_depend>flexbotics_control_nextage_teleop_ps3</build_depend>
<run_depend>rospy</run_depend>
<run_depend>rqt_gui</run_depend>
<run_depend>rqt_gui_py</run_depend>
<run_depend>flexbotics_control_nextage_teleop_ps3</run_depend>
<run_depend>message_runtime</run_depend>
<!-- The export tag contains other, unspecified, tags -->
<export>
<rqt_gui plugin="${prefix}/plugin.xml"/>
</export>
</package>
setup.py
#!/usr/bin/env python
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
d = generate_distutils_setup(
packages=['rqt_mypkg'],
package_dir={'': 'src'}
)
setup(**d)
flexbotics_control_nextage_teleop_ps3 package:
setup.py:
#!/usr/bin/env python
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
d = generate_distutils_setup(
packages=['flexbotics_control_nextage_teleop_ps3'],
package_dir={'': 'src'}
)
setup(**d)
CMakeList:
cmake_minimum_required(VERSION 2.8.3)
project(flexbotics_control_nextage_teleop_ps3)
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
joy
moveit_commander
moveit_msgs
roscpp
rospy
std_msgs
message_generation
)
## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)
## Uncomment this if the package has a setup.py. This macro ensures
## modules and global scripts declared therein get installed
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
# catkin_python_setup()
################################################
## Declare ROS messages, services and ...
Can you post the CMakeLists.txt and setup.py of the flexbotics_control_nextage_teleop_ps3 package? Also, try
Make sure you sourced
devel/setup.bash
incatkin_ws_ruben
, that should put your package directory intoPYTHONPATH
(it's not clear from your post).I try from flexbotics_control_nextage_teleop_ps3.hiro_motion_savingpointsxml import * and same error:
ImportError: No module named flexbotics_control_nextage_teleop_ps3.hiro_motion_savingpointsxml
Moreover, if i run both (rqt and my node) , without flexbotics_control_nextage_teleop_ps3 import hiro_motion_savingpointsxml it work perfect.
I did it some time ago "sourced devel/setup.bash"
echo $ROS_PACKAGE_PATH /home/robin/catkin_ws_ruben/src:/opt/ros/hydro/share:/opt/ros/hydro/stacks