Is there a method to add ros path in python scripts?
Well, I'm tring to start a launch file in python like this example:
import roslaunch
import rospy
rospy.init_node('en_Mapping', anonymous=True)
uuid = roslaunch.rlutil.get_or_generate_uuid(None, False)
roslaunch.configure_logging(uuid)
launch = roslaunch.parent.ROSLaunchParent(uuid, ["/home/haier/catkin_ws/src/testapi/launch/test_node.launch"])
launch.start()
rospy.loginfo("started")
rospy.sleep(3)
# 3 seconds later
launch.shutdown()
but if execute the python directly it will tell that some pkg or node not found in ros path, so we have to source devel/setup.bash in our workspace dir at the beginning. But if I have two workspace ,and there is two different node with the same name, it is likely not able to source both two workspace. Is there any method to add ros path in python scritpts so that I could control the find_pkg path in my code block?