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/Create%20your%20new%20rqt%20plugin
http://answers.ros.org/question/11794/how-can-i-use-custom-python-functions-in-other-ros-packages/
http://docs.ros.org/api/catkin/html/howto/format2/installing_python.html
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
/install
/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:
rqt_mypkg 0.0.0 The rqt_mypkg package catkin rospy rqt_gui rqt_gui_py message_generation flexbotics_control_nextage_teleop_ps3 rospy rqt_gui rqt_gui_py flexbotics_control_nextage_teleop_ps3 message_runtime
-----------------------------------------------------------------------------------------------
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)
------------------------------------------------------------------------------------------------
Errors:
RosPluginProvider.load(rqt_mypkg/My Plugin) exception raised in __builtin__.__import__(rqt_mypkg.my_module, [MyPlugin]):
Traceback (most recent call last):
File "/opt/ros/hydro/lib/python2.7/dist-packages/rqt_gui/ros_plugin_provider.py", line 77, in load
module = __builtin__.__import__(attributes['module_name'], fromlist=[attributes['class_from_class_type']], level=0)
File "/home/robin/catkin_ws_ruben/src/rqt_mypkg/src/rqt_mypkg/my_module.py", line 21, in
from flexbotics_control_nextage_teleop_ps3 import hiro_motion_savingpointsxml
ImportError: No module named flexbotics_control_nextage_teleop_ps3
PluginManager._load_plugin() could not load plugin "rqt_mypkg/My Plugin":
Traceback (most recent call last):
File "/opt/ros/hydro/lib/python2.7/dist-packages/qt_gui/plugin_handler.py", line 98, in load
self._load()
File "/opt/ros/hydro/lib/python2.7/dist-packages/qt_gui/plugin_handler_direct.py", line 54, in _load
self._plugin = self._plugin_provider.load(self._instance_id.plugin_id, self._context)
File "/opt/ros/hydro/lib/python2.7/dist-packages/qt_gui/composite_plugin_provider.py", line 71, in load
instance = plugin_provider.load(plugin_id, plugin_context)
File "/opt/ros/hydro/lib/python2.7/dist-packages/qt_gui/composite_plugin_provider.py", line 71, in load
instance = plugin_provider.load(plugin_id, plugin_context)
File "/opt/ros/hydro/lib/python2.7/dist-packages/rqt_gui_py/ros_py_plugin_provider.py", line 60, in load
return super(RosPyPluginProvider, self).load(plugin_id, plugin_context)
File "/opt/ros/hydro/lib/python2.7/dist-packages/qt_gui/composite_plugin_provider.py", line 71, in load
instance = plugin_provider.load(plugin_id, plugin_context)
File "/opt/ros/hydro/lib/python2.7/dist-packages/rqt_gui/ros_plugin_provider.py", line 83, in load
raise e
ImportError: No module named flexbotics_control_nextage_teleop_ps3
Thanks for your time
↧