Create methods for lidar to work
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / Robot.java
index 051aac623c756d54bc2f5ecf1e3555ceafcebcb2..a86721d0a1a4ac73903f5ba6a2c63cae614c1137 100644 (file)
@@ -5,6 +5,7 @@ import org.usfirst.frc.team3501.robot.subsystems.DriveTrain;
 import org.usfirst.frc.team3501.robot.subsystems.Scaler;
 import org.usfirst.frc.team3501.robot.subsystems.Shooter;
 
+import edu.wpi.first.wpilibj.I2C;
 import edu.wpi.first.wpilibj.IterativeRobot;
 import edu.wpi.first.wpilibj.command.Scheduler;
 import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
@@ -21,12 +22,15 @@ public class Robot extends IterativeRobot {
   SendableChooser positionOneDefense, positionTwoDefense, positionThreeDefense,
       positionFourDefense, positionFiveDefense;
 
+  public static Lidar lidar;
+
   @Override
   public void robotInit() {
     driveTrain = new DriveTrain();
     oi = new OI();
     shooter = new Shooter();
     scaler = new Scaler();
+    lidar = new Lidar(I2C.Port.kOnboard);
 
     // Sendable Choosers allows the driver to select the position of the robot
     // and the positions of the defenses from a drop-down menu on the Smart
@@ -119,11 +123,18 @@ public class Robot extends IterativeRobot {
 
   @Override
   public void teleopInit() {
+    lidar.start();
   }
 
   @Override
   public void teleopPeriodic() {
+    printLidarValues();
     Scheduler.getInstance().run();
 
   }
+
+  public void printLidarValues() {
+
+    System.out.println(lidar.pidGet());
+  }
 }