From: EvanYap Date: Sat, 6 Feb 2016 23:40:21 +0000 (-0800) Subject: Create methods for lidar to work X-Git-Url: http://challenge-bot.com/repos/?a=commitdiff_plain;ds=sidebyside;h=dd71da2a677bfcbef220748a9ba849c636963cb3;p=3501%2Fstronghold-2016 Create methods for lidar to work --- diff --git a/src/org/usfirst/frc/team3501/robot/Robot.java b/src/org/usfirst/frc/team3501/robot/Robot.java index 051aac62..a86721d0 100644 --- a/src/org/usfirst/frc/team3501/robot/Robot.java +++ b/src/org/usfirst/frc/team3501/robot/Robot.java @@ -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()); + } }