Ask Your Question
0

How to import sr_robot_msgs in Python

asked 2013-04-08 08:24:03 -0500

phmferreira gravatar image

updated 2014-01-28 17:16:05 -0500

ngrennan gravatar image

I tried to run this code but doesn't work.


#!/usr/bin/env python

import roslib; roslib.load_manifest('rospy_tutorials')

import rospy
from std_msgs.msg import *
from stacks.shadow_robot.sr_robot_msgs.msg import JointControllerState

def callback(data):
    rospy.loginfo(rospy.get_caller_id()+"I heard %s", data)

def listener():

    rospy.init_node('listener', anonymous=True)

    rospy.Subscriber("sh_ffj3_mixed_position_velocity_controller/command", JointControllerState, callback)

    # spin() simply keeps python from exiting until this node is stopped
    rospy.spin()

if __name__ == '__main__':
    listener()

the answer for this is:


Traceback (most recent call last):
  File "/home/paulo/ros_workspace/sandbox/beginner_tutorials/scripts/listener.py", line 7, in <module>
    from stacks.shadow_robot.sr_robot_msgs.msg import JointControllerState
ImportError: No module named stacks.shadow_robot.sr_robot_msgs.msg

How to import sr_robot_msgs?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-04-08 21:46:09 -0500

Ugo gravatar image

Hi,

To import it as for any other packages, make sure it is listed in the dependencies in your package manifest.xml.

Then the correct line is:

from sr_robot_msgs.msg import JointControllerState
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: 2013-04-08 08:24:03 -0500

Seen: 118 times

Last updated: Apr 08 '13