Search code examples
pythoncamerarosethernet

Subscribing to url in python/ros (axis_camera)


I do not fully understand the following Python / ROS code. There, images are read from ethernet connected camera and are published with ROS. The code works perfectly fine, but I do not understand the following two lines:

1.) peer_subscribe(): When is this function peer_subscribe() activated? It has to run continuously at the rate of the published image?

2.) StreamThread.start() I cannot find this function? Where is it defined?

Maybe someone knows this repo and can help me.

It is not an issue, therefore I don't want to ask this question on github/issues.

Thanks


Solution

  • I can help you at 2.) the start() method calls the run method of the StreamThread class. In this case the following method:

    def run(self):
        while(True):
            self.stream()
    

    For 1.) the function peer_subscribe(...) is called everytime a node subscribes to the topic. In this case the function is called if a node subscribes the camera data and then the Stream starts publishing wihtin its thread.