Wednesday, 23 November 2011

xbox kinect


Mock up





WHO SLIDE

People with interest in gadgets
Someone looking to upgrade their home security
personal Secretary so business might be interested in as well.

Tuesday, 22 November 2011

working version final

//import generic tank settings and tank load outs
import edu.dat.*;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

/**
  @author tpiercey
  **/
  

 //Controls,connection to the jar far file that implements the key listener, provides loadout setting for LightTank use
public class KeyControlledRobot extends LightTankRobot implements KeyListener {


//IP for local machine, image URL for robot
public static void main(String[] args) {
KeyControlledRobot robo = new KeyControlledRobot ("141.163.83.16","http://i.imgur.com/TEqTK.png"); 
  }


//Strings the IP address and image to the KeyEvent/KeyWindow
public KeyControlledRobot(String ip,String url){
super (ip,url);
  
  
  //Setting up the Listener to the the KeyWindow
  KeyWindow control = new KeyWindow();
  control.addKeyListener(this);
  
 }


 //Key Pressed

 //Controls 
 // W Accelerate 
 // F Decelerate
 // A Turn Left
 // D Turn Right
 // K Gear Up
 // L Gear Down
 // Spacebar Fire


//When Key Pressed 'KEY CODED PRESSED' Make event happened 'CONTROL OF ROBOT'
 public void keyPressed (KeyEvent e) {
  int keyCode = e.getKeyCode();
  
 //gearing controls for the tank to be able to move forward and backwards, also print out speed of tank and show in the console below
  if (keyCode == KeyEvent.VK_K){
   forwardGear();
    System.out.println(this.getSpeed());
  
    }
  
//Lower gear to enable reverse of tank, also print out speed of tank and show in the console below   
  if(e.getKeyCode()==KeyEvent.VK_L){
   reverseGear();
    System.out.println(this.getSpeed());
       
    }
  
 //allowing tank to move forwards and backwards, print accelerate in console below  
  if(e.getKeyCode()==KeyEvent.VK_W){
   accelerate();
   System.out.println("accelerate"); 
    }
   
  //allows tank to break and decrease speed for gear change, print out decelerate below
  if(e.getKeyCode()==KeyEvent.VK_S){
   decelerate();
   System.out.println("decelerate"); 
    }
      
  
 //Controlling Direction of the Tank 
  
  //turn tank left, print left in console
  if(e.getKeyCode()==KeyEvent.VK_A){
   turnLeft();
   System.out.println("left");
    }
  //turn tank right, print right in console 
  if(e.getKeyCode()==KeyEvent.VK_D){
   turnRight();
   System.out.println("right");
    }
  
  //Allowing the tank to fire, print fire in the console
  if(e.getKeyCode()==KeyEvent.VK_SPACE){
   fire();
   System.out.println("fire");
  }
  
  
 }

//terminate
 public void keyTyped(KeyEvent e) {
 }
//terminate
 public void keyReleased (KeyEvent e) { 
  
 }
  
  
  
}

automated robot

import edu.dat.*;
import edu.dat.HeavyTankRobot;

/**
@author tpiercey
**/


public class AutomatedTank extends HeavyTankRobot {

//set up for robot tank, string tank image and ip to class 

 public static void main(String[] args) {
    AutomatedTank Abot = new AutomatedTank ("127.0.0.1","http://images.wikia.com/gtawiki/images/4/41/Tank-GTA2.png"); 
 }

//loop set up with radar detection, width set to a 180 degree angle with front postion for Beam Direction

 public AutomatedTank (String ip,String url){
super (ip,url);
while(true){
forward();{
  if (this.getSpeed()==0)
  {this.forwardGear();}
  this.accelerate();
}
   
Collision();{
  if(this.isTouchingWall());
  for(int i=1; i<=15; i++){
  this.turnLeft();
  this.forwardGear();
  this.accelerate();
  }
}
 
fire();{
    this.setRadarBeamDirection(0);
    this.setRadarBeamWidth(180);
    if (this.ping() != -1) this.fire();
}
 
 
 
}

 

 
 }  

   
   
//setting tank speed to engage forwards

   public void forward(){
  if (this.getSpeed()==0)
  {this.forwardGear();}
  this.accelerate();  
   }
   


   //Method made for If touching wall
   public void Collision(){
   
//rotates tank by 15 and engages accelerate
  for(int i=1; i<=15; i++){
  if (this.isTouchingWall());
  this.decelerate();
  this.turnLeft();
  this.forwardGear();
  this.accelerate();
  }}

   //Method made for shooting
   public void fire(){
  this.setRadarBeamDirection(0);
  this.setRadarBeamWidth(180);
  if (this.ping() != -1) this.fire();
   }
}


 
   









working 2nd Bot

//import generic tank settings and tank load outs
import edu.dat.*;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

/**
  @author tpiercey
  **/
  

 //Controls,connection to the jar far file that implements the key listener//
public class KeyControlledRobot extends LightTankRobot implements KeyListener {

//ip for local machine, image url for robot//
  public static void main(String[] args) {
   KeyControlledRobot robo = new KeyControlledRobot ("127.0.0.1","http://i.imgur.com/TEqTK.png"); 
  }


 //Strings the IP address and image to the KeyEvent/KeyWindow
 public KeyControlledRobot(String ip,String url){
  super (ip,url);
  //Setting up the Listener to the the KeyWindow
  KeyWindow control = new KeyWindow();
  control.addKeyListener(this);
  
 }


 //Key Pressed//

 //Controls 
 // W Accelerate 
 // F Decelerate
 // A Turn Left
 // D Turn Right
 // K Gear Up
 // L Gear Down
 // Spacebar Fire


 public void keyPressed (KeyEvent e) {
  int keyCode = e.getKeyCode();
  
 //gearing controls for the tank to be able to move forward and backwards 
  if (keyCode == KeyEvent.VK_K){
   forwardGear();
    System.out.println(this.getSpeed());
  
    }
  
//Lower gear to enable reverse of tank   
  if(e.getKeyCode()==KeyEvent.VK_L){
   reverseGear();
    System.out.println(this.getSpeed());
      
    }
  
 //allowing tank to move  
  if(e.getKeyCode()==KeyEvent.VK_W){
   accelerate();
   System.out.println("accelerate"); 
    }
   
  if(e.getKeyCode()==KeyEvent.VK_S){
   decelerate();
   System.out.println("decelerate"); 
    }
    
   
  
 //Controlling Direction of the Tank 
  
  //turn tank left
  if(e.getKeyCode()==KeyEvent.VK_A){
   turnLeft();
   System.out.println("left");
    }
  //turn tank right 
  if(e.getKeyCode()==KeyEvent.VK_D){
   turnRight();
   System.out.println("right");
    }
  
  //Allowing the tank to fire
  if(e.getKeyCode()==KeyEvent.VK_SPACE){
   fire();
   System.out.println("fire");
  }
  
  
 }

//terminate
 public void keyTyped(KeyEvent e) {
 }
//terminate
 public void keyReleased (KeyEvent e) { 
  
 }
  
  
  
}


Working 2nd Bot


//import generic tank settings and tank load outs
import edu.dat.*;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

/**
  @author tpiercey
  **/
  

 //Controls,connection to the jar far file that implements the key listener//
public class KeyControlledRobot extends LightTankRobot implements KeyListener {

//ip for local machine, image url for robot//
  public static void main(String[] args) {
   KeyControlledRobot robo = new KeyControlledRobot ("127.0.0.1","http://images.wikia.com/gtawiki/images/4/41/Tank-GTA2.png"); 
  }


 //Strings the IP address and image to the KeyEvent/KeyWindow
 public KeyControlledRobot(String ip,String url){
  super (ip,url);
  //Setting up the Listener to the the KeyWindow
  KeyWindow control = new KeyWindow();
  control.addKeyListener(this);
  
 }


 //Key Pressed//

 //Controls 
 // W Accelerate 
 // F Decelerate
 // A Turn Left
 // D Turn Right
 // K Gear Up
 // L Gear Down
 // Spacebar Fire


 public void keyPressed (KeyEvent e) {
  int keyCode = e.getKeyCode();
  
 //gearing controls for the tank to be able to move forward and backwards 
  if (keyCode == KeyEvent.VK_K){
   forwardGear();
    System.out.println(this.getSpeed());
  
    }
  
//Lower gear to enable reverse of tank   
  if(e.getKeyCode()==KeyEvent.VK_L){
   reverseGear();
    System.out.println(this.getSpeed());
      
    }
  
 //allowing tank to move  
  if(e.getKeyCode()==KeyEvent.VK_W){
   accelerate();
   System.out.println("accelerate"); 
    }
   
  if(e.getKeyCode()==KeyEvent.VK_S){
   decelerate();
   System.out.println("decelerate"); 
    }
    
   
  
 //Controlling Direction of the Tank 
  
  //turn tank left
  if(e.getKeyCode()==KeyEvent.VK_A){
   turnLeft();
   System.out.println("left");
    }
  //turn tank right 
  if(e.getKeyCode()==KeyEvent.VK_D){
   turnRight();
   System.out.println("right");
    }
  
  //Allowing the tank to fire
  if(e.getKeyCode()==KeyEvent.VK_SPACE){
   fire();
   System.out.println("fire");
  }
  
  
 }

//terminate
 public void keyTyped(KeyEvent e) {
 }
//terminate
 public void keyReleased (KeyEvent e) { 
  
 }
  
  
  
}


Working Robot!


//import generic tank settings and tank load outs
import edu.dat.*;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

/**
  @author tpiercey
  **/
  

 //Controls,connection to the jar far file that implements the key listener//
public class KeyControlledRobot extends LightTankRobot implements KeyListener {

//ip for local machine, image url for robot//
  public static void main(String[] args) {
   KeyControlledRobot robo = new KeyControlledRobot ("127.0.0.1","http://images.wikia.com/gtawiki/images/4/41/Tank-GTA2.png"); 
  }


 //Strings the IP address and image to the KeyEvent/KeyWindow
 public KeyControlledRobot(String ip,String url){
  super (ip,url);
  //Setting up the Listener to the the KeyWindow
  KeyWindow control = new KeyWindow();
  control.addKeyListener(this);
  
 }


 //Key Pressed//

 //Controls 
 // W Accelerate 
 // F Decelerate
 // A Turn Left
 // D Turn Right
 // K Gear Up
 // L Gear Down
 // Spacebar Fire


 public void keyPressed (KeyEvent e) {
  int keyCode = e.getKeyCode();
  
 //gearing controls for the tank to be able to move forward and backwards 
  if (keyCode == KeyEvent.VK_K){
   forwardGear();
    System.out.println(this.getSpeed());
  
    }
  
//Lower gear to enable reverse of tank   
  if(e.getKeyCode()==KeyEvent.VK_L){
   reverseGear();
    System.out.println(this.getSpeed());
      
    }
  
 //allowing tank to move  
  if(e.getKeyCode()==KeyEvent.VK_W){
   accelerate();
   System.out.println("accelerate"); 
    }
   
  if(e.getKeyCode()==KeyEvent.VK_S){
   decelerate();
   System.out.println("decelerate"); 
    }
    
   
  
 //Controlling Direction of the Tank 
  
  //turn tank left
  if(e.getKeyCode()==KeyEvent.VK_A){
   turnLeft();
   System.out.println("left");
    }
  //turn tank right 
  if(e.getKeyCode()==KeyEvent.VK_D){
   turnRight();
   System.out.println("right");
    }
  
  //Allowing the tank to fire
  if(e.getKeyCode()==KeyEvent.VK_SPACE){
   fire();
   System.out.println("fire");
  }
  
  
 }

//terminate
 public void keyTyped(KeyEvent e) {
 }
//terminate
 public void keyReleased (KeyEvent e) { 
  
 }
  
  
  
}


Monday, 21 November 2011

lol

import edu.dat.GenericRobot;
import edu.dat.HeavyTankRobot;


public class AutomatedTank extends HeavyTankRobot {

//set up for robot tank
public static void main(String[] args) {
  AutomatedTank Abot = new AutomatedTank ("127.0.0.1","http://images.wikia.com/gtawiki/images/4/41/Tank-GTA2.png"); 
}
//loop set up
public AutomatedTank (String ip,String url){
  super (ip,url);
  while(true);{
  this.setRadarBeamDirection(0);
  this.setRadarBeamWidth(180);
  }
 
}
 




 void engageForwardGear();
 void engageReverseGear();


 void turnRight();
 void turnLeft();
 void accelerate();
 void decelerate();

this.turnLeft();
this.accelerate();

if (this.isTouchingWall()) this.decelerate();
if (this.getSpeed()==0) this.engageReverseGear();
If (this.ping() != -1) this.fire()



Automated Robot


import edu.dat.GenericRobot;
import edu.dat.HeavyTankRobot;


public class AutomatedTank extends HeavyTankRobot {

//set up for robot tank
public static void main(String[] args) {
  AutomatedTank Abot = new AutomatedTank ("127.0.0.1","http://images.wikia.com/gtawiki/images/4/41/Tank-GTA2.png"); 
}
//loop set up
public AutomatedTank (String ip,String url){
  super (ip,url);
  while(true);{
  this.setRadarBeamDirection(0);
  this.setRadarBeamWidth(180);
  }
 
}
 




 void engageForwardGear();
 void engageReverseGear();


 void turnRight();
 void turnLeft();
 void accelerate();
 void decelerate();

this.turnLeft();
this.accelerate();

if (this.isTouchingWall()) this.decelerate();
if (this.getSpeed()==0) this.engageReverseGear();
If (this.ping() != -1) this.fire()



working task 1 nd


import edu.dat.*;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

/**
  @author tpiercey
  **/
  

 //Controls,connection to the jar far file that implements the key listener//
public class KeyControlledRobot extends LightTankRobot implements KeyListener {

//ip for local machine, image url for robot//
public static void main(String[] args) {
  KeyControlledRobot robo = new KeyControlledRobot ("127.0.0.1","http://images.wikia.com/gtawiki/images/4/41/Tank-GTA2.png"); 
}
 public KeyControlledRobot(String ip,String url){
  super (ip,url);
  KeyWindow control = new KeyWindow();
  control.addKeyListener(this);
  
 }

 /**
  * @param args
  */


 //Key Pressed//
 public void keyPressed (KeyEvent e) {
  int keyCode = e.getKeyCode();
  
  if (keyCode == KeyEvent.VK_K){
   forwardGear();
    System.out.println("gear up");
    }
   
  if(e.getKeyCode()==KeyEvent.VK_L){
   reverseGear();
    System.out.println("gear down");
    }
   
  if(e.getKeyCode()==KeyEvent.VK_W){
   accelerate();
   System.out.println("accelerate");
    }
   
  if(e.getKeyCode()==KeyEvent.VK_S){
   decelerate();
   System.out.println("decelerate");
    }
   
  //if(e.getKeyCode()==KeyEvent.VK_UP){
   //int getSpeed();
   //System.out.println("get speed");
   //}
  
  if(e.getKeyCode()==KeyEvent.VK_A){
   turnLeft();
   System.out.println("left");
    }
   
  if(e.getKeyCode()==KeyEvent.VK_D){
   turnRight();
   System.out.println("right");
    }
  
  if(e.getKeyCode()==KeyEvent.VK_SPACE){
   fire();
   System.out.println("fire");
    }
  
 }


 public void keyTyped(KeyEvent e) {
 }

 public void keyReleased (KeyEvent e) { 
 
 }
  
  
  
}