[rospy] Refactor talker.py which is rospy test node#864
[rospy] Refactor talker.py which is rospy test node#864wkentaro wants to merge 1 commit intoros:kinetic-develfrom
Conversation
ae142ce to
f1f1228
Compare
- Advertise after rospy.init_node - Use rospy.Timer which is desirable implementation of periodical publishing.
|
Please add more information to the pull request describing why you want this to be changed. |
|
Updated. |
|
I have extracted the fix to the order ( For the different second part using a timer instead of a rate I don't think that either one is better. It just depends on which one fits the use case. Also I don't see this file as an important example. It is not referenced anywhere. So I would think the canonical way to find sample code is the ROS wiki or e.g. the |
|
I think the simpler rate.sleep() approach is simpler and more explicit. The timer class is more "elegant" with less lines of code, in the script but it actually increases the system complexity. The talker.py which is in the tutorials is in rospy_tutorials: https://github.com/ros/ros_tutorials/tree/kinetic-devel/rospy_tutorials Adding a timer based version in the tutorial would be a better place to be an example. |
|
I see. I will send PR to rospy_tutorials. |
|
Sent here: ros/ros_tutorials#34 |
What
publishing.
Why
while not rospy.is_shutdown(), this PR improves the sample code.