Box man: Body remote robot car

–final video

This is Peggy and Hank’s project 3. Our concept is using player’s body gesture to control a robot worker to solving a box man puzzle. Originally, we started from thinking about how to use wireless technology to connect two objects more than doing a game. For instance, Hank’s wife always want a coffee machine that can help her cook coffee every morning when she gets up starting to wash her face; and I always want to do something for couples in long distance relationship (maybe two umbrellas, can project your lover’s external environment inside your umbrella. Or two bangles, can transfer your pulse data into some other things and send to your lover’s bangle.) However, we thought those are not fun enough. So we change the idea to a game. (Hank dreams for the robot car. And I like to solve puzzle. So we combined our ideas together.)

Step 1: build the robot In the process, the biggest problem was this robot car was hard for us to be programmed. We didn’t know where we could start. Officially, it can be programmed by C++. But we know nothing about C++. So we did a lot of research to figure out how can we code in Arduino environment. And then, we could control it’s speed and direction.

–forward: motors.setSpeeds(motorSpeed,motorSpeed);

–backward: motors.setSpeeds(-motorSpeed,-motorSpeed);

–right: motors.setSpeeds(motorSpeed,-motorSpeed);

–left: motors.setSpeeds(-motorSpeed,motorSpeed);

–controlled by the buttons on the car

lcd.clear();
  lcd.print("Waiting");

  unsigned char button = buttons.waitForPress(BUTTON_A | BUTTON_B | BUTTON_C);
  lcd.clear();

  if (button == BUTTON_A){
    motorSpeed=50;
    lcd.gotoXY(0,0);
    lcd.print("left");
    motors.setSpeeds(-motorSpeed,motorSpeed);
  }

  if (button == BUTTON_C){
    motorSpeed=50;
    lcd.gotoXY(0,0);
    lcd.print("right");
    motors.setSpeeds(motorSpeed,-motorSpeed);
  }

  if(button == BUTTON_B){
    motorSpeed=50;
    lcd.gotoXY(0,0);
    lcd.print("move");
    motors.setSpeeds(motorSpeed,motorSpeed);
  }

  lcd.gotoXY(0,1);
  lcd.print("spd=");
  lcd.print(motorSpeed);

  buttons.waitForRelease(button);
  motorSpeed=0;
  lcd.clear();
  lcd.print("stop");
  motors.setSpeeds(motorSpeed, motorSpeed);

Next, we studied with the pin map for 3pi robot car and find out which pin we can use. (only 3 free pin available). –buttons controll: https://www.dropbox.com/s/wtzp9txx7p1obqx/buttonControl3.ino

And then, we tried to control the car wirelessly.

–Xbee talk

–Wireless button

–Keyboard control: read data from processing

//Processing

https://www.dropbox.com/s/uik63h2rusfmsr5/keypadControl.pde

//Arduino1:get data from processing, and send data through xbee

https://www.dropbox.com/s/kqh3x6fp6eyoxi6/controledByKeys.ino

//Arduino2:the car, receive data from xbee

https://www.dropbox.com/s/mmhqd68g7xqznpr/Xbee_control_car.ino

–video

Step 2: connect Kinect

–The code to read the kinect:

https://www.dropbox.com/s/vwe4hf4m9fzztbi/kinectSkeletonServer.pde

–Processing:

https://www.dropbox.com/s/q4sxf81puu6cab6/kinectControlMode.pde

–Arduino:read from Processing

https://www.dropbox.com/s/kqh3x6fp6eyoxi6/controledByKeys.ino

–Robot car

https://www.dropbox.com/s/3uu7hajcj2yjnqq/XBeeControl.ino

And then, we want to code to control the angle for the car to make sure every time the car will turn 90 degree. We choose to change the code on arduino1. Here is the code:

https://www.dropbox.com/s/aj0synvuc7w1mo4/angle_test2.ino

–angle

Step3 build the maze The originally design should be like this: But when the car push the box, we can not make sure the car push the centre of the box, which result in the box will be deviated the path and the car can not keep moving vertically or horizontally. Besides, more blocks in the maze is easier to block the signal between Xbees. So I modify the maze into this: And add a board on the car (can help to push). After all red boxes are put into the target places, the leds will turned on, and a win sound effect will be there.

Step4: Display When I tried to play this game before we do the presentation, I realize I have to keep looking my laptop to see the background change, in order to make sure my gesture. Thus, I couldn’t focus on the maze and control the robot better. Kate and Nick suggested me to set up a projector to project the background color on the maze, so that I don’t need to pay attention to my laptop. And the game can be more smooth.

–maze with projector

Comments are closed.