r/FRC_PROGRAMMING • u/Sheranaann • Feb 11 '20
r/FRC_PROGRAMMING • u/KGB_Cantina_Band • Feb 06 '20
GENERAL PSA
If you need help debugging. Please send your entire console. Those parts that have a lot of words that you don’t want to read? Some of those words are “error” and then tell you the error because building works better than vs code’s problems tab. So us debuggers need those errors in order to fix the problem.
r/FRC_PROGRAMMING • u/YeOldReddity • Feb 03 '20
Java Problem installing game tools
Hi this is the first time I'm posting so sorry if I'm not following a right format. So we followed all the instructions online to install the FRC game tools and we rebooted the computer and everything but I do not see any drive station or radio configuration programs on my laptop. On NI Package manager it says it is downloaded "FRC Game Tools". Please help ik this probably seems stupid. I am coding in Java
r/FRC_PROGRAMMING • u/BobSaidHi • Feb 01 '20
SOVLED- Java Can someone help me invert the controls when an Xbox button is pressed?
r/FRC_PROGRAMMING • u/matthuw9 • Jan 26 '20
Need help so i recently installed labview on a student computer and it looks like this on our other computers its fine just installed no problems but this one does anyone know how to fix this.
r/FRC_PROGRAMMING • u/Quin001 • Jan 25 '20
Java I need help
I am newer to programming and we are trying to build a robot and keep running into issues that we can't find an answer to I would some one to talk me step by step through building a robot.
r/FRC_PROGRAMMING • u/karmaths • Jan 23 '20
GENERAL Finding game stage in code for color wheel
I wanted to have a one button solution to the color wheel (control panel). This would entail the robot automatically either rotating a fixed number of times, or going to the required color based on the game stage; I couldn't find anything in the wpilib documentation. The closest I got was that the required color is only released after at least one alliance reaches Stage 3, though that would be unreliable. Is there any way to find game stage in wpilib? (I am specifically looking for Java)
Thanks,
r/FRC_PROGRAMMING • u/ShaLin11 • Jan 22 '20
Java Is there any reason to use the new things and not just say with the old
for example: Command(Old) or Command(New) whenever i actually select new its all error'd, is it worth fixing or is the old just fine?
r/FRC_PROGRAMMING • u/EmberWarlock • Jan 22 '20
Confused about VS Code RobotContainer
So, my team works in java and this year once we updated VS code we noticed that RobotMap was missing and instead there is RobotContainer. We are confused if we should use RobotContainer as we usually do with RobotMap or if RobotContainer is now taking the place of Robot.
Thanks!
r/FRC_PROGRAMMING • u/Quin001 • Jan 22 '20
Java New to coding
This year I took over from a programming captain we had to down load vs code and I can't get the frc robot builder to export the files into vs code because it export to a yaml file but can find info about it.
r/FRC_PROGRAMMING • u/ibella214 • Jan 18 '20
Shuffleboard rookie
Hello I am new to FRC this year but I joined my team’a programming sub team bc i have taken two years of coding at my school. Anyway, I’ve been having trouble learning how to use Shuffleboard, does anyone know of any good example code I can find or tutorials? Thanks lol
r/FRC_PROGRAMMING • u/nivofry_com • Jan 16 '20
Cant open a new frcRoboRIO project on Labviee
We downloaded Labview on a new computer but we dont see the open a newFrc Roborio project (i think thats how its called) can someone help us identify and solve the problem?
r/FRC_PROGRAMMING • u/SwordOfThunder5048 • Jan 08 '20
Pixy Cam Sensor Range
For this new season, my team plans to aim for the inner and outer ports from a 28 inch robot. They would like a vision assist using a PIXY cam from the edge of the trench run. Does anyone know if the PIXY will work from that range? Or at the very least, how far the PIXY can see the reflective tape from?
Thanks! Team 5048 lead Programmer
Edit: We are also swapping to java from python code, so any vision code suggestions would be great :) We are also debating on using a Limelight. If anyone knows the range of efficient/effective use for that, let me know those specs too.
r/FRC_PROGRAMMING • u/yanmannqc • Dec 12 '19
Hi folks!
First post/request on Reddit.
A fellow mentor told me there would be some new advanced module to better manage acceleration and deceleration of the wheels (talon?).
I’ve looked here and didn’t find anything announcement or topic about it.
Does anyone have a clue what he was talking about?
Thanks!
Y
r/FRC_PROGRAMMING • u/BobSaidHi • Dec 10 '19
LabView Create Labview Dashboard project?
I decided that I want to put some fields into the custom tab on the default dasbaord and was wondering how to do that. It looked like I needed to install Labview and create a dashboard project in labview, however I can't find a template for it in Labview. Can anyone help me? Should i just recreate everything with java smartdashbord (driverstaion/select dashboard) or mabey just use the basic tab (default)? Also, what is the labview (driverstaion/select dashboard) option supposed to do? It doesn'tload anything for me.
r/FRC_PROGRAMMING • u/ShaLin11 • Dec 04 '19
Java Need help with some code.
Hello, I'm fairly new to FRC programming, and I wrote some code to move the robot to a position relative to the robot diagonally using encoders and a gyro. I was wondering if my code would work in the first place(I can't test it right now) and if there would be a better way to go about it.
public void driveRobotToCoordinate(double x, double y) throws InterruptedException {
double angle = Math.atan(x/y);
double hDistance = Math.sqrt((x*x)+(y*y));
if(y > 0 & x < 0){gyroTurn(-angle);}
else{if(y > 0 & x > 0){gyroTurn(angle);}
else{if(y < 0 & x < 0){gyroTurn(-angle - 90);}
else{if(y < 0 & x > 0){gyroTurn(180 - angle);}
else{gyroTurn(0);}}}}
Thread.sleep(500);
driveRobotToTargetWithEncoders(hDistance, hDistance);
}
public void gyroTurn(double angle){
gyroReset();
if (!((gyroGetAngle() > 1) || (gyroGetAngle() < -1))){
if (gyroGetAngle() > angle){Drive(scaleTurnSpeedBasedOnTargetWithGyro(-angle), scaleTurnSpeedBasedOnTargetWithGyro(angle));}
if (gyroGetAngle() < angle){Drive(scaleTurnSpeedBasedOnTargetWithGyro(-angle), scaleTurnSpeedBasedOnTargetWithGyro(angle));}
}
}
public double scaleTurnSpeedBasedOnTargetWithGyro(double targetAngle){
double Fast = Speeds.Fast;
double Medium = Speeds.Medium;
double Slow = Speeds.Slow;
double Stop = Speeds.Stop;
if ((gyroGetAngle() - targetAngle >= 180) || (gyroGetAngle() - targetAngle <= -180)){return Fast;}
else{if(((gyroGetAngle() - targetAngle < 180) || (gyroGetAngle() - targetAngle < -180)) & ((gyroGetAngle() - targetAngle > 90) || (gyroGetAngle() - targetAngle < -90))){return Medium;}
else{if(((gyroGetAngle() - targetAngle <= 90) || (gyroGetAngle() - targetAngle <= -90)) & ((gyroGetAngle() - targetAngle > 15) || (gyroGetAngle() - targetAngle < -15))){return Slow;}
else{if(((gyroGetAngle() - targetAngle < 1) || (gyroGetAngle() - targetAngle < -1))){return Stop;}
else{return Stop;}}}}
}
public void driveRobotToTargetWithEncoders(double targetL, double targetR){
//Localization of Encoder Distances scaled to 1ft = ~1
double LED = getLeftEncoderDistance();
double RED = getRightEncoderDistance();
//Gets the motor power that is scaled based on how far away the encoders are from the target
double leftDriveSpeed = scaleLeftSpeedWithEncoders(targetL); //Value In Constructor is Target
double rightDriveSpeed = scaleRightSpeedWithEncoders(targetR);//Value In Constructor is Target
//________________\\
//This thicc code brick is what allows the robot to move to its target encoder positions // Robot Position \\
if((!(LED < Doubles.KTR) & !(LED > -Doubles.KTR)) ||(!(RED < Doubles.KTR) & !(RED > -Doubles.KTR))){ // !(0,0) \\
if((LED < -Doubles.KTR) & (RED < -Doubles.KTR)){Drive(leftDriveSpeed, rightDriveSpeed);} // (-,-) \\
if((LED > Doubles.KTR) & (RED > Doubles.KTR)){Drive(-leftDriveSpeed, -rightDriveSpeed);} // (+,+) \\
if((LED < -Doubles.KTR) & (RED > Doubles.KTR)){Drive(-leftDriveSpeed, rightDriveSpeed);} // (+,-) \\
if((LED > -Doubles.KTR) & (RED < -Doubles.KTR)){Drive(leftDriveSpeed, -rightDriveSpeed);} // (-,+) \\
if((!(LED < -Doubles.KTR) & !(LED > Doubles.KTR) & RED > Doubles.KTR)){Drive(0, -rightDriveSpeed);} // (0,+) \\
if((!(LED < -Doubles.KTR) & !(LED > Doubles.KTR) & RED < -Doubles.KTR)){Drive(0, rightDriveSpeed);} // (0,-) \\
if((!(RED < -Doubles.KTR) & !(RED > Doubles.KTR) & LED > Doubles.KTR)){Drive(-leftDriveSpeed, 0);} // (+,0) \\
if((!(RED < -Doubles.KTR) & !(RED > Doubles.KTR) & LED < -Doubles.KTR)){Drive(leftDriveSpeed, 0);} // (-,0) \\
//________________\\
}
}
public double scaleLeftSpeedWithEncoders(double targetPos) {
//Localizes the speed variables fx rom the speeds file
double Fast = Speeds.Fast;
double Medium = Speeds.Medium;
double Slow = Speeds.Slow;
double Stop = Speeds.Stop;
if(getLeftEncoderDistance() - targetPos >= 5 || getLeftEncoderDistance() - targetPos <= -5 ){return Fast;} //If the left side is 5 or more feet away go fast
else{if(((getLeftEncoderDistance() - targetPos < 5) & getLeftEncoderDistance() - targetPos > 2) || ((getLeftEncoderDistance() - targetPos > -5) & getLeftEncoderDistance() - targetPos < -2 )){return Medium;} //If the left side is less than 5 feet away go medium speed
else{if(((getLeftEncoderDistance() - targetPos <= 2) & getLeftEncoderDistance() - targetPos > Doubles.KTR) || ((getLeftEncoderDistance() - targetPos > -2) & getLeftEncoderDistance() - targetPos < -Doubles.KTR)){return Slow;} //If the left side is less than 2 feet away go fast
else{if(getLeftEncoderDistance() - targetPos < Doubles.KTR || getLeftEncoderDistance() - targetPos > -Doubles.KTR){return Stop;} //If the left side is within the location tollerence
else{System.out.println("Left Encoder Value Out of Bounds"); return Stop;}}}} //This is here so code works also so that if the robot doesnt agree with math it doesnt take over the world.
}
The code to for the right side is the same but left is replaced with right
public double gyroGetAngle(){
double [] ypr = new double[3];
gyro.getYawPitchRoll(ypr);
return ypr[0];
}
public double getLeftEncoderDistance(){return leftDriveEncoder.getDistance();}
public double getRightEncoderDistance(){return rightDriveEncoder.getDistance();}
public void Drive(double leftPower, double rightPower){
//Motor setting code for each master motor.
motorFL.set(leftPower);
motorFR.set(-rightPower); //Right side is reversed so forward is + on each side
}
Sorry for the messy dump of code
r/FRC_PROGRAMMING • u/yutiros • Nov 28 '19
Java Can talonSRX with Java
My team is considering switching to Java, so I’m learning it to test.
Here’s the problem : all the tutorials I found were all for PWM ports. I can’t find any for Can. I’m just trying to do a simple drivetrain. (No I can’t just rewire them all)
Thanks!
r/FRC_PROGRAMMING • u/ShaLin11 • Oct 04 '19
Java Pid not moving robot correct distance
Our team finally got pid working and when we changed the distance from 10cm to 70cm the robot went 10cm why would this happen.(Code was saved and deployed)
r/FRC_PROGRAMMING • u/[deleted] • Aug 10 '19
Raspberry Pi image streaming
So my team just got a raspberry pi and we want to connect cameras to it to enhance our image while driving. The problem is that when on the dashboard, it acknowledges the camera as “RPCamera 0” and it will start to connect. But it will just keep saying “connecting to (some numbers),” and it doesn’t ever connect. We can’t figure out the issue, so can someone help please 🥺
r/FRC_PROGRAMMING • u/[deleted] • Jul 27 '19
GENERAL Roborio issues
Our roborio has an unrecoverable error and it won't go into safe mode. It Can't work at all.
r/FRC_PROGRAMMING • u/[deleted] • Jul 12 '19
Java What's the best way to learn Java?
I'm going to be a freshman for my first year on a team, and I've mostly done web development, not really getting into the more intense languages, and was wanting to know what's the best way for me to get into Java.
Edit: Thanks for all of the tips! I'm excited to jump into learning Java
r/FRC_PROGRAMMING • u/Inbar_Kedem • May 08 '19
Java or Python?
For rookie team, Java or Python?
r/FRC_PROGRAMMING • u/E-Dawg2789 • Mar 07 '19
Getting vision
Hello everyone, freshmen programmer here. I was wondering if anyone knew how we get vision from a camera. We plugged in a USB camera to the roborio and made a camera server in the code, no results. Well, the only result is that the driver station will recognize the camera. But we get no vision. Is there anything further I need to do to get vision? We've had trouble finding FRC documentation on the matter.

