ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A answers.ros.org
Ask Your Question
0

No module named <my_package>.msg and <mocap>.srv

asked 2015-11-12 11:56:41 -0500

adelleodel gravatar image

updated 2015-11-14 05:01:04 -0500

SOLVED -- UPDATED 14/10/2015

i've followed this tutorial in here. I finally succesfull known node for my_package. Thankyou all. especially ROS developer ^^)b


13/10/2015

Hello there again, after i did success launch again my package with my problem before here . now i got my old problem with python program. I'm not really familiar with python code especially for ROS, so i got confused even after i read this topic problem which solved by reference from here. I still got some confused stuff because now i'm catkinized my friends code from ROS electric (i'm using Indigo), so the directory path maybe got some differences:

  • i have all my python code in :

    my_package
     |- bin/
         |- all my code.py
    

    and i change it to :

      my_package
       |- nodes/
           |- all my code.py
    

i don't know is it different or not.. i just got reference it from my another catkin package which including python in folder "nodes". but i read in here. there's folder named "src" and "scripts". am i doing right thing or not?

  • in that reference website tutorial, said that This paragraph is only necessary for packages which use rosbuild/rosmake. If the package is using catkin it must not use roslib.load_manifest. so, if i deleted it, is it okay?

  • where should i placed my exported python files, if the python code like this :

    import rospy
    import pi_tracker_lib as PTL
    from my_package.msg import Skeleton
    from mocap.srv import *
    import PyKDL as KDL
    from math import copysign
    import time
    

and this is my error in terminal :

    Traceback (most recent call last):
    File "/home/adelleodel/ros/src/my_package/nodes/ZMP_tracker_command.py", line 26, in <module>
     from my_package.msg import Skeleton
    ImportError: No module named my_package.msg
    Traceback (most recent call last):
     File "/home/adelleodel/ros/src/my_package/nodes/ZMP_skelplot2.py", line 47, in <module>
    from mocap.srv import *
    ImportError: No module named mocap.srv
    [tracker_command-1] process has died [pid 5382, exit code 1, cmd /home/adelleodel/ros/src/my_package/nodes/ZMP_tracker_command.py __name:=tracker_command __log:=/home/adelleodel/.ros/log/43be4ef4-8959-11e5-8b17-0185f2817c5b/tracker_command-1.log].
    log file: /home/adelleodel/.ros/log/43be4ef4-8959-11e5-8b17-0185f2817c5b/tracker_command-1*.log
    [ZMP_skelplot-2] process has died [pid 5383, exit code 1, cmd /home/adelleodel/ros/src/my_package/nodes/ZMP_skelplot2.py __name:=ZMP_skelplot __log:=/home/adelleodel/.ros/log/43be4ef4-8959-11e5-8b17-0185f2817c5b/ZMP_skelplot-2.log].
    log file: /home/adelleodel/.ros/log/43be4ef4-8959-11e5-8b17-0185f2817c5b/ZMP_skelplot-2*.log

thankyou for the respond :)


UPDATED

This is CMakeList.txt:

    cmake_minimum_required(VERSION 2.8.3)
    project(my_package)

   find_package(catkin REQUIRED COMPONENTS
   dynamixel_controllers
   dynamixel_driver
   dynamixel_msgs
   geometry_msgs
   joint_state_publisher
   visualization_msgs
   message_generation
   nav_msgs
   openni_tracker
   roscpp
   rospy
   rviz
   std_msgs
   tf
   urdf
   )

  find_package(orocos_kdl REQUIRED)
  find_package(PkgConfig)
  pkg_check_modules(OpenNI REQUIRED libopenni)

  # Find Glut
  find_package(GLUT REQUIRED)

  # Find OpenGL
  find_package(OpenGL REQUIRED) 

  link_directories(
      ${catkin_LIBRARY_DIRS}
      ${orocos_kdl_LIBRARY_DIRS}
      ${OpenNI_LIBRARIES}
      ${GLUT_LIBRARIES}
      ${OPENGL_INCLUDE_DIR}
    )

   find_library(LIBFREENECT_LIBRARY
      NAMES freenect
      PATHS ${LIBFREENECT_LIBRARY_DIRS}
    )

    catkin_package(
       DEPENDS orocos_kdl
    )

    include_directories(${catkin_INCLUDE_DIRS}
                ${OpenNI_INCLUDE_DIRS}
                ${GLUT_INCLUDE_DIRS}
                ${orocos_kdl_INCLUDE_DIRS}
                ${OPENGL_INCLUDE_DIR}
    )

    add_executable(skeleton_tracker2 src/skeleton_tracker.cpp src/KinectController.cpp src/KinectDisplay.cpp)

    target_link_libraries(skeleton_tracker2
      ${catkin_LIBRARIES}
      ${OpenNI_LIBRARIES}
      ${GLUT_LIBRARIES}
      ${OPENGL_LIBRARIES}  
      ${orocos_kdl_LIBRARIES}
    )

    message("DEBUG variable catkin_INCLUDE_DIRS: ${catkin_INCLUDE_DIRS}")
    message("DEBUG variable OpenNI_INCLUDE_DIRS: ${OpenNI_INCLUDE_DIRS}")
    message("DEBUG variable GLUT_INCLUDE_DIRS ...
(more)
edit retag flag offensive close merge delete

Comments

You don't find the respective modules, which points to misconfigured CMakeLists.txt and package.xml. Please post those as well by updating your question above or provide a link to an Online Repo where we can find this.

mgruhler gravatar imagemgruhler ( 2015-11-13 03:08:21 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-11-14 04:59:19 -0500

adelleodel gravatar image

UPDATED

i've solved my problem. the problem is that mocap.srv is not find because i don't have package named 'mocap' (this is my friends project before, using electric ROS. and now i'm re-new it with ROS Indigo. so, i just copying main package of him. mocap is one of package in his workspace). and now i just move the file named *.srv to my srv directory, and change my python code from from mocap.srv import * to from my_package.srv import *

i've read ROS tutorial over and over again. Thankyou ROS developer!!

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-11-12 11:56:41 -0500

Seen: 244 times

Last updated: Nov 14 '15