ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

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

if __name__ == '__main__':

the answer for this is:

Traceback (most recent call last):
  File "/home/paulo/ros_workspace/sandbox/beginner_tutorials/scripts/", 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

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

Ugo gravatar image


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

Question Tools

1 follower


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

Seen: 241 times

Last updated: Apr 08 '13