Advertisement
Technologyman00

Untitled

Sep 9th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.71 KB | None | 0 0
  1. import java.util.Random;
  2. public class AdjustableHoodBot {
  3. public static void main(String[] args) {
  4.    
  5.     //Instances
  6.     Random gen = new Random();
  7.    
  8.     //Variables
  9.     double x,y,height,width;
  10.     double[] wantx = new double[2];
  11.     double LeftMotor = 0, RightMotor = 0;
  12.     double hoodangle = 0, wanthoodangle, distance, heightofgoal;
  13.     boolean auto = false;
  14.     boolean[] good = new boolean[2];
  15.     int testdist = 0, testheight = 0;
  16.    
  17.     //Create Data
  18.     x = gen.nextInt(640);
  19.     y = gen.nextInt(400);
  20.     height = gen.nextInt(400);
  21.     width = gen.nextInt(640);
  22.    
  23.     heightofgoal = 88; //Probably should be Minus the height of the shooter
  24.     wantx[0] = 0; // Big
  25.     wantx[1] = 0; // Small
  26.  
  27.    
  28.    
  29.         //Y-Axis of the Target
  30.         //Angle Adjust
  31.             distance=((height*testdist)/testheight);
  32.             wanthoodangle = Math.atan2(heightofgoal,distance);
  33.             if(wanthoodangle > hoodangle){
  34.                 //Move hood down
  35.                 //Make Code to Take care of this if only ran once
  36.             }
  37.             else if(wanthoodangle < hoodangle){
  38.                 //Move hood up
  39.                 //Make Code to Take Care of this if only ran once
  40.             }
  41.             else if(wanthoodangle == hoodangle){
  42.                 //Hood is Good
  43.                 good[0] = true;
  44.             }
  45.            
  46.         //X-Axis of the Target
  47.         //Differs Depending on Has Turret or Not   
  48.             if(wantx[0] < x){
  49.                 //Turn with Controller so that it doesn't turn too far
  50.                
  51.             }
  52.             else if(wantx[1] > x){
  53.                 //Turn with Controller so that it doesn't turn too far
  54.             }
  55.             else if(wantx[0] <= x && x >= wantx[1]){
  56.                 //good
  57.                 good[1] = true;
  58.             }
  59.         //Check if all is good
  60.             if(good[0] && good[1]){
  61.                 //Shoot Ball if Trigger is Held
  62.             }
  63.             else{
  64.                 //Repeat Code But Shouldnt Need to.
  65.             }
  66.            
  67.            
  68.            
  69.         System.out.println("LeftMotor: "+LeftMotor+" RightMotor: "+RightMotor);    
  70.  
  71. }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement