<commit_before>#pragma config(Sensor, in1,    potentio1,      sensorPotentiometer)
#pragma config(Sensor, in2,    potentio2,      sensorPotentiometer)
#pragma config(Motor,  port2,           motorRight,    tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port3,           motorLeft,     tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port4,           motorClaw1,    tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port5,           motorClaw2,    tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port6,           motorLeftLift1, tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port7,           motorRightLift1, tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port8,           motorLeftLift2, tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port9,           motorRightLift2, tmotorVex393_MC29, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//
/*	              Kyle's Modular WonderCode | Copywrite  <NAME>							  */
/*
void autonomousAction(){

}
*/
//Converts the state of a button to a boolean expression. Ex. Pressed = true, Not Pressed = fasle
//Button passed into the function. Ex. isPressed(vexRT[button])
bool isPressed(int button){
	bool isPressed;
	if(button == 1){
		isPressed = true;
		} else if(button == 0){
		isPressed = false;
	}
	return isPressed;
}
//Converts a given number into a percentage of another number. Ex. 10 and 100 passed in will yeild 10 (10%)
//2 Parameters passed into function.
//Ex. toPercent(integer, integer)
int toPercent(int x, int max){
	int y;
	y = (x / max);
	return y;
}
//Returns the value of a defined poentiometer.
//Potnetiometer passed into function. Ex. getPotential(SensorValue[sensor])
int getPotential(int potentiometer){
	int potentioMeter;
	return 	potentioMeter;
}
//Applys a deadzone and a threshold to a motor.
//3 Parameters passed into function, Joystick, Deadzone, Throttle. Ex. applyThingsNStuff(vexRT[joystick], integer, integer)
int applyThingsNStuff(int joyValue, int threshold, int throttle){
	int trueValue;
	if(toPercent(joyValue, 124) < throttle){
		if(abs(joyValue) < threshold){
			trueValue = 0;
			}else{
			trueValue = joyValue;
		}
		}else if(toPercent(joyValue, 124) >= throttle){
		if(abs(joyValue) < threshold){
			trueValue = 0;
			}else{
			trueValue = joyValue * (throttle / 100);
		}
	}
	return trueValue;
}
//Sets the speed of the right motor based off of returned data from applyThingsNStuff function
//2 Parameters passed into function, integer (given by applyStuffNThings), Turn Joystick
//setMotorRightVal(applyThingsNStuff(vexRT[joystick], deadzone, throttle), vexRT[joystick])
//Ex. setMotorRightVal(applyThingsNStuff(vexRT[Ch3], threshold, throttle), applyThingsNStuff(vexRT[Ch1], threshold, throttle))
int setMotorRightVal(int dataProcessed, int joyValue){
	int motorValue = dataProcessed + joyValue;
	return motorValue;
}
//Sets the speed of the left motor based off of returned data from applyThingsNStuff function
//2 Parameters passed into function, integer (given by applyStuffNThings), Joystick
//Ex. setMotorLeftVal(applyThingsNStuff(vexRT[Ch3], threshold, throttle), applyThingsNStuff(vexRT[Ch1], threshold, throttle))
int setMotorLeftVal(int dataProcessed, int joyValue){
	int motorValue = dataProcessed - joyValue;
	return motorValue;
}
//Opens the claw on the hold of a defined button and keeps it open as long as the button is held, closing upon button release
//5 Parameters passed into the function, Button, Maximum Speed, Poentiometer, Potentiometer Closed Claw Value, Potentiometer Open Claw Value
//Ex. doPassiveClaw(vexRT[button], integer, SensorValue[potentiometer], integer, integer)
int doPassiveClaw(int button, int maxSpeed, int potentiometer, int closeValue, int openValue){
	int motorValue;
	if(isPressed(button) && getPotential(potentiometer) < openValue){
		motorValue = maxSpeed;
		}else if(isPressed(button) == false && getPotential(potentiometer) > closeValue){
		motorValue = 0 - maxSpeed;
	}
	return motorValue;
}
//Opens the claw on the hold of a defined button, can be reversed
//3 Parameters passed into the function, Button, Maximum Speed, Boolean Reversed
//Ex. doActiveClaw(vexRT[but ton], integer, boolean)
int doActiveClaw(int button, int maxSpeed, bool isReversed){
	int motorValue;
	if(isPressed(button) && isReversed){
		motorValue = 0 - maxSpeed;
		}else if(isPressed(button) && isReversed == false){
		motorValue = maxSpeed;
	}
	return motorValue;
}
//Assigns 2 buttons to moving the claw arm forward and backward
//3 Parameters passed into the function, Button, Button, Maximum Speed
//Ex. doClawLift(vexRT[button], vexRT[button], integer)
int doClawLift(int button1, int button2, int maxSpeed, bool isReversed){
	int motorValue;
	if(isReversed){
		if(isPressed(button1)){
			motorValue = 0 - maxSpeed;
			}else if(isPressed(button2)){
			motorValue = maxSpeed;
		}
		}else if(isReversed == false){
		if(isPressed(button1)){
			motorValue = 0 - maxSpeed;
			}else if(isPressed(button2)){
			motorValue = maxSpeed;
		}
	}
	return motorValue;
}
//Determines if the user is using the active or passive claw controls defined by the "doActiveClaw" and "doPassiveClaw" functions
//6 Parameters passed into the function, Passive Action Button, Open Button, Close Button, Maximum Speed, Poentiometer, Potentiometer Claw Closed Value, Potentiometer, Claw Open Value
//Ex. setClaw(vexRT[buttonPassive], vexRT[buttonActive1], vexRT[buttonActive2], integer, integer, integer, integer)
int setClaw(int buttonPassive, int buttonActive1, int buttonActive2, int maxSpeed, int potentiometer, int closeValue, int openValue){
	int motorValue;
	if(buttonPassive){
		motorValue = doPassiveClaw(buttonPassive, maxSpeed, potentiometer, closeValue, openValue);
		}else if(buttonActive1){
		motorValue = doActiveClaw(buttonActive1, maxSpeed, false);
		}else if(buttonActive2){
		motorValue = doActiveClaw(buttonActive2, maxSpeed, true);
	}
	return motorValue;
}
task main(){
	/*===========================================================================================================*/
	/*|																			Must be set PRIOR to using the Program															|*/
	/*===========================================================================================================*/
	int threshold = 30;							//Amount of Deadzone applied to Joysticks - Higher = Larger Deadzone				  |
	int throttlePercent = 90;				//Maximum Amount of Power to Give Motors - Percentage Based (0% - 100%)	   		|
	int closeValueRight = 0;				//Value of the Potentiometer when the RIGHT CLAW is CLOSED										|
	int openValueRight = 0;					//Value of the Potentiometer when the RIGHT CLAW is OPEN											|
	int closeValueLeft = 0;					//Value of the Potentiometer when the LEFT CLAW is CLOSED											|
	int openValueLeft = 0;					//Value of the Potentiometer when the LEFT CLAW is OPEN												|
	/*============================================================================================================*/
	while(true){
		//Primary Controller Controls
		motor[motorLeft] = setMotorLeftVal(applyThingsNStuff(vexRT[Ch3], threshold, throttlePercent), applyThingsNStuff(vexRT[Ch1], threshold, throttlePercent));
		motor[motorRight] = setMotorRightVal(applyThingsNStuff(vexRT[Ch3], threshold, throttlePercent), applyThingsNStuff(vexRT[Ch1], threshold, throttlePercent));
		motor[motorClaw1] = setClaw(vexRT[Btn5U], vexRT[Btn7L], vexRT[Btn7R], 127, SensorValue[potentio1], closeValueLeft, openValueLeft);
		motor[motorLeftLift1] = doClawLift(vexRT[Btn7U], vexRT[Btn7D], 127, false);
		motor[motorLeftLift2] = doClawLift(vexRT[Btn7U], vexRT[Btn7D], 127, false);
		//Secondary Controller Controls
		motor[motorClaw2] = setClaw(vexRT[Btn5UXmtr2], vexRT[Btn7LXmtr2], vexRT[Btn7RXmtr2], 127, SensorValue[potentio2], closeValueRight, openValueRight);
		motor[motorRightLift1] = doClawLift(vexRT[Btn7UXmtr2], vexRT[Btn7DXmtr2], 127, false);
		motor[motorRightLift2] = doClawLift(vexRT[Btn7UXmtr2], vexRT[Btn7DXmtr2], 127, false);
	}
}<commit_msg>Updates<commit_after>#pragma config(Sensor, in1,    potentio1,      sensorPotentiometer)
#pragma config(Sensor, in2,    potentio2,      sensorPotentiometer)
#pragma config(Motor,  port2,           motorRight,    tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port3,           motorLeft,     tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port4,           motorClaw1,    tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port5,           motorClaw2,    tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port6,           motorLeftLift1, tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port7,           motorRightLift1, tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port8,           motorLeftLift2, tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port9,           motorRightLift2, tmotorVex393_MC29, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//
/*	              Kyle's Modular WonderCode | Copywrite  <NAME>							  */
//Converts the state of a button to a boolean expression. Ex. Pressed = true, Not Pressed = false
//Button passed into the function. Ex. isPressed(vexRT[button])
bool isPressed(int button){
	bool isPressed;
	if(button == 1){
		isPressed = true;
		} else if(button == 0){
		isPressed = false;
	}
	return isPressed;
}
//Converts a given number into a percentage of another number. Ex. 10 and 100 passed in will yeild 10 (10%)
//2 Parameters passed into function.
//Ex. toPercent(integer, integer)
int toPercent(int x, int max){
	int y;
	y = (x / max);
	return y;
}
//Returns the value of a defined poentiometer.
//Potnetiometer passed into function. Ex. getPotential(SensorValue[sensor])
int getPot(int potentiometer){
	return 	potentiometer;
}
//Applys a deadzone and a threshold to a motor.
//3 Parameters passed into function, Joystick, Deadzone, Throttle. Ex. applyThingsNStuff(vexRT[joystick], integer, integer)
int applyThingsNStuff(int joyValue, int threshold, int throttle){
	int trueValue;
	if(toPercent(joyValue, 124) < throttle && abs(joyValue) > threshold){
		trueValue = joyValue;
		}else if(toPercent(joyValue, 124) >= throttle && abs(joyValue) > threshold){
		trueValue = joyValue * (throttle / 100);
		}else if(abs(joyValue) < threshold){
		trueValue = 0;
	}
	return trueValue;
}
//Sets the speed of the right motor based off of returned data from applyThingsNStuff function
//2 Parameters passed into function, integer (given by applyStuffNThings), Turn Joystick
//setMotorRightVal(applyThingsNStuff(vexRT[joystick], deadzone, throttle), vexRT[joystick])
//Ex. setMotorRightVal(applyThingsNStuff(vexRT[Ch3], threshold, throttle), applyThingsNStuff(vexRT[Ch1], threshold, throttle))
int setMotorRightVal(int dataProcessed, int joyValue){
	int motorValue = dataProcessed + joyValue;
	return motorValue;
}
//Sets the speed of the left motor based off of returned data from applyThingsNStuff function
//2 Parameters passed into function, integer (given by applyStuffNThings), Joystick
//Ex. setMotorLeftVal(applyThingsNStuff(vexRT[Ch3], threshold, throttle), applyThingsNStuff(vexRT[Ch1], threshold, throttle))
int setMotorLeftVal(int dataProcessed, int joyValue){
	int motorValue = dataProcessed - joyValue;
	return motorValue;
}
//Opens the claw on the hold of a defined button and keeps it open as long as the button is held, closing upon button release
//5 Parameters passed into the function, Button, Maximum Speed, Poentiometer, Potentiometer Closed Claw Value, Potentiometer Open Claw Value
//Ex. doPassiveClaw(vexRT[button], integer, SensorValue[potentiometer], integer, integer)
int doPassiveClaw(int button, int maxSpeed, int potentiometer, int closeValue, int openValue){
	int motorValue;
	if(isPressed(button) && getPot(potentiometer) < openValue){
		motorValue = maxSpeed;
		}else if(isPressed(button) == false && getPot(potentiometer) > closeValue){
		motorValue = 0 - maxSpeed;
	}
	return motorValue;
}
//Opens the claw on the hold of a defined button, can be reversed
//3 Parameters passed into the function, Button, Maximum Speed, Boolean Reversed
//Ex. doActiveClaw(vexRT[but ton], integer, boolean)
int doActiveClaw(int button, int maxSpeed, bool isReversed){
	int motorValue;
	if(isPressed(button) && isReversed){
		motorValue = 0 - maxSpeed;
		}else if(isPressed(button) && isReversed == false){
		motorValue = maxSpeed;
	}
	return motorValue;
}
//Assigns 2 buttons to moving the claw arm forward and backward
//3 Parameters passed into the function, Button, Button, Maximum Speed
//Ex. doClawLift(vexRT[button], vexRT[button], integer)
int doClawLift(int button1, int button2, int maxSpeed, bool isReversed){
	int motorValue;
	if(isReversed){
		if(isPressed(button1)){
			motorValue = 0 - maxSpeed;
			}else if(isPressed(button2)){
			motorValue = maxSpeed;
		}
		}else if(isReversed == false){
		if(isPressed(button1)){
			motorValue = 0 - maxSpeed;
			}else if(isPressed(button2)){
			motorValue = maxSpeed;
		}
	}
	return motorValue;
}
//Determines if the user is using the active or passive claw controls defined by the "doActiveClaw" and "doPassiveClaw" functions
//6 Parameters passed into the function, Passive Action Button, Open Button, Close Button, Maximum Speed, Poentiometer, Potentiometer Claw Closed Value, Potentiometer, Claw Open Value
//Ex. setClaw(vexRT[buttonPassive], vexRT[buttonActive1], vexRT[buttonActive2], integer, integer, integer, integer)
int setClaw(int buttonPassive, int buttonActive1, int buttonActive2, int maxSpeed, int potentiometer, int closeValue, int openValue){
	int motorValue;
	if(buttonPassive){
		motorValue = doPassiveClaw(buttonPassive, maxSpeed, potentiometer, closeValue, openValue);
		}else if(buttonActive1){
		motorValue = doActiveClaw(buttonActive1, maxSpeed, false);
		}else if(buttonActive2){
		motorValue = doActiveClaw(buttonActive2, maxSpeed, true);
	}
	return motorValue;
}
task main(){
	int threshold = 30;							//Amount of Deadzone applied to Joysticks - Higher = Larger Deadzone
	int throttlePercent = 90;				//Maximum Amount of Power to Give Motors - Percentage Based (0% - 100%)
	int closeValueRight;						//Value of the Potentiometer when the RIGHT CLAW is CLOSED
	int openValueRight;							//Value of the Potentiometer when the RIGHT CLAW is OPEN
	int closeValueLeft;							//Value of the Potentiometer when the LEFT CLAW is CLOSED
	int openValueLeft;							//Value of the Potentiometer when the LEFT CLAW is OPEN
	int counter = 0;								//Counter for the Calibration Block
	//Autonomous Code - Calibrates the Program to the Potentiometer Values when the Claws are Open and Closed
	while(counter <= 4){
		switch (counter){
		case 0: for(int y = 0 ; y < 12 ; y++){
				motor[motorClaw1] = 32;
				wait1Msec(500);
				openValueRight = getPot(potentio1);
			}
			counter++;
		case 1: for(int y = 0 ; y < 12 ; y++){
				motor[motorClaw1] = -32;
				wait1Msec(500);
				closeValueRight = getPot(potentio1);
			}
			counter++;
		case 2: for(int y = 0 ; y < 12 ; y++){
				motor[motorClaw2] = 32;
				wait1Msec(500);
				openValueLeft = getPot(potentio1);
			}
			counter++;
		case 3: for(int y = 0 ; y < 12 ; y++){
				motor[motorClaw2] = -32;
				wait1Msec(500);
				closeValueLeft = getPot(potentio1);
			}
			counter++;
		case 4: break;
		}
		while(true){
			//Primary Controller Controls
			motor[motorLeft] = setMotorLeftVal(applyThingsNStuff(vexRT[Ch3], threshold, throttlePercent), applyThingsNStuff(vexRT[Ch1], threshold, throttlePercent));
			motor[motorRight] = setMotorRightVal(applyThingsNStuff(vexRT[Ch3], threshold, throttlePercent), applyThingsNStuff(vexRT[Ch1], threshold, throttlePercent));
			motor[motorClaw1] = setClaw(vexRT[Btn5U], vexRT[Btn7L], vexRT[Btn7R], 127, SensorValue[potentio1], closeValueLeft, openValueLeft);
			motor[motorLeftLift1] = doClawLift(vexRT[Btn7U], vexRT[Btn7D], 127, false);
			motor[motorLeftLift2] = doClawLift(vexRT[Btn7U], vexRT[Btn7D], 127, false);
			//Secondary Controller Controls
			motor[motorClaw2] = setClaw(vexRT[Btn5UXmtr2], vexRT[Btn7LXmtr2], vexRT[Btn7RXmtr2], 127, SensorValue[potentio2], closeValueRight, openValueRight);
			motor[motorRightLift1] = doClawLift(vexRT[Btn7UXmtr2], vexRT[Btn7DXmtr2], 127, false);
			motor[motorRightLift2] = doClawLift(vexRT[Btn7UXmtr2], vexRT[Btn7DXmtr2], 127, false);
		}
	}
}
{'fraction_non_alphanumeric': 0.12193176239567992, 'fraction_numerical': 0.02417771232204222, 'mean_word_length': 4.746473906911143, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 11, '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': '2577732', 'n_tokens_mistral': 6071, 'n_tokens_neox': 5193, 'n_words': 1546}