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

Python package anomoly

asked 2012-02-24 06:02:22 -0600

cassander gravatar image

updated 2014-01-28 17:11:28 -0600

ngrennan gravatar image
from std_msgs.msg import String

when ROS encounters a statement like the one above, where does it search, to obtain String class? I check $PYTHONPATH and it doesn't seem like the class exists in a file located in that path. I searched the ROS package std_msgs..but it only shows a folder msg that has the String.msg file in it. I don't see any module called 'msg' in which I expect to find the 'String' class..

Could someone please tell me whats going on? Am I missing something fundamental or are things really twisted a little bit.. ?

Thanks

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2012-02-24 06:57:15 -0600

DimitriProsser gravatar image

updated 2012-02-24 06:58:03 -0600

Look in the std_msgs package in the src directory. When messages are generated, the resulting python module is placed in the src folder in a subdirectory with the same name as the package. So the full file path on my machine is:

/opt/ros/electric/stacks/ros_comm/messages/std_msgs/src/std_msgs
edit flag offensive delete link more
1

answered 2012-02-24 07:26:06 -0600

To add to what DimitriProsser said, when you do roslib.load_manifest('my_package'), it alters your sys.path and add the appropriate paths so python is able to do the imports.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-02-24 06:02:22 -0600

Seen: 286 times

Last updated: Feb 24 '12