ros-drivers / rosserial

A ROS client library for small, embedded devices, such as Arduino. See: http://wiki.ros.org/rosserial
517 stars 525 forks source link

rosserial/rosserial_python/src/rosserial_python/SerialClient.py: 173 has a BUG #503

Open oyoungs opened 4 years ago

oyoungs commented 4 years ago

rosserial/rosserial_python/src/rosserial_python/SerialClient.py: 173 has a BUG

    def callback(self, req):
        """ Forward request to serial device. """
        data_buffer = StringIO.StringIO()
        req.serialize(data_buffer)
        self.response = None
        if self.parent.send(self.id, data_buffer.getvalue()) >= 0:
            while self.response is None:
                pass
        return self.response

the code self.parent.send(self.id, data_buffer.getvalue()) >= 0 will be always False, because the send function has no return:

    def send(self, topic, msg):
        """
        Queues data to be written to the serial port.
        """
        self.write_queue.put((topic, msg))
mtfrsantos commented 4 years ago

I really thank you for finding the source of the error, it helped me and my team a lot! I just put "return 1;" in the end of the send function and solved most of my problems. I know this is not a real solution, but it works.