In LabVIEW state machine programming, bundling all sensor inputs and machine outputs into a cluster within the state machine data structure enables efficient debugging and dashboard creation by making all internal state information accessible without redundant reads within case structures.
State Machines in LabVIEW: Flexible Code for FRC Lifter Mechanisms
Added:so in this exercise we talked about State machines we talked about the basic idea that a state machine is code that runs differently depending on the value of an internal variable called State we talked about the idea of a state diagram as being a way to indicate how the machine or how code runs from different mode to mode to mode we talked about how code can be executed on the transition between states or how limits and other parameters can be checked during a state we created a type def to contain both the device references for the hardware we need for our state machine as well as the internal data finally we created a subvi which in this case we placed within our T op VII to contain our state machine now that you've seen this approach of creating a state machine I want to make some slight modifications to this code some of you may have noticed that we never made use of the current motor speed or the three Boolean input values I want to make that modification now and show you how we can take advantage of that information in a debugging dashboard type of application so what we're going to do is just move everything over a little bit make a little bit of room so that we can move each of our digital input get commands to be outside the case structure because what we're going to do is we're actually going to get the digital values every time through the loop so we're going to read the lower limit value the ball sensor and the upper limit switch each time through the loop and before we go into the case structure we're actually going to bundle those values right into our cluster so we're going to start with the lower limit switch value a little bit more room clean up our wires hook up our values so there's our lower limit switch there's our ball sensor next and there's our upper limit switch third yeah just make a little bit more room and there's no reason to read them twice so wherever we were reading the upper limit switch inside the case structure we can take the value right from here wherever we were reading the ball sensor we can again take the value right from here and wherever we were reading lower limit switch we can take the value right from here so now we don't even need these references wired in to the case structure so the reason for doing this and thus putting them into the cluster we'll see in a moment but the last parameter that we needed to put into the cluster is remember we had room for the current motor speed wherever we're writing to our motor let's also write that value into the cluster let's go through each of our cases put that in place there and so now what we've done apart from messing up some of our wires is made sure if we close this VI and return to the robot main take a look in the teleop vi we've made sure that all the data that we're measuring within our state machine is available in this wire and thus in the robot data cluster if we review what we did in a previous exercise which was to create a debugging dashboard type of VI which would allow us to pull out whatever data we needed from our main robot data by using an unbundle by name then we could create a debugging dashboard just like we did before but notice now that we have access to all of the information in our state machine including the current state the delay and time the values of the three Boolean inputs and the current motor speed so this is a tremendous benefit that allows us to debug and test and when it comes time to make your dashboard which will run in competition that same information can be available then so the act of making all these internal variables inside the type def makes it very easy to do debugging testing and just to make sure what state everything's in so if we were to pull out just the values we want to see such as the lifter State we could create an indicator for that in our debug screen we could also create indicators for each of our digital inputs so it would be very easy to debug the state of our lifting mechanism so if we were to take these controls align them space them properly we could resize them so that we could very easily debug and see what's going on thank you very much for watching this video there have been several popups throughout this video which for subscribers of the LV mastery.com online training will drill you right into the training material relevant to that particular section remember that these introductory videos are intended to get your feet wet and get you introduced to Lavie there's lots to learn about Lavie and we're very proud of the LV mastery.com online learning experience we've had a lot of great feedback from other first team members and other high school students who have taken the training I'd also like to mention the buy one give one special offer for mentors teachers and parents associated with first teams we're allowing anyone who's associated with a first team to purchase the LV Mastery online training for the academic price of $500 for all three courses and for anyone who takes us up on that offer will'll donate a training seat to a member of their team as well thank you very much for watching this has been Ben Zimmer from lvm mastery.com bye for now
Up Next

Working with Dates and Times in Pandas: A Guide to Datetime Operations
@dataschool
190.5K views•2016-07-19

BitTorrent Protocol Explained: Piece Selection & Peer Choking
@StevenGordonAU
481 views•2013-02-22

HTTP Requests Explained: GET, POST, PUT, DELETE
@codecademy
103.1K views•2021-10-07

Enigma Machine Mechanics: WWII Encryption Explained
@JaredOwen
13.2M views•2021-12-11
Related Study Plans & Knowledge Roadmaps
Structured learning paths in Computer Science















![초보자를 위한 기초과정[02] 입출력 아이콘 크기, 이름변경, 데이터 형식 동영상 강좌](https://i.ytimg.com/vi_webp/jpRy_XDKEYY/maxresdefault.webp)























