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

Can Create be woken up programmatically? #18

Open
jacobperron opened this issue May 20, 2016 · 4 comments
Open

Can Create be woken up programmatically? #18

jacobperron opened this issue May 20, 2016 · 4 comments

Comments

@jacobperron
Copy link
Member

When the driver is running the Create can be switched into Passive mode in which the robot goes to sleep to preserve power after 5min. The Create can be awakened manually by pressing the power button and the driver does not seem to have a problem. However it would be nice if the driver could be the one to wake the robot.

Not sure if this is possible, but when I have time I'll try experimenting with the OFF mode, POWER opcode, and emulating button presses.

@hcl337
Copy link

hcl337 commented Mar 20, 2018

I wanted to second this. Has anyone else figured out how to bring it out of passive mode programmatically? We are doing a long running program and every while, it gets stuck in sleep mode and we can't get it to turn back on with the library.

We saw a possible issue with the BRC and RTC wires being hooked up incorrectly in the Serial cable from iRobot so it doesn't get a wakeup command, but are not clear that it is a hardware issue as opposed to just failing to send a command which would trigger a wakeup.

It seems that we have to have a trigger that turns it back on. In the docs, it says it listens for a wake up on the BRC/RTS line. If that is not being triggered by libcreate, then that would possible cause the issue.

@jacobperron
Copy link
Member Author

@hcl337 Perhaps with a proper Serial cable it is possible, but I think the necessary wakeup command would need to be added to libcreate.

@jacobperron
Copy link
Member Author

jacobperron commented Mar 29, 2018

@hcl337 I attempted your suggestion for hardware flow control mentioned in create_autonomy #47, but I guess it requires a proper BRC/RTC connection. I'm not sure if my cable is connected properly. With hardware flow control I can't communicate with Create 2.

@hcl337
Copy link

hcl337 commented Mar 29, 2018

@jacobperron I have run in to the same problem (Literally coding on it now). I contacted iRobot this week and they said that the cables are "correctly wired" for the versions I have. Reading around a bunch, it seems that the create does not fully implement hardware flow control. Instead, they mis-use the wire to toggle their microprocessor on.

Also, make sure to check out the CMake file as it references libcreate 1.3.0 so any new changes don't apply (That was my mistake before where I thought I had forked and was compiling my new code.

I have figured out how to directly toggle the pins and added this to serial.cpp:

  // This directly sets the pins up and down
  //https://stackoverflow.com/questions/30618678/boostasioserial-port-set-rts-dts
  void Serial::setRTS(bool enabled)
  {
      int fd = port.native_handle();
      int data = TIOCM_RTS;
      if (!enabled)
          ioctl(fd, TIOCMBIC, &data);       
      else
          ioctl(fd, TIOCMBIS, &data);
  }

  void Serial::setDTR(bool enabled)
  {
      int fd = port.native_handle();
      int data = TIOCM_DTR;
      if (!enabled)
          ioctl(fd, TIOCMBIC, &data);        // Clears the RTS pin
      else
          ioctl(fd, TIOCMBIS, &data);        // Sets the RTS pin
  }

And then in create.cpp added:

  void Create::keepAlive() {
    CERR("[create:keep alive]","        Triggering RTS pin false then true");
    serial->setRTS(false);
    usleep( 1000000 / 2 );
    serial->setRTS(true);
  }

I can see it turning the orange LED off on the create cable so can confirm I am actually doing a hardware change but am still having some instability so can't prove it is the actual final answer, but it seems to work way better for at least doing something.

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