Skip to content

emantos/irobotcreate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iRobotCreate

irobotcreate is my attempt to create a Command-based API written in Java for the iRobot Create.

My testing device is a raspberry pi connected to the irobot create via the UART over USB.

I have also tested the API on a Lenovo Laptop connected to the irobot create via UART

How to Use (CLI)

  1. Connect the serial usb cable from computer to robot.
  2. Build the api source code, go to irobotcreate-api directory and mvn clean install
  3. Build the shell source code, go to irobotcreate-shell directory and mvn clean package
  4. Run the shell java -jar target/irobotcreate-shell-1.0-SNAPSHOT-jar-with-dependencies.jar
  5. Choose which serial port to use.

The Shell

  • The first command to be sent should be start followed by safe or full
  • moveto 2000 100 moves the robot 2000mm forward with 100mm/sec velocity
  • turn 180 50 Turn-around using 50mm/sec velocity
  • And many more.

How to Use (programmatically)

  • Import maven dependency to your project

    <dependency>
      <groupId>com.kapre</groupId>
      <artifactId>irobotcreate-api</artifactId>
      <version>1.0-SNAPSHOT</version>
    </dependency>
    <dependency>
      <groupId>com.kapre</groupId>
      <artifactId>irobotcreate-shell</artifactId>
      <version>1.0-SNAPSHOT</version>
    </dependency>
  • In your code, create an instance of the SerialPortConnection (to your serial port), and the IRobotCreate.

    Connection connection = new SerialPortConnection("/dev/ttyUSB0", DEFAULT_TIMEOUT);
    IRobotCreate executor = new IRobotCreate(connection);
    
    executor.init()
  • Create command instance and execute it (always start with start and setFull).

    Command start = CommandFactory.start();
    Command setFull = CommandFactory.setFull();
    Command moveTo = CommandFactory.moveTo(2000, 100);
    
    executor.execute(start);
    executor.execute(setFull);
    executor.execute(moveTo);
  • The CommandFactory is a factory class for all primitive commands supported by iRobot's Create. You can also create composite commands (commands made up of several primitives). Check the MoveToCommand class for an example on how to create a composite command.

Releases

No releases published

Packages

No packages published

Languages