Log in

View Full Version : Vex Ultrasonic not working for new 2015 system


FurryFaust
20-01-2015, 16:57
The Vex Ultrasonics' code is crashing the robot. As soon as a certain line of code runs (pinpointed on robot init), the driver station immediately disables and says no robot code. I have tested this with 2014's robot system which has not been an issue however this issue only occurs with 2015's.

package org.usfirst.frc.team334.robot;

import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Ultrasonic;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboar d;

public class Robot extends IterativeRobot {

Ultrasonic ultrasonic = new Ultrasonic(1, 2);

public void robotInit() {
ultrasonic.setAutomaticMode(true);
}

public void autonomousPeriodic() {
SmartDashboard.putNumber("Ultrasonic Value", ultrasonic.getRangeInches());

}

public void teleopPeriodic() {

}

public void testPeriodic() {

}
}

mdrouillard
09-02-2015, 10:59
IN JAVA: We spent an entire day on this, doubting our wiring, our code. We even created a brand new empty shell using gearsbot command based as a starting point, but only adding the vex ultrasonic digital sensor. We could not get it to work. So, we then did the same thing but switched to C++...

It worked in C++. We believe there is a bug in the Java library. But without anything concrete in team updates or elsewhere on CD....

So, we are now switching our robot to C++ as we need these rangefinders on the robot. So, give it a try in C++ and report back. We are not looking back now....

md

mdrouillard
12-02-2015, 12:58
Just an update everyone. We were able to get it to work under JAVA after all. At this point we are not sure what changed, but there was an re-image to the roborio that was done. So, it may not be a library bug after all. I just did not want anyone chasing ghosts on this...

md

FurryFaust
14-02-2015, 09:47
Thank guys. We reflashed the roborio and it's working now!