Writing a ros node with both a publisher and subscriber?
<p>I am currently trying to make a ROS node in Python which has both a subscriber and a publisher.</p>

<p>I've seen examples where a message is published within the callback, but I want it to "constantly" publish messages, and perform callbacks when it is the case. </p>

<p>Here is how I do it now: </p>

<pre><code>#!/usr/bin/env python

import rospy
from std_msgs.msg import Empty
from std_msgs.msg import String
import numpy as np

pub = rospy.Publisher('/status', String, queue_size=1000)

def callback(data):
    print "Message received"

def listener():

    rospy.init_node('control', anonymous=True)

    rospy.Subscriber('control_c', Empty, callback)
    rospy.spin()

if __name__ == '__main__':
    print "Running"
    listener()
</code></pre>

<p>So where should I publish?</p>