package org.redalert1741.cageBot;

import edu.wpi.first.wpilibj.GenericHID.Hand;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.XboxController;

public class Robot extends IterativeRobot
{
	public XboxController driver, operator;
	
	@Override
	public void robotInit()
	{
		driver = new XboxController(0);
		operator = new XboxController(1);
	}

	@Override
	public void autonomousInit()
	{

	}

	@Override
	public void autonomousPeriodic()
	{

	}

	@Override
	public void teleopPeriodic()
	{
		double x = driver.getX(Hand.kRight);
		double y = driver.getY(Hand.kLeft);
		// do drive
		
		
	}

	@Override
	public void testPeriodic()
	{

	}
	
	public double deadband(double x)
	{
		if (x >= 0.05) 
		{
			return 1/0.95 * x - 0.05;
		}
		else if (0.05 > Math.abs(x))
		{
			return 0;
		}
		else if (x <= -0.05)
		{
			return -1/0.95 * x + 0.05;
		}
		else
		{
			return 0;
		}
	}
 }


@@ -74,16 +74,236 @@
 D.Hand;%0A
+%0Aimport java.text.DateFormat;%0Aimport java.text.SimpleDateFormat;%0Aimport java.util.Date;%0Aimport java.util.TimeZone;%0A%0Aimport org.redalert1741.robotBase.config.Config;%0Aimport org.redalert1741.robotBase.logging.DataLogger;%0A%0A
 import e
@@ -470,16 +470,36 @@
 erator;%0A
+%09DataLogger logger;%0A
 %09%0A%09@Over
@@ -601,16 +601,95 @@
 ler(1);%0A
+%09%09logger = new DataLogger();%0A%09%09Config.loadFromFile(%22/home/lvuser/config.txt%22);%0A
 %09%7D%0A%0A%09@Ov
@@ -724,25 +724,48 @@
 usInit()%0A%09%7B%0A
+%09%09startLogging(%22auto%22);
 %0A
-
 %09%7D%0A%0A%09@Overri
@@ -807,16 +807,87 @@
 )%0A%09%7B%0A%0A%09%7D
+%0A%09%0A%09@Override%0A%09public void teleopInit()%0A%09%7B%0A%09%09startLogging(%22teleop%22);%0A%09%7D
 %0A%0A%09@Over
@@ -1020,16 +1020,121 @@
 ve%0A%09%09%0A%09%09
+logger.log();%0A%09%7D%0A%09%0A%09@Override%0A%09public void testInit()%0A%09%7B%0A%09%09Config.reloadConfig();%0A%09%09startLogging(%22test%22);
 %0A%09%7D%0A%0A%09@O
@@ -1233,20 +1233,16 @@
  0.05) %0A
-%09%09%7B%0A
 %09%09%09retur
@@ -1258,28 +1258,24 @@
 * x - 0.05;%0A
-%09%09%7D%0A
 %09%09else if (0
@@ -1293,20 +1293,16 @@
 abs(x))%0A
-%09%09%7B%0A
 %09%09%09retur
@@ -1306,20 +1306,16 @@
 turn 0;%0A
-%09%09%7D%0A
 %09%09else i
@@ -1329,20 +1329,16 @@
  -0.05)%0A
-%09%09%7B%0A
 %09%09%09retur
@@ -1363,23 +1363,15 @@
 05;%0A
-%09%09%7D%0A
 %09%09else%0A
-%09%09%7B%0A
 %09%09%09r
@@ -1383,12 +1383,317 @@
  0;%0A
-%09
 %09%7D%0A
+%09%0A%09public void setupLogging()%0A%09%7B%0A%09%09logger.setupLoggables();%0A%09%7D%0A%09%0A%09public void startLogging(String mode)%0A%09%7B%0A%09%09TimeZone tz = TimeZone.getTimeZone(%22EST%22);%0A%09%09DateFormat df = new SimpleDateFormat(%22yyyy-MM-dd_HH-mm-ss%22);%0A%09%09df.setTimeZone(tz);%0A%09%09logger.open(%22log-%22 + df.format(new Date()) + %22_%22 + mode + %22.log%22);%0A
 %09%7D%0A 

Add logging and config stuff