Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rospy] Refactor talker.py which is rospy test node #864

Closed
wants to merge 1 commit into from

Conversation

wkentaro
Copy link
Contributor

@wkentaro wkentaro commented Aug 11, 2016

What

  • Advertise after rospy.init_node
  • Use rospy.Timer which is desirable implementation of periodical
    publishing.

Why

  • Advertising after rospy.init causes wrong topic name with private name.
  • This node seems a sample for ROS new users, and using timer is better than while not rospy.is_shutdown(), this PR improves the sample code.

@wkentaro wkentaro force-pushed the refactor-talker_py branch 2 times, most recently from ae142ce to f1f1228 Compare August 11, 2016 18:33
- Advertise after rospy.init_node
- Use rospy.Timer which is desirable implementation of periodical
  publishing.
@dirk-thomas
Copy link
Member

Please add more information to the pull request describing why you want this to be changed.

@wkentaro
Copy link
Contributor Author

Updated.

@dirk-thomas
Copy link
Member

dirk-thomas commented Aug 23, 2016

I have extracted the fix to the order (init before Publisher) into #873.

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 ros_tutorials package.

@tfoote
Copy link
Member

tfoote commented Aug 23, 2016

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.

@wkentaro
Copy link
Contributor Author

wkentaro commented Aug 24, 2016

I see. I will send PR to rospy_tutorials.
Thanks.

@wkentaro
Copy link
Contributor Author

Sent here: ros/ros_tutorials#34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants