Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added limeplotter #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified gradlew
100644 → 100755
Empty file.
12 changes: 12 additions & 0 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import edu.wpi.first.networktables.NetworkTableInstance;
import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj.geometry.Rotation2d;
import edu.wpi.first.wpilibj.geometry.Translation2d;
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.Command;
Expand All @@ -27,13 +28,16 @@
*/
public class Robot extends TimedRobot {
NetworkTableInstance chameleon = NetworkTableInstance.create();
NetworkTableInstance limePlotter = NetworkTableInstance.create();
public static SendableChooser<Integer> autoChooser = new SendableChooser<>();
private Command m_autonomousCommand;
private RobotContainer m_robotContainer;
public static NetworkTableEntry angle;
public static NetworkTableInstance inst = NetworkTableInstance.getDefault();
NetworkTable table = chameleon.getTable("chameleon-vision").getSubTable("Microsoft LifeCam HD-3000");
NetworkTable limeTable = limePlotter.getTable("limePlotter");
public static NetworkTableEntry validAngle;
public static NetworkTableEntry estimated_x_position, estimated_y_position;

/**
* This function is run when the robot is first started up and should be used
Expand All @@ -47,6 +51,7 @@ public void robotInit() {
CameraServer server = CameraServer.getInstance();
server.startAutomaticCapture();
chameleon.startClient("10.72.85.12");
limePlotter.startClient("10.72.85.5");
angle = table.getEntry("targetYaw");
validAngle = table.getEntry("isValid");
autoChooser.setDefaultOption("3 Cell Straight", 0);
Expand All @@ -55,6 +60,8 @@ public void robotInit() {
SmartDashboard.putData("Autonomous Selector", autoChooser);
m_robotContainer = new RobotContainer();

estimated_x_position = limePlotter.getEntry("estimated_x_position");
estimated_y_position = limePlotter.getEntry("estimated_y_position");
}

/**
Expand All @@ -78,6 +85,11 @@ public void robotPeriodic() {

CommandScheduler.getInstance().run();
SmartDashboard.putBoolean("Vision Available", isVisionValid());

Translation2d odometryData = m_robotContainer.m_robotDrive.m_odometry.getPoseMeters().getTranslation();

estimated_x_position.setDouble(odometryData.getX());
estimated_y_position.setDouble(odometryData.getY());
}

/**
Expand Down