Command line parameter server while using launch files?
Hi,
I have written a simple talker node that get the publishing rate (ie. value for rospy.Rate() ) using a command line parameter server. When I run the file using rosrun and give the command line parameter it works fine.
Snippet of program:
if rospy.has_param('~rate'):
ra = rospy.get_param('~rate')
else:
rospy.logwarn('no parameter given; using the default value %d' %ra)
rate = rospy.Rate(ra)
Command:
rosrun performance_test py_publisher.py _rate:=50
Now the program publishes at 50Hz.
But I am using a launch file to initiate a talker and a listener node at the same time. Is there any way that I can use some command line parameter so that I can vary the rate every time without having to change the program ?
<launch>
<node name='py_publisher_node' pkg='performance_tests' type='py_publisher.py' output='screen' />
<node name='py_subscriber_node' pkg='performance_tests' type='py_subscriber.py' output='screen' />
</launch>