rospy parameter API:
http://wiki.ros.org/rospy/Overview/Pa...
roscpp parameter API:
http://wiki.ros.org/roscpp/Overview/P...
rospy example (note, I have not tried running this code):
import rospy
rospy.init_node('my_node_name')
# Open .urdf and save contents as str
urdf_filename = "robot.urdf"
urdf_string = None
with open(urdf_filename) as urdf_file:
urdf_string = urdf_file.read()
# Load urdf_string onto parameter server
if urdf_string is not None:
rospy.set_param('robot_description', urdf_filename)
# Check
if not rospy.has_param('robot_description'):
rospy.login("Cannot find 'robot_description' on parameter server")
else:
urdf_string_param = rospy.get_param('robot_description')
rospy.login(urdf_string_param )
How about using a launch file?
I have mentioned it clearly in the question that I am not looking to set the parameter from a launch file. It is not suitable for my purpose.
Yeah, guess I missed that. Why not?
The reason is that I get the 'robot_name' from a rostopic inside the ros node and then I need to load the appropriate urdf file as parameter:"robot_description", depending on the robot_name