Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Large delay in recieving messages from Roomba #68

Open
blaine141 opened this issue Jun 17, 2022 · 1 comment
Open

Large delay in recieving messages from Roomba #68

blaine141 opened this issue Jun 17, 2022 · 1 comment

Comments

@blaine141
Copy link

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.

@jacobperron
Copy link
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
Projects
None yet
Development

No branches or pull requests

2 participants