<commit_before>/*
 * OI.cpp
 *
 *  Created on: Feb 26, 2016
 *      Author: Edward
 */


#include "OI.h"

#include "Utility/FunkyGet.h"
#include "Config/PortSpace.h"

#include "Commands/ForwardBoost.h"
#include "Commands/TurnBoost.h"
#include "Commands/ShootMode.h"

#include <memory>
#include <math.h>

namespace subsystems
{

using namespace dman;

OI::OI(): WPISystem("OI"), driver_left_("driver_left"), driver_right_("driver_right"),
		deadzone_(.05), forward_(true),
		tank_multiplier_(1.0), forward_multiplier_(1.0), turn_multiplier_(1.0),
		base_tank_multiplier_(.5), base_forward_multiplier_(.5), base_turn_multiplier_(.5)
{
	AddSubSystem("driver_left", driver_left_);
	AddSubSystem("driver_right", driver_right_);
	AddSubSystem("xbox", copilot_);
}

void OI::doRegister()
{
	// axes
	tank_left_ = GetLocalValue<double>("driver_left/axes/y");
	tank_right_ = GetLocalValue<double>("driver_right/axes/y");
	arcade_forward_ = GetLocalValue<double>("driver_right/axes/y");
	arcade_turn_ = GetLocalValue<double>("driver_left/axes/x");
	swiss_ = GetLocalValue<double>("xbox/axes/L_Y_Axis");

	// triggers
	forward_boost_ = GetLocalValue<bool>("driver_right/buttons/1");
	turn_boost_ = GetLocalValue<bool>("driver_left/buttons/1");
	tank_mode_ = GetLocalValue<bool>("driver_right/buttons/6");
	arcade_mode_ = GetLocalValue<bool>("driver_right/buttons/7");
	forward_sensor_align_ = GetLocalValue<bool>("driver_right/buttons/8");
	turn_sensor_align_ = GetLocalValue<bool>("driver_left/buttons/8");
	front_mode_ = GetLocalValue<bool>("driver_right/buttons/11");
	reverse_mode_ = GetLocalValue<bool>("driver_right/buttons/10");
	intake_ = GetLocalValue<bool>("xbox/buttons/A");
	push_ = GetLocalValue<bool>("xbox/buttons/B");
	shoot_ = GetLocalValue<bool>("xbox/buttons/R_TRIGGER");
	spindown_ = GetLocalValue<bool>("xbox/buttons/X");
	spinup_ = GetLocalValue<bool>("xbox/buttons/Y");
	force_toggle_ = GetLocalValue<bool>("xbox/buttons/BACK");

	// POV
	swiss_state_ = GetLocalValue<int>("xbox/pov");

	auto& settings = GetSettings();<commit_msg>OI: Switches ball spitout to driver's right joystick hat button<commit_after>/*
 * OI.cpp
 *
 *  Created on: Feb 26, 2016
 *      Author: Edward
 */


#include "OI.h"

#include "Utility/FunkyGet.h"
#include "Config/PortSpace.h"

#include "Commands/ForwardBoost.h"
#include "Commands/TurnBoost.h"
#include "Commands/ShootMode.h"

#include <memory>
#include <math.h>

namespace subsystems
{

using namespace dman;

OI::OI(): WPISystem("OI"), driver_left_("driver_left"), driver_right_("driver_right"),
		deadzone_(.05), forward_(true),
		tank_multiplier_(1.0), forward_multiplier_(1.0), turn_multiplier_(1.0),
		base_tank_multiplier_(.5), base_forward_multiplier_(.5), base_turn_multiplier_(.5)
{
	AddSubSystem("driver_left", driver_left_);
	AddSubSystem("driver_right", driver_right_);
	AddSubSystem("xbox", copilot_);
}

void OI::doRegister()
{
	// axes
	tank_left_ = GetLocalValue<double>("driver_left/axes/y");
	tank_right_ = GetLocalValue<double>("driver_right/axes/y");
	arcade_forward_ = GetLocalValue<double>("driver_right/axes/y");
	arcade_turn_ = GetLocalValue<double>("driver_left/axes/x");
	swiss_ = GetLocalValue<double>("xbox/axes/L_Y_Axis");

	// triggers
	forward_boost_ = GetLocalValue<bool>("driver_right/buttons/1");
	turn_boost_ = GetLocalValue<bool>("driver_left/buttons/1");
	tank_mode_ = GetLocalValue<bool>("driver_right/buttons/6");
	arcade_mode_ = GetLocalValue<bool>("driver_right/buttons/7");
	forward_sensor_align_ = GetLocalValue<bool>("driver_right/buttons/8");
	turn_sensor_align_ = GetLocalValue<bool>("driver_left/buttons/8");
	front_mode_ = GetLocalValue<bool>("driver_right/buttons/11");
	reverse_mode_ = GetLocalValue<bool>("driver_right/buttons/10");
	intake_ = GetLocalValue<bool>("xbox/buttons/A");
	push_ = GetLocalValue<bool>("driver_right/buttons/3");
	shoot_ = GetLocalValue<bool>("xbox/buttons/R_TRIGGER");
	spindown_ = GetLocalValue<bool>("xbox/buttons/X");
	spinup_ = GetLocalValue<bool>("xbox/buttons/Y");
	force_toggle_ = GetLocalValue<bool>("xbox/buttons/BACK");

	// POV
	swiss_state_ = GetLocalValue<int>("xbox/pov");

	auto& settings = GetSettings();
{'fraction_non_alphanumeric': 0.16361003861003862, 'fraction_numerical': 0.013272200772200772, 'mean_word_length': 7.095703125, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2933408', 'n_tokens_mistral': 1560, 'n_tokens_neox': 1564, 'n_words': 200}