Hi guys,
First, thank you to all of Long Island for having is this past weekend!
I’m having a weird issue, I’m using Talons to power CIM Motors for our shooter. When a button is assigned to them, the voltage reads 8Volts, when the joystick is applied I get the full volts, solid green and red lights.
After calibrations and such, I can’t figure it out. Can we just not use assign buttons to talons?
if (joystick.getRawButton(SHOOTER_BUTTON))
talon.set(1.0);
Sometimes a button on a joystick is read as an axis on the computer. For example, the xbox 360 controller finger triggers (bumpers or whatever they’re called) actually count as axis and you’ll get a variable value instead of a true/false.
Electrical resistance will make your voltage drop.
There is some resistance in a talon, but not that much. This particular talon could be a bad one though, with a greater resistance.
Wire has resistance as well. If you have long wire runs, the voltage could easily drop to 8v by the time it reaches the motor. This calculator shows you how severe that effect may be. http://www.calculator.net/voltage-drop-calculator.html
There could be a loose or badly terminated wire somewhere along the path. This would increase resistance, further lowering voltage.
Also, it is possible the value you get is what the current battery voltage is. These batteries don’t always output 12v, but I’m sure you knew that.
It could also be that your voltmeter isn’t great, or has poor connections.
If the lights on the talons are flashing as you press the button, I’d think it was code. if their not, its probably something else.
Your code looks correct, assuming it runs every loop.
Its set to two talons, but for the sake of this i’m just writing the program as it would be if i only have one. The wire length is closer than any other motor control set up that we have.
So when I revised the program to have it read as such
if (js.getY()> 0)
{
shooter.set(1);
}
so if i move my joystick forward my shooter will go forward. When i run this program i have no problem at all, robot works fine and it reads 12+ V.
I’ve even switched out these talons with other talons to eliminate as much as could be and for some strange reason, being set to a button doesn’t give it full speed.
First, I would personally supply “1.0” instead of “1” - I’ve had issues in the past (in other systems, not necessarily on an FRC system) with the conversion from int to double causing issues with stuff. This way you’re supplying the double directly, instead of making the compiler convert it.
Try setting the speed to a variety of values (I would go 1.0, 0.9, 0.8, etc, all the way down to -1.0) and see what voltage you get out of the Talon for each value. Then do the same thing feeding in a joystick, printing out the joystick value as you go so you can get it at about the same values. This will let you plot two response curves, which may help us figure out what’s wrong.
Ahh… more information, makes more thoughts… What other code do you have around this motor? I assume somewhere you’re telling it to stop and/or go in reverse?
I’ve stripped down the code, and removed it from all other variables, started a new file so all i have running is the button, and the js.getY(), (1 is being commented out when the other one is in use). And the results are still the same with the main program. It reads out 1.0 on the driver station, but shows a blinking light, and only reads ~8 volts on a voltmeter when done on a button.
yea as i essentially just have the shooters set up to the drive train so its just the wheels running forward, rather than an arm just swinging around I didn’t want to risk any other method of coding to be part of the issue. I’ll try putting it on different speeds and seeing if the output values change
Makes no sense that the axis is causing the Talon to give a different voltage than the button. If it were an electrical problem, you should see consistent and identical results for axis vs. button.
One problem I’ve frequently seen is:
if (js.getRawButton(SHOOTER_BUTTON))
shooter.set(1.0);
System.out.println(shooter.get());
… 200 lines of code later …
shooter.set(0.7);
Prints 1.0 but sets to 0.7.
If you’re multi-threading, maybe something else in another thread is modifying the shooter?
It just doesn’t make sense that the problem is electrical related. If you don’t want to post your code, it’s fine, but we can at least help you eliminate the possibility of the problem being your code.
public class WhyYouNoWork extends SimpleRobot{
Joystick js = new Joystick(1);
Talon shooter = new Talon(1);
public void robotInit(){
}
public void autonomous(){
}
public void operatorControl(){
while(isOperatorControl() && isEnabled()){
if (js.getRawButton(11)){
shooter.set(1.0);
}
}
}
I have never come across a problem that’s baffled me as much as this has. Is it possible to calibrate the talons while applied on a button, or does it have to read Y-axis for it to work.
To calibrate the Talons, you should bring them through the full -1 to 0 to 1 range.
1. Press and hold the button labeled “CAL” with a paper clip. The
LED should begin to blink red/green.
2. Continue to keep the button pressed while moving the joystick
full forward and full reverse. You may do this as many times as
you like.
3. Center the joystick and then release the CAL button.
4. If calibration was successful, the LED will blink green several
times. If the LED blinks red several times, the calibration was
not valid. If this happens, the Talon will use the last valid
calibration values.
Did the new project with just the button code work?
To answer the electrical questions. The shooter is composed of two CIMs, brand new. Talons, out of the box, and PWMs from AndyMark. The solder-less terminals that connect the wiring are all solid. The raceway for ALL these wires are not ran in a configuration that runs against the chassis or may have been cut, all clean, short, out in the open runs. Instead of having the load on the motors, the multimeter replaced the terminals on the talons so when the actions are live, we have the 12V and the 8V read outs on the display and the Talon LED indicator light.
With this program are two limit switches that prevent the arm to destroy it’s self when it fires, and when it returns back to loading position.
They work fine, we get zero volts when they are depressed.
I’m not sure that reading the output of the Talon with a voltmeter is the correct approach to understanding what is happening. You see the output of a speed controller is a pulsed output that switches between 0 and 12 VDC.
It’s the duty cycle (ratio of on to off time) that determines the speed of the motor. What you are probably seeing is the average voltage that the meter is reading over time. An oscilloscope is a better tool to use for this application.
Now having set that straight, I am also puzzled why you are reading a different average voltage output based on whether the joystick axis or the programmed button is providing the controlling input to the Talon’s PWM input. If you have access to an oscilloscope can you see a difference in the pulse width of the PWM output to the Talon?