Astronaut-Assisting Roomba

Introduction: Astronaut-Assisting Roomba

This project is made by utilizing the Raspberry Pi 3 on board the iRobot Create Version 2. MATLAB is used to program the robot to follow specific instructions using it's sensors and camera. The sensors and cameras are utilized to perform specific tasks that would follow an astronaut and provide him/her with the ability to communicate with his/her home base if anything goes wrong.

Step 1: Needed Parts

1. iRobot Create Version 2

  • The iRobot Create is the most essential part of this project since it is programmable and can be a great representation for an actual rover that follows astronauts and assists them in the future.

2. Raspberry Pi 3

  • The Raspberry Pi was the programmable used for this project. The code is designed for the Pi and the version of the Pi attached is the 3(model B). Other programmable boards such as arduino are usable, however, arduino and most other boards will require different coding than described in another step.

3. Raspberry Pi Camera Module

  • The only extraneous connection to the Raspberry Pi needed for this project is the Camera Module. The camera module is the integral part to this project, since the roomba will only perform tasks based on what it sees in the camera.

4. MATLAB 2018a

  • MATLAB's second most recent version, 2018a, was used for the coding involved in this setup. It is likely that many other versions of MATLAB will work with this since the roomba programming has been around for awhile

Step 2: Files and Camera Configuration

1. Raspberry Pi and Camera connections to the roomba

  • The Pi can connect to the iRobot directly with a micro USB. That's all it needs to be ready to use. However, it is recommended that it be securely placed on the roomba such as shown in pictures throughout the presentation so far.
  • The camera has a direct connection to the Raspberry Pi and it is greatly recommended that something is purchased or made in order to hold the camera directly up. There's no real point to the camera if it can't be held in place to show what the roomba sees.

2. Files

  • After getting everything set up and connected, make sure the robot is reset and ready to go by holding the "Spot" and "Dock" buttons for 10 seconds together.
  • This is where MATLAB is first needed. The files for the roomba need to be installed first and all that is needed for these files is to run is the code provided on this link:

Step 3: Initial Roomba Testing

There are many initial checks to be performed on the roomba to make sure it is working.

1. Be sure you are connected to the same WiFi network as the roomba. Without this, you will never connect through MATLAB.

2. Find out what number your roomba is assigned to so you can specifically connect to the roomba you chose. For example, if your roomba's number is 30, you would connect to it by typing roomba(30) into the command window in MATLAB.

3. The roomba can be controlled through structs in MATLAB. For example, if you set your code for roomba(30) to the variable 'r' , the robot can be moved forward with the command r.moveDistance(0.2,0.1).

4. There are many different commands that can be communicated to the roomba and these can be seen by typing 'doc roomba' into the command window.

5. The sensors for light,bump, and cliff readings can all be read by using the commands seen in 'doc roomba' but a way to have a constant, neat menu to see the sensor data can be seen by using 'r.testSensors'.

6. After testing all of this, the image collecting software of the robot can be utilized to read and see pictures taken. The basic code for this would be img = r.getImage and imshow(img); .

7. RGB values of the picture can be found with the codes red_mean = mean(mean(img(:,:,1)));

green_mean = mean(mean(img(:,:,2))); and blue_mean=mean(mean(img(:,:,3))); .

Step 4: Example MATLAB Code

At this point, you are now ready to utilize the sensors and image taking software to create your own spin on a Human-Assisting Prototype Mars Rover. Our example is to follow the astronaut by tracking the color white and moving towards it. The robot will beep if it's sensors are reading high values so that the astronaut can reset the robot if it is stuck or go and pick it up and reset it if it is stuck on a cliff. However, it only reads these errors as long as it sees white. Without being able to see the color white, the robot will enter error mode. It is programmed to send two different kinds of emails back to the home base depending on what it sees. If it sees the skin color of the astronaut, that obviously isn't good, so it will alert home base if the astronaut has skin showing with a suit malfunction. The other message is prepared if the astronaut simply disappears from sight. If there is no white or skin color showing for the cameras, the robot will spin around and send another, but different email. The images where the roomba can't see the astronaut will be sent along with the message in the emails. The code for our project is shown below:

for i=1:.1:3
img=r.getImage; image(img) red_mean = mean(mean(img(:,:,1))); green_mean = mean(mean(img(:,:,2))); blue_mean = mean(mean(img(:,:,3))); if red_mean > 110 && red_mean < 135 && blue_mean > 110 && blue_mean <135 && green_mean>110 && green_mean<135 %Determines if white is in picture bump = r.getBumpers(); %since bot is now moving forward, all sensors need to be working cliff = r.getCliffSensors(); light = r.getLightBumpers(); if bump.right>0 || bump.left>0 || bump.front>0 r.beep() r.beep() r.beep() r.stop elseif cliff.left<10 || cliff.leftFront<10 || cliff.rightFront<10 || cliff.right<10 r.beep() r.beep() r.stop elseif light.left>700 || light.leftFront>700 || light.leftCenter>700 || light.rightCenter>700 || light.rightFront>700 || light.right>700 r.beep() r.beep() r.beep() r.beep() r.beep() r.stop else for i=1:2 r.moveDistance(0.2,0.1) r.setDriveVelocity(.3,.2) r.stop end end end if green_mean <35 && blue_mean<35 %skin color showing(needs to be adjusted based on astronaut's skin color) r.beep(); r.beep(); r.beep(); mail = ''; %sends email showing suit is off psswd = 'yeah'; host = ''; port = '465'; emailto = ''; m_subject = 'subject'; m_text = 'test'; setpref( 'Internet','E_mail', mail ); setpref( 'Internet', 'SMTP_Server', host ); setpref( 'Internet', 'SMTP_Username', mail ); setpref( 'Internet', 'SMTP_Password', psswd ); props = java.lang.System.getProperties; props.setProperty( 'mail.smtp.user', mail ); props.setProperty( '', host ); props.setProperty( 'mail.smtp.port', port ); props.setProperty( 'mail.smtp.starttls.enable', 'true' ); props.setProperty( 'mail.smtp.debug', 'true' ); props.setProperty( 'mail.smtp.auth', 'true' ); props.setProperty( 'mail.smtp.socketFactory.port', port ); props.setProperty( 'mail.smtp.socketFactory.class', '' ); props.setProperty( 'mail.smtp.socketFactory.fallback', 'false' ); sendmail( emailto , 'Help!', 'The astronauts uniform is off!',img); end if red_mean < 110 || red_mean > 135 || green_mean < 90 || green_mean > 135 || blue_mean < 104 || blue_mean > 135 for j = 1:2 %if white cannot be found by the robot r.turnAngle(360) mail = ''; psswd = 'yeah'; host = ''; port = '465'; emailto = ''; m_subject = 'subject'; m_text = 'test'; setpref( 'Internet','E_mail', mail ); setpref( 'Internet', 'SMTP_Server', host ); setpref( 'Internet', 'SMTP_Username', mail ); setpref( 'Internet', 'SMTP_Password', psswd ); props = java.lang.System.getProperties; props.setProperty( 'mail.smtp.user', mail ); props.setProperty( '', host ); props.setProperty( 'mail.smtp.port', port ); props.setProperty( 'mail.smtp.starttls.enable', 'true' ); props.setProperty( 'mail.smtp.debug', 'true' ); props.setProperty( 'mail.smtp.auth', 'true' ); props.setProperty( 'mail.smtp.socketFactory.port', port ); props.setProperty( 'mail.smtp.socketFactory.class', '' ); props.setProperty( 'mail.smtp.socketFactory.fallback', 'false'); sendmail( emailto , 'Help!', 'The astronaut cannot be found!',img ); r.stop end end end

Obviously it is messy here, but it should buff out once copied. Passwords and emails for this are to be supplied by those doing this project obviously.

However, our example is just one of many ways to mess around with this robot to make it suit everyone. There are many different things to be done, which you can suit to yourself.

Be the First to Share


    • Leather Challenge

      Leather Challenge
    • Fruits and Veggies Speed Challenge

      Fruits and Veggies Speed Challenge
    • Make It Modular: Student Design Challenge

      Make It Modular: Student Design Challenge



    3 years ago

    Roombas are great to hack and make stuff out of. Nice to see what you did! : )