Advertisement
Guest User

Thot

a guest
Jan 23rd, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.55 KB | None | 0 0
  1. /*----------------------------------------------------------------------------*/
  2. /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
  3. /* Open Source Software - may be modified and shared by FRC teams. The code */
  4. /* must be accompanied by the FIRST BSD license file in the root directory of */
  5. /* the project. */
  6. /*----------------------------------------------------------------------------*/
  7.  
  8. package org.usfirst.frc.team610.robot;
  9.  
  10. import edu.wpi.first.networktables.NetworkTable;
  11. import edu.wpi.first.networktables.NetworkTableEntry;
  12. import edu.wpi.first.networktables.NetworkTableInstance;
  13. import edu.wpi.first.wpilibj.IterativeRobot;
  14. import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
  15. import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
  16.  
  17. /**
  18. * The VM is configured to automatically run this class, and to call the
  19. * functions corresponding to each mode, as described in the IterativeRobot
  20. * documentation. If you change the name of this class or the package after
  21. * creating this project, you must also update the build.properties file in the
  22. * project.
  23. */
  24. public class Robot extends IterativeRobot {
  25.  
  26. NetworkTableEntry yDiff;
  27. NetworkTableInstance inst;
  28. NetworkTable visionTable;
  29.  
  30. @Override
  31. public void robotInit() {
  32. inst = NetworkTableInstance.getDefault();
  33. visionTable = inst.getTable("SmartDashboard");
  34.  
  35. }
  36.  
  37. /**
  38. * This autonomous (along with the chooser code above) shows how to select
  39. * between different autonomous modes using the dashboard. The sendable
  40. * chooser code works with the Java SmartDashboard. If you prefer the
  41. * LabVIEW Dashboard, remove all of the chooser code and uncomment the
  42. * getString line to get the auto name from the text box below the Gyro
  43. *
  44. * <p>You can add additional auto modes by adding additional comparisons to
  45. * the switch structure below with additional strings. If using the
  46. * SendableChooser make sure to add them to the chooser code above as well.
  47. */
  48. @Override
  49. public void autonomousInit() {
  50.  
  51. }
  52.  
  53. /**
  54. * This function is called periodically during autonomous.
  55. */
  56. @Override
  57. public void autonomousPeriodic() {
  58.  
  59. }
  60.  
  61. /**
  62. * This function is called periodically during operator control.
  63. */
  64. @Override
  65. public void teleopPeriodic() {
  66. yDiff = visionTable.getEntry("yDiff");
  67. System.out.println(yDiff);
  68.  
  69. }
  70.  
  71. /**
  72. * This function is called periodically during test mode.
  73. */
  74. @Override
  75. public void testPeriodic() {
  76. }
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement