ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can make new thread in your Python program and have it call a function called callback that doesn't take inputs.

def callback():
    while True:
        crunchData()

# ... somewhere in the daemon startup code ...
t = threading.Thread(target=callback)
t.daemon = True
t.start()

https://stackoverflow.com/questions/19600737/how-to-use-daemon-that-has-a-while-loop?noredirect=1&lq=1

I copied over the sample example you might want to reference for what you want to do.

You can make a new thread in your Python program and have it call a function called callback that doesn't take inputs.

def callback():
    while True:
        crunchData()

# ... somewhere in the daemon startup code ...
t = threading.Thread(target=callback)
t.daemon = True
t.start()

https://stackoverflow.com/questions/19600737/how-to-use-daemon-that-has-a-while-loop?noredirect=1&lq=1

I copied over the sample example you might want to reference for what you want to do.