def test_publish_to_topics(self):
topic_ending = "desired"
rospy.logdebug("Sleeping for 5 seconds to let ROS spin up...")
rospy.sleep(5)
for variable, value in self.variables:
# Publish to each variable/desired topic to see if all of the
# actuators come on as expected.
topic_string = variable + "/" + topic_ending
rospy.logdebug("Testing Publishing to " + topic_string)
pub_desired = rospy.Publisher(topic_string,
Float64, queue_size=10)
sub_desired = rospy.Subscriber(topic_string, Float64, self.callback)
rospy.sleep(2)
print(self.namespace + "/" + topic_string)
for _ in range(NUM_TIMES_TO_PUBLISH):
pub_desired.publish(value)
rospy.sleep(1)
rospy.sleep(2)
pub_desired.publish(0)
test_pub_desired_topics.py 文件源码
python
阅读 19
收藏 0
点赞 0
评论 0
评论列表
文章目录