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

Revision history [back]

click to hide/show revision 1
initial version

I am still don't know the reason for that problem but I fixed it.

Now I am able to launch a python node with internal modules in "/scripts" folder as explained in ROS python guide.

For fixing it I have to do two things:

  • Add a dependency to himself in "manifest.xml" of the package
  • Add "script" directory to python path in execution.
  <depend package="std_msgs"/>
  <depend package="rospy"/>
  <depend package="roscpp"/>
  <depend package="tf"/>
  <depend package="smartcam_msgs"/>
  <depend package="anchor_mod"/>

For adding "/scripts" to python path when the node starts I have created a module named "rospy_helper". And I use it before importing "roslib" and "rospy".

 import rospy_helper; rospy_helper.add_modules_to_path();

 import roslib; roslib.load_manifest('anchor_mod')
 import rospy

Although I have solved the problem, if someone knows the reason please explain me. I would like to understand what is really happening. Thanks.

I am still don't know the reason for that problem but I fixed it.

Now I am able to launch a python node with internal modules in "/scripts" folder as explained in ROS python guide.

For fixing it I have to do two things:

  • Add a dependency to himself in "manifest.xml" of the package
  • Add "script" directory to python path in execution.
  <depend package="std_msgs"/>
  <depend package="rospy"/>
  <depend package="roscpp"/>
  <depend package="tf"/>
  <depend package="smartcam_msgs"/>
  <depend package="anchor_mod"/>

For adding "/scripts" to python path when the node starts I have created a module named "rospy_helper". And I use it before after importing "roslib" and "rospy".

 import rospy_helper; rospy_helper.add_modules_to_path();

 import roslib; roslib.load_manifest('anchor_mod')
 import rospy

 import rospy_helper; rospy_helper.add_modules_to_path();

Although I have solved the problem, if someone knows the reason please explain me. I would like to understand what is really happening. Thanks.

I am still don't know the reason for that problem but I fixed it.

Now I am able to launch a python node with internal modules in "/scripts" folder as explained in ROS python guide.

For fixing it I have to do two things:

  • Add a dependency to himself in "manifest.xml" of the package
  • Add "script" directory to python path in execution.
  <depend package="std_msgs"/>
  <depend package="rospy"/>
  <depend package="roscpp"/>
  <depend package="tf"/>
  <depend package="smartcam_msgs"/>
  <depend package="anchor_mod"/>
  • And add "/script" directory to python path in execution.

For adding "/scripts" to python path when the node starts solving the second point I have created a module named "rospy_helper". And "rospy_helper" that adds the "/scripts" directory to python path when the node starts. I use it after importing "rospy".

 import roslib; roslib.load_manifest('anchor_mod')
 import rospy

 import rospy_helper; rospy_helper.add_modules_to_path();

Although I have solved the problem, if someone knows the reason please explain me. I would like to understand what is really happening. Thanks.