|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: Robot "twitching?"
The problem is that Fire has a number of large delays.
If the safety feature is active and the motors aren't updated by that deadline, the motors will be set to speed zero. This is primarily to keep the robot safer when you hit a breakpoint in the code or get into an infinite loop, etc. The other reason you don't really want large delays in teleop is that it will cause the code to ignore the joystick for several seconds. Depending on what the robot and driver are doing at the time, this could be fine. In that rare case, simply turn off the safety config in Begin. Typically, the better solution is to move the delayed code out of teleop and run it in parallel, or make it into a state machine that performs the operations a little at a time over a number of teleop calls. Both of these are valid approaches, but the easier of the two is probably to take the Safety code and place it into a loop in Periodic Tasks. Have the periodic loop read a global that tells it to fire, and in teleop, set the global instead of calling the function. Be sure to reset the global. You can also look at using a notifier if you feel up to it. Greg McKaskle |
|
#2
|
||||
|
||||
|
Re: Robot "twitching?"
Quote:
I'm not sure what you guys mean by "run it in parallel." How do I run the fire sequence when a button is pushed in teleop? We made "FIRE" so that multiple things would happen in sequence to shoot the Frisbees without many joystick inputs having to be received at a time. We want to run this sequence in teleop to shoot one frisbee after another until any discs loaded will fire. Is this delay problem the reason the two motors (motor 1 & 2) don't stay on when the sequence moves to the next frame? |
|
#3
|
|||||
|
|||||
|
Re: Robot "twitching?"
All the stuff that feeds into FIRE including the joystick gets for axes and buttons, can all be copied and pasted into clear space in Periodic Tasks.vi.
Then put a While loop around it that never ends, and put a 10ms Wait in there so it doesn't suck all the life out of the cRIO. There's nothing special about Teleop that gives it exclusive access to the Joystick controls. They can be read in Teleop and in Periodic Tasks, or other places, too. The advantage of Teleop is that it only gets called whenever there are new joystick values to process, so it's more efficient. Run the loop in Periodic Tasks a little faster than the 20ms communication packet rate and it won't matter that you're sometimes reading joystick info twice sometimes. The duplicate info won't be the the signal telling you to FIRE. Last edited by Mark McLeod : 09-02-2013 at 12:58. |
|
#4
|
||||
|
||||
|
Re: Robot "twitching?"
Quote:
And thank you guys for all the quick responses!! Last edited by Invictus3593 : 09-02-2013 at 13:28. |
|
#5
|
|||||
|
|||||
|
Re: Robot "twitching?"
We were having the same problem and tried your safety solution but it didn't fix it. Now it's not responding at all.
|
|
#6
|
||||
|
||||
|
Re: Robot "twitching?"
I got the robot to stop twitching! Not by disabling the safety, but by moving the code I had running delays to periodic tasks. But now the joystick values don't ever get updated. Without the compressor, the sequence runs perfect, just how i wanted it
![]() Last edited by Invictus3593 : 09-02-2013 at 14:36. |
|
#7
|
|||
|
|||
|
Re: Robot "twitching?"
Quote:
Are there messages being sent to the diagnostics? Greg McKaskle |
|
#8
|
|||||
|
|||||
|
Re: Robot "twitching?"
Quote:
I don't want to thread jack. |
|
#9
|
|||||
|
|||||
|
Re: Robot "twitching?"
That probably means the Joystick Gets are misplaced.
Post the code you have now and we'll help troubleshoot that. |
|
#10
|
||||
|
||||
|
Re: Robot "twitching?"
Here are both Teleop and Periodic Tasks. Do you need begin for the compressor's start?
The sequence in periodic works great, but no relay fired. EDIT: It gave me an code of "-44027" when I put a probe on the error line in Begin.vi. I'm not sure what that means, but it told me it's an unidentified error. Last edited by Invictus3593 : 11-02-2013 at 16:23. |
|
#11
|
|||||
|
|||||
|
Re: Robot "twitching?"
No Relays were harmed in the running of this code, because those are solenoids.
What kind of solenoid are you using? The code assumes it is a single solenoid (one physical set of wires). the solenoids we've goten in the kit the past couple of years have been double solenoids (two sets of physical wires). Post your Begin so we can check that out too. P.S. to your edit. A -44027 error is "FRC: The DIO channel has already been allocated." That means you've specified the same DIO more than once in Begin.vi. Probably the default DIO 1 came up twice. You can get info on the mysterious error numbers by going to Help->Explain Error... and typing in the error number (remember to include the negative sign if appropriate). Last edited by Mark McLeod : 11-02-2013 at 16:25. |
|
#12
|
||||
|
||||
|
Re: Robot "twitching?"
Single, it's the one from the kit, but we only connected one set of wires from the double solenoid, it works great *thumbs up!*
Here's begin for ya! |
|
#13
|
||||
|
||||
|
Re: Robot "twitching?"
You're right, I was opening DIO1 twice instead of both 1 & 2! It works perfectly now! Thanks for all your help man!
|
|
#14
|
|||||
|
|||||
|
Re: Robot "twitching?"
I see the two DIO 1's in there.
The Watchdog code isn't necessary, it's pretty circa 2009. The Safety Config took over that job. Where are you feeding it? Unfed it will shut things down. A double solenoid shouldn't work treated as a single solenoid, because real singles have a spring return, while doubles do not. I'll have to try that myself at robotics tonight. Learn something new every day. Is the first green LED on the Solenoid Module going on/off when you run your sequence? That's the best verification that your code is working. Last edited by Mark McLeod : 11-02-2013 at 16:45. |
|
#15
|
|||
|
|||
|
Re: Robot "twitching?"
I don't know if you already did it. But all you need to do is put a "dead area". In other words what is happening is your joystick are actually sending a slight amount of value to the motors, even though they aren't pushed. So just create a code that says if joystick value is between -.1 and .1 don't move.
Hope this helps, Alex Guckenberger |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|