From dd71da2a677bfcbef220748a9ba849c636963cb3 Mon Sep 17 00:00:00 2001 From: EvanYap Date: Sat, 6 Feb 2016 15:40:21 -0800 Subject: [PATCH] Create methods for lidar to work --- src/org/usfirst/frc/team3501/robot/Robot.java | 11 +++++++++++ 1 file changed, 11 insertions(+) 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()); + } } -- 2.30.2