Skip to content

Large delay in recieving messages from Roomba #68

Open

Description

@blaine141

I am using libcreate on a Raspberry Pi Zero W to communicate with a Roomba 694. I am noticing a delay of 30 seconds to 2 minutes for messages coming from the Roomba. Looking at the code this delay appears to be coming from messages coming in faster than they can be processed and filling up the serial buffer. My application uses stream mode as it is a V3 device.

I know my case is extreme and most people will not be using 1-core systems. I still feel like this is not the correct way to implement receiving messages from the Roomba. We should be fetching the newest message from the Roomba rather than the oldest message in the buffer.

As a temporary workaround, I have been clearing the buffer after each message is received and the delay has diappeared. I have not fully tested to see if half messages are coming through and being marked as corrupted.

What would be the best way to ensure each message we process is the latest from the Roomba and any older messages are discarded?

Also anyone else jump in if you have experienced this.

Activity

  1. jacobperron commented on Oct 4, 2022

    @jacobperron
    Member

    I'm not sure what the best strategy is for your setup, but one idea is we could add an option to use the serial "query" mode, even though you have a V3 device (which I think should still work). For example, instead of only using the protocol version here to choose the serial mode, we could add an option to override the choice:

    libcreate/src/create.cpp

    Lines 47 to 52 in d75d41c

    if (model.getVersion() == V_1) {
    serial = std::make_shared<SerialQuery>(data, install_signal_handler);
    } else {
    serial = std::make_shared<SerialStream>(
    data, create::util::STREAM_HEADER, install_signal_handler);
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions