5
$\begingroup$

I've notice the IRobot Create 2 does not respond to the app's commands when it has been sleeping. If I press the Clean button and re-run the app then the robot is responsive to the commands.

My initialization sequence (Android/Java) using usb-serial-for-android:

port.open(connection);
port.setParameters(115200, 8, UsbSerialPort.STOPBITS_1,UsbSerialPort.PARITY_NONE);
command(Opcode.START);
command(Opcode.SAFE);

The physical architecture is IRobot Create 2 connected by IRobot Serial Cable to Google Project Tango Tablet.

How can my app wake up the Roomba from it's sleep?

$\endgroup$
  • $\begingroup$ removed from the question for clarity... Per the OI [Specs Document][2], it appears that changing the mode to Off would wake up the robot: > Roomba has four operating modes: Off, Passive, Safe, and Full. Roomba powers on in the Off mode. The following commands change Roomba’s OI mode. I'm thinking that is an error in the documentation and they meant to say Roomba powers off? If the docs are correct then perhaps I should change my initialization sequence to the unintuitive: command(Opcode.STOP); command(Opcode.START); command(Opcode.SAFE); $\endgroup$ – Aaron Roller Aug 19 '15 at 17:51
3
$\begingroup$

I have been testing Steve’s answer using the Create cable and Python and have ran into some difficulties.

Enabling hardware flow control when opening the serial port results in nothing happening when sending/receiving data from the Create 2. Page 4 of the guide says “Flow control: None”. While I have never used hardware flow control, I suspect the Create 2 is not properly handling the handshake so data is not flowing properly.

When enabling hardware flow control did not work at the time of opening the connection, I attempted to make use of the setRTS method. (Research into this method and setDTR indicate both are implemented in PySerial.)

I tried the following to see if it would wake the Create 2

serial_port.setRTS(True)
time.sleep(1)
serial_port.setRTS(False)
time.sleep(1)
serial_port.setRTS(True)

where the sleep argument of 1 is in seconds. I also tried the above with the following changes toggling False, True, then False setting the sleep period to .5

In addition, I tried all the above with setDTR(). None of the above worked to wake the Create 2.

Next I tried to something simpler – trying to keep the Create 2 from falling asleep. Based on page 6

“To disable sleep, pulse the BRC pin low periodically before these five minutes expire. Each pulse resets this five minute counter. (One example that would not cause the baud rate to inadvertently change is to pulse the pin low for one second, every minute, but there are other periods and duty cycles that would work, as well.)”

With the Create 2 in Passive mode I tried the following

while True:
    time.sleep(60)
    serial_port.setRTS(True)
    time.sleep(1)
    serial_port.setRTS(False)
    time.sleep(1)
    serial_port.setRTS(True)

This had no effect. I then tried all the permutations as above when trying to wake the Create 2, but none of these had any effect. I did find a pdf guide detailing how to make your own Create cable that indicates the BRC line should be connected to the RTS on the computer side, but it does not seem to work.

$\endgroup$
  • 1
    $\begingroup$ I've been working with a cable I made using the directions here (irobotweb.com/~/media/MainSite/PDFs/About/STEM/Create/…). With this cable, using RTS as I described wakes the robot. After I saw your response, I tried the official Create cable, and found that it does not work the same. Confused, I carefully opened up the cable and I think the orange and green wires are swapped on the PCBA, so it seems there was an assembly error in at least some of these cables. I’d suggest you e-mail create@irobot.com to see if they can help you further. $\endgroup$ – Steve Sep 1 '15 at 15:30
  • $\begingroup$ Also, I added text in my previous answer to reflect this finding. $\endgroup$ – Steve Sep 1 '15 at 15:36
3
$\begingroup$

Roomba goes to sleep to save power after five minutes of inactivity, as detailed in the OI spec (Aug. 10, 2015) on page 6, under "Passive Mode." The documentation is not in error where you have quoted it, as Roomba powers on with the OI off (and not in passive, safe, or full). If you want your robot to never fall asleep, put it into FULL. If you want the robot to wake up, instead, simply pulse the BRC pin before communicating, as detailed in the same passage as mentioned above. If you are using a USB to Create cable, one easy way to do this would be to open your serial port with hardware flow control, as the Roomba's BRC is attached to RTS on the computer side, and so when characters are Ready To Send, the BRC will be pulsed. It appears that at least some of the official Create to USB cables do not properly implement this functionality, but making the cable following the directions on the site does work. The second version of the Create cable, which has a 0.1" header along with a USB A connector in its overmold, has this error corrected. Please note that I am an iRobot employee, but the postings on this site are my own and don't necessarily represent iRobot's positions, strategies, or opinions.

$\endgroup$
  • $\begingroup$ Steve, thanks. Trying to WAKE UP the robot using the BRC pulse as you describe, I added port.setRTS(true); before and after opening the connection, but neither attempts woke up the robot. Upon further inspection the setRTS method is a blank. goo.gl/w1b8yk Any clarity you can provide about how to use the library to "open your serial port with hardware flow control" is appreciated. $\endgroup$ – Aaron Roller Aug 19 '15 at 15:24
  • $\begingroup$ A couple thoughts. First, I don't code much in Java, and this isn't my library, so the first thing to do would be to put in an issue against the library for the maintainer to fill out the setRTS method. Hopefully, they'll just add it in, and then you'll be golden. It looks like there is a setDTR() method; it might be worth trying that, as well (though the DTR output is not hooked up in the cable, who knows what the Java library is doing). Second, the line needs to be pulsed, but it looks like that method just sets the pin high, so I'd suggest trying setting true, then false, then true. $\endgroup$ – Steve Aug 19 '15 at 15:48
  • 1
    $\begingroup$ It looks like there are already issues against the library relevant to your trouble -- they are numbers 13 (github.com/mik3y/usb-serial-for-android/issues/13), 41 (github.com/mik3y/usb-serial-for-android/issues/41), and 58 (github.com/mik3y/usb-serial-for-android/issues/58). I'd just register your desire for the maintainer in one of those. $\endgroup$ – Steve Aug 19 '15 at 15:54
  • $\begingroup$ The setDTR method is also a blank. I will do as you suggest and reference this discussion with the library maintainers. I'm leaving the issue open until I have the power up working. Thanks again. $\endgroup$ – Aaron Roller Aug 19 '15 at 17:03
  • $\begingroup$ No problem; I'm sorry I couldn't be more helpful. I agree that you should leave this open until it's working the way you expect! $\endgroup$ – Steve Aug 19 '15 at 17:05
2
$\begingroup$

Steve is right: orange and green wires are swapped in the official Create cable. If you swap the two wires the robot will wake up as soon as BRC is brought to zero.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.