I’m getting some weird coding faults with Labview. Apparently, two out of three boolean variables that I’ve created refuse to have variables set to them. I’ve checked code over and over again, and nothing seems to be weird about them. They’re not contained in the same libraries, and I’ve tried to minimize the libraries down but I’ve kept them in around 4 libraries for catagorization reasons.
They’re all being initialized in Begin, and being reset in Finish. Besides that, they should just be getting set to true or false variables via Case Structures. Also, all three variables in question are globals, and I’ve tracked their variables by converting them to a 8-bit integer and outputting them in the User Messages pane of the classmate.
One instance is one I made the other day to do work for our encoder. Simply, all it is assigned to do is be true in Begin, true in Finish. In Teleop, it is the conditional for one case structure. For true, it starts encoder tracking, and sets itself to false. Once false, the structure executes the Get Encoder VI (forgot exactly what it was called). I made that so that it doesn’t loop the start encoder VI. Checking via the User Messages Pane, it stays static at 0 from begin, teleop, finish.
Other instance is a sequential structure that executes on button press. It should be setting a boolean variable to be true inside that switches our launcher from manual to automated control (for ball retrieval purposes; complicated), and should be running an autonomous sequence. I can check via the User Message Pane (boolean -> 8-bit -> String), and it just stays 0 the entire time.
What I’m really not getting is that the one boolean global variable that works works pretty much the same way; gives itself new values in a conditional. If I stick that in the User Messages Pane, it indicates that it is switching between 0 and 1 as it should, and it does its function properly.
I’m just not sure what I should be looking for
did you go to where the indicator is on the front panel and check if it is changing to the values you want? Because it could just be the coding of the encoder code itself, and not actually the variable
The encoder values seems to be messed up if I run it normally though; that is, start counting and get value all in the same teleop loop (ideally I have start counting and get value mutually exclusive). It just starts counting 1 to infinity, though doing anything to the physical encoder doesn’t seem to be augumenting it in any way. The encoder seems to be wired right, A to DIO 1, B to DIO 2, power from DIO 1, ground to DIO 2.
Without seeing your code, it’s hard to imagine what might be wrong. I can’t quite follow your explanation of what you’re trying to do. Can you show us what you’re talking about so we can look it over for possible problems?
The comment about “normally” starting an encoder and reading it in the same loop doesn’t seem right at all, but I’m not sure whether the problem is with the way you’re describing it or whether you’re actually doing what it sounds like.
Ah…actually, I figured out what was happening.
I was causing the entire while loop in the Robot Main VI to lag up because I was trying to stick a sequence with delays in Teleop.
Tried to put it in Periodic Tasks, caused the entire thing to lag up.
Changed that out, and wrote out some code with timers and some crazy Boolean logic in Teleop; to me, it seems like it acts as if it was its own loop operating independently from the while loop that the Teleop VI is in (it’s essentially a loop being executed sequentially). Which is precisely what I wanted it to do, heh.
Solution posted below in 4 parts to describe case structures:
Progression of the interior case structure inside the rightmost larger case structure is 3, 2, 1; it is dependant on time via the Timers.
The outputs are going outside of the pic to feed to case structures that cause our launcher to actuate by itself. I was debating using variables for ease of programming, but used direct LabView wiring for now. Doing that also allows me to put in an emergency cutoff in case the reload goes haywire on the field. Of course, the outputs are turned on or off as dictated by the progression of time. The timer is located in the Periodic Tasks VI, having 1 added to it constantly within a while loop that loops at 10ms intervals (I thought 1ms might be excessive cRIO strain).
I lost track of what I was actually doing after a bit, and I think I could increase its reliability and efficiency for sure by putting in sequential frame structures to use. Any attempt to modify it though, broke its continuity. However, it currently works the way I want it to (initializing the timer in Begin and Disabled and setting the current time variable to the threshhold in Disabled to prevent re-execution on enable), and I’m currently keeping it as is, unless someone can think of better
Heck, I dunno if something like that was already built into LV. I was kinda confused by the whole Timed Loop thing >.>