1
$\begingroup$

Rosanswers logo

Want to publish() in main and also in child thread on one rospy.Publisher(),is this safe?


Originally posted by dyan on ROS Answers with karma: 7 on 2017-03-17

Post score: 0

$\endgroup$

1 Answer 1

1
$\begingroup$

Rosanswers logo

Yes, rospy.Publisher() is thread safe.

Before publishing a message it acquires a lock for thread safety and releases it after the message is sent.

You can see the source code here: http://docs.ros.org/api/rospy/html/rospy.topics-pysrc.html#Publisher.publish


Originally posted by Martin Peris with karma: 5625 on 2017-03-17

This answer was ACCEPTED on the original site

Post score: 2

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.