|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
periodic tasks behaving differently in autonomous vs teleop (labview)
Hi all!
We've been messing with autonomous (in labview) and have come across something that we're not sure how to handle. We have a PID vi (supplied by FIRST I believe) in our periodic tasks portion of the code, and it works great for teleop. But for some reason, it behaves differently when we're in autonomous mode, and the shooter oscillates/is unstable/has a much larger steady state error. All we do in autonomous is set our set point (wheel speed rpm desired) and look at a shared variable saying if the rpm is close enough to the desired to shoot. We also have the while loop in autonomous running at the same frequency as the while loop with the pid in periodic tasks. Lastly, we've confirmed that gains are all set correctly as defaults. Any thoughts on causes? Or fixes? I think tomorrow we may just create an additional pid in autonomous and have a different set of gains, but that's really a band-aid I would think, there must be something I'm not taking into consideration. Thanks! |
|
#2
|
||||||
|
||||||
|
Re: periodic tasks behaving differently in autonomous vs teleop (labview)
One possibility is that the autonomous code is taking so much CPU time that it is slowing down the periodic tasks loop. There is a VI that is supplied by NI that will report the actual time that it takes to run each loop (I can't remember the name right now, but if you look in the vision processing example, it is included there). Place that VI in your periodic tasks vi and run your code using the play button. Run in teleop and auton and see if the loop time is different for each.
Also, I'm assuming you are passing your set point from your autonomous code to periodic tasks via a global variable. Is it possible that the global variable is being set in multiple locations? Run via the play button and place a probe on the set point signal just before the PID VI to check that the set point is staying constant. |
|
#3
|
||||
|
||||
|
Re: periodic tasks behaving differently in autonomous vs teleop (labview)
from a guy with minimal labveiw knowledge:
How do u collect your angular velocity? How do you enter that data to be used (world variables, internal variables, what?)? Have you tried setting the "desired speed" to zero to see if it dose anything (we all know it shouldn't spin the wheel, that's the point)? Have you tried different speeds and seen if it happens at all different speeds? Are you trying to reverse the motor when it goes to fast or are you just having it idle? Have you asked those in charge of the mechanical and wiring to check over the robot for issues? Have you described to them what you are having the code do and see if you are doing anything in autonomous that isn't fitting design constraints or design intent? |
|
#4
|
||||
|
||||
|
Re: periodic tasks behaving differently in autonomous vs teleop (labview)
Thanks for the fast replies! And all with good questions that have answers I should have included in my first post.
@Chris - that was essentially our first thought as well. We have both loops set to run once every 40 ms, but it might be worth putting in the vi and measuring the actual time it takes to run as well. I'd be surprised though if 25 Hz is too fast. We are using a shared global variable - and it's only written to in a handful of places, but it's definitely worth probing and ensuring that the set variable is constant, and what we expect it to be. @Peck - (from one guy with minimal labview knowledge to another...) we collect our angular velocity from a hall effect sensor and a magnet on our wheel. It's in a global shared variable and it's assigned (from the sensor to a variable) in the same periodic tasks function (though perhaps at a different frequency - something to check out and perhaps change!) We haven't tried setting the "desired speed" to zero in autonomous or any other speeds - but the fact that it handles that desired speed in teleop fine, but not in autonomous is predominately what concerns me. When the motor overshoots, it just coasts back to a slower speed (both in autonomous and teleop) and is NEVER put in reverse. We have worked with mechanical, but I am convinced it's in software. The same code acts differently in autonomous rather than in tele-op. That is a strong indication that it's software. |
|
#5
|
||||
|
||||
|
Re: periodic tasks behaving differently in autonomous vs teleop (labview)
Tx for the replies.
The reason I said to run at 0 and at other speeds is to check your loops. If you run at 0 and it moves, u know that your code is accelerating the disk before you collect the data which may cause choppiness in operation. If you run at other speeds and it still happens, That eliminates a possible error point. Without seeing your code, all we can do is recommend things to try. EDIT: almost forgot: when running at 0, it will also show if you have something in your code changing the value by a set number or to a set number. when running on other values, u can see if there are any alterations by multiplication. If all other (meaning other then the one you want) speeds are fine, it ain't ur code (or you fixed it). Last edited by Peck : 18-04-2012 at 09:01. |
|
#6
|
||||
|
||||
|
Re: periodic tasks behaving differently in autonomous vs teleop (labview)
Well I get to do what every programmer hates (yet also secretly is relieved) to do.
It was a user error (which everyone expects). Y'alls advice of setting the wheel speed to zero helped find it quicker. We did have to different instances trying to write to the same variable. We had some "ghost code" (kind of) that was trying to set the wheel speed. It does that to in tele-op, but we have a case statement of listen to vision code or don't listen to vision code in tele-op. Nothing of the sort of Autonomous. Once we took that out, things looked much better. Thanks for the help Peck and Chris! |
|
#7
|
||||
|
||||
|
Re: periodic tasks behaving differently in autonomous vs teleop (labview)
no problem, glad to help.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|