Or, you could attach the victors to a separate fuse panel with its own breaker so that you could turn on the main breaker for control system/ spike/ relay power while the victors would need both switches to be ‘on’ to receive power from the battery.
That would work, except I am looking for something that could be done remotely (I apologize for not making it clearer). Specifically, I’m looking for a better software solution (I’m not very familiar with the IFI system, so I might’ve overlooked a better way to do it).
Thanks for the help.
You could use some small relay. http://www.mouser.com/ProductDetail/Magnecraft-Schneider-Electric/782XBXC-12D/?qs=sGAEpiMZZMtSzCF3XBhmW4S4GljQM3ZrKkytrQ6uppE%3D might be a bit overkill, but I’m sure you could find something similar.
Thanks – but I’ve thought of using a relay already.
Let me add an additional constraint: I’m looking for a purely software solution (for the sake of space, reliability, and simplicity).
Thanks for the help.
If you calibrate the victors such that 127 is neutral by using code rather than joysticks to calibrate them, why couldn’t you just have a toggle switch on the OI to lock all pwm channels at 127?
Because I’d be spending a large amount of time calibrating the joysticks in software – it takes around 25 minutes to download new code and I’d have to “tweak” the center values several times to get it right (I could also display binary through the OI’s LEDs to calibrate them, needing only 2 downloads). If a joystick’s calibration changes (they’re not exactly new, and I’m already noticing drift), or a joystick is replaced, I’d have to do it all over again.
That is a good idea, though; I’d just rather not calibrate them in software.
Thanks for the help.
Edit: To clarify, I think it’s the “correct” solution, but I also think that it’s more difficult to maintain than my “solution.”
But you aren’t calibrating the joysticks, your calibrating the victors.
To fix the joystick drift issues, designate a button that, when pressed, makes the current value the new center and, thus, send 127. Offset from center determines offset from 127.
Calibrating the victors isn’t the hard part… the joysticks would still read something other than 127 when centered, and that has to be compensated for.
Some trimmer pots connected to the OI and a few extra lines of code could compensate for drift in the joysticks and a toggle switch doesn’t drift since it is either on, or not with nothing in between.
Adding in trimmer pots would be adding complexity mechanically/electrically, something I’m not inclined to do (it’s something else to fall apart/get bumped on the OI). Also, a trimmer pot wouldn’t be able to scale the joystick’s input – although the center would be at 127, the endpoints wouldn’t be at 0 and 254 (I believe 0 to 254 is correct, although the exact values are unimportant for the point I’m trying to make).
What would the toggle switch be used for?
Why not calibrate the Victors, then have a switch that sets all outputs to 127 rather than the joysticks.
Trivially simple.
I’m starting to think that you’re over-complicating the issue, then complaining when the solutions are complicated. No matter how you slice this pie, its going to take a little work, some added parts, or both.
Why not calibrate the Victors, then have a switch that sets all outputs to 127 rather than the joysticks.
The joysticks don’t read “127” when they’re centered – outputting “127” would cause the robot to move. It’s not tough to find out exactly what needs to be output to stop the motors, but if (when) the joysticks drift, re-calibrating would require a code download to adjust for the new bias (not a big deal, unless the issue’s discovered 5 min. before a presentation or something).
I’m starting to think that you’re over-complicating the issue, then complaining when the solutions are complicated. No matter how you slice this pie, its going to take a little work, some added parts, or both.
I’m comparing the solutions proposed with the solution I came up with (conditionally calling Generate_Pwms()). In terms of maintainability (which suffers (even if only a little) if I need to compensate for the joysticks’ biases) and reliability (which suffers (even if only a little) with electrical solutions (I am referring to using a relay)), conditionally calling Generate_Pwms() appears (to me) to be the best solution so far.
Thanks for all the great solutions.
This isn’t true. I spent years programming on the IFI system. If you calibrate the victors properly (which takes mere moments, and a BIC pen), and then specifically output 127, they will not move. Not tomorrow, not a year from now, never. I’m not saying let the joystick control it, I understand they drift. I’m saying have a switch, or trigger pull, or something to put it in “sit mode” where you tell it 127 specifically. This won’t result in a much different system than just no calling the pwms, but it works perfect (and you can do it on more than 2 outputs).
We used to have a psuedo-disable that just 127’d all outputs and it was used routinely during programming/debugging. Hundreds of hours of robots with 6-10 victors all content with their neutral signal and never moving.
That’s news to me… I’ll have to try that out (since an unplugged joystick reads as exactly 127, it’s a really easy thing to test).
Thanks for letting me know about that – this is exactly the type of advice I was looking for. I’ll let you know if it doesn’t work for us – I thought I tested this before (with differing results from what you obtained), but I wasn’t very thorough about it.
It’s been mostly covered already, but please do not calibrate the victors for a center value other than 127. **This is a serious safety hazard! ** If the joysticks on your OI become unplugged, the values will default to 127. If your victors are calibrated for something else, your robot will start moving! This is not good, especially since many people ignore the safety warnings and get too close to the robot to work on it or look at it when it’s not disabled.
I strongly recommend that you write a “calibration program” that outputs 127 on all PWMs, and then can output 254 and 0 when two different buttons are pressed. Use this program to calibrate all your victors (this way they’re also interchangeable). Then, write some code that deals with the joystick inputs. What you probably need is a dead zone, so that any joystick values from say 117-137 get mapped to an output of 127. If you search around CD, there should be many code examples of joystick code for dead zones & scaling. I’m sure it seems like more work to you, but this really is the correct (and safe) way to implement this. Then, you can easily have a switch that forces all outputs to 127.
My understanding of the way the IFI RC works is that there will be no way to keep the relay outputs enabled while simultaneously disabling the PWMs, other than the user-generated PWM functions that you’ve found. But be aware that those user PWMs can be jittery if your code is too complicated, and this can cause your motors to twitch and move even when you are outputting a neutral value of 127.
Seems to me the easier solution is to just fix your compressor such that its relay is switched on by the pressure switch, and take the RC completely out of the compressor equation.
The jitter only occurred with the IFI default code. Kevin Watson released code to use onboard PWM generators on the PIC which fixed that issue. http://www.kevin.org/frc/ look for frc_pwm.zip. It’s also included in his code that’s compatible with version 3 of the C18 compiler.
P.S. I didn’t read closely enough. You clearly said switch the relay.
Don’t wire the pressure sensor directly in-line with the Spike. The pressure switch (5 amps) isn’t rated for the current draw of the new or old compressor (10 amps), or the peak at startup of 25 amps.
That 25 amp startup is also why FIRST recommends that the 20a fuse in the Spike be replaced with a self-resetting 20a breaker.
Very true (our mechanical team blew a switch doing exactly that one summer… they never asked the electrical team to hook it up for them or we would have done it right). However, the switch can be used as signal inputs directly into a relay - then the relay handles the big current load, while the switch needs a much smaller current to activate the relay.
I strongly recommend that you write a “calibration program” that outputs 127 on all PWMs, and then can output 254 and 0 when two different buttons are pressed. Use this program to calibrate all your victors (this way they’re also interchangeable). Then, write some code that deals with the joystick inputs. What you probably need is a dead zone, so that any joystick values from say 117-137 get mapped to an output of 127. If you search around CD, there should be many code examples of joystick code for dead zones & scaling. I’m sure it seems like more work to you, but this really is the correct (and safe) way to implement this. Then, you can easily have a switch that forces all outputs to 127.
Thanks for mentioning a dead zone – I’ve never thought about it for this one bot before, but we really need it.
Kevin Watson released code to use onboard PWM generators on the PIC which fixed that issue.
I had forgotten about his libraries – I see he also has an EEPROM library, which would make maintenance of solutions based on joystick calibration easier (I didn’t think about using non-volatile memory for calibrations until I saw that).
Seems to me the easier solution is to just fix your compressor such that its relay is switched on by the pressure switch, and take the RC completely out of the compressor equation.
That’s an angle that I’ve never thought about. Unfortunately, though, the compressor logic is more complicated – the drivers can enable or disable the compressors through the controls (the bot is used for more than just t-shirt launches, so pneumatics aren’t always needed or desired).
Thanks for all the help – I’ll write a joystick calibration routine that saves the values to the EEPROM, then just set the outputs to 127 to “disable” the bot.
I amended my post Seconds After I posted it, It no longer suggests trimmers, but rather a method of on the fly calibration. Which I now no longer recommend. If you are still worried about drift, program it such that any joystick input from 117 to 137 sends 127 to the victors.
The toggle switch would tell the robot to ignore the joystick values and send 127 to the victors no matter what as long as the switch is ‘on’.