42 import test_rosmaster.msg
52 def chained_callback(data):
54 if isinstance(data, test_rosmaster.msg.TestHeader):
56 new_data = test_rosmaster.msg.TestHeader()
58 new_data.header.stamp = Time(1234, 5678)
60 new_data.header.frame_id = 1234
62 new_data = test_rosmaster.msg.TestHeader(
None, rospy.caller_id(), data.auto)
64 data.caller_id = rospy.caller_id()
69 string_out = rospy.Publisher(
"test_string_out", test_rosmaster.msg.TestString)
70 primitives_out = rospy.Publisher(
"test_primitives_out", test_rosmaster.msg.TestPrimitives)
71 arrays_out = rospy.Publisher(
"test_arrays_out", test_rosmaster.msg.TestArrays)
72 header_out = rospy.Publisher(
"test_header_out", test_rosmaster.msg.TestHeader)
75 rospy.Subscriber(
"test_string_in", test_rosmaster.msg.TestString,
chain_callback(string_out))
76 rospy.Subscriber(
"test_primitives_in", test_rosmaster.msg.TestPrimitives,
chain_callback(primitives_out))
77 rospy.Subscriber(
"test_arrays_in", test_rosmaster.msg.TestArrays,
chain_callback(arrays_out))
78 rospy.Subscriber(
"test_header_in", test_rosmaster.msg.TestHeader,
chain_callback(header_out))
81 probe_in = rospy.Subscriber(
"probe_topic", test_rosmaster.msg.TestString)
86 if __name__ ==
'__main__':
def chain_callback(pub)
pass-through callback that republishes message on pub.