SlideShare a Scribd company logo
1 of 29
7 steps to autonomous for FRC
    LabVIEW programmers
           Jim Chastain
       jimc2550@gmail.com
PingPong BunnyBot
•   WE HAVE ENCODERS ON OUR WHEELS
•   We want Arcade manual control (single joystick)
•   In autonomous we want to use TANK control
•   AND A SOLENOID “CLAW” TO HOLD OUR BUNNY
•   IN AUTONOMOUS, WE WANT TO DESIGN A STATE
    MACHINE WHICH WILL :
    –   MOVE FORWARD 10 FEET
    –   TURN RIGHT
    –   GO FORWARD 3 FEET
    –   OPEN CLAW TO DROP BUNNYBOT
    –   THEN STOP AND WAIT FOR TELEOP
7 steps to Autonomous
• 1    Create list of all variables needed for autonomous
   – All inputs (encoders)
   – All outputs (drive motor signals, solenoid controls, encoder reset)
   – Add a Boolean “Auto Enable”
• 2 From this list, set up an indicator in Robot Global Data for each
  one ( In Robot Main.vi assign value to “Auto Enable”)
• 3    In “Timed Tasks.vi” read all sensors including joystick.
• 4    Create a CASE struct in Timed Tasks.vi and use “Auto Enable”
  to switch controls between signals from “Autonomous” and
  “manual” control
• 5    Make a list of all steps needed in autonomous, include steps to
  reset encoders; put steps in STATE CHART (4 columns)
• 6    Build LABVIEW STATE MACHINE in Autonomous
• 7    Use Robot Global Data to Debug
set up list of auto variables
• Autonomous inputs
   – Right and left encoders
• Autonomous outputs
   –   Auto drive right
   –   Auto drive left
   –   Auto sol Close       (close solenoid)
   –   Auto sol Open       (open solenoid)
   –   Auto enc reset     (reset both encoders every time)

• We also want a signal “Auto Enable” to be on Robot
  Global Data
• THIS GIVES US A SINGLE CONTROL SIGNAL WHICH CAN BE
  USED to switch manual to auto.
From list, create indicators on
                 Robot Global DATA




YOU MUST SAVE AFTER
   UPDATING RGD
Read all sensors (and joystick)
  in Periodic tasks.vi




               I used the 10 ms loop, but
                   changed it to 20 ms
AUTO ENABLE GETS VALUE IN ROBOT
         MAIN.VI

         TRUE IN AUTONOMOUS,
         FALSE ALL OTHER STATES
CREATE CASE TO SWITCH
CONTROL SIGNALS
               THIS CASE SWITCHES
              CONTROL FOR MOTOR
                 AND SOLENOID
              FALSE MEANS MANUAL
                    CONTROL
TRUE MEANS
AUTONOMOUS IS
 CONTROLLING
NOTE, WHEN I CONTROL DRIVE MOTORS IN PERIODIC TASK, I MUST DIASABLE CONTROL IN
                                 TELEOP.VI
LIST OF STEPS FOR
                        AUTONOMOUS
•   1 START WITH WHEELS STOPPED, CLAW CLOSED; RESET ENCODERS
•   2 GO FORWARD 300 REVOLUTIONS ON BOTH ENCODERS
•   3 STOP, RESET BOTH ENCODERS, (wait 20 ms)
•   4 RIGHT WHEEL STOPPED, LEFT WHEEL FORWARD 25 REVOLUTIONS
    (HALF SPEED)
•   5 STOP, RESET BOTH ENCODERS (wait 20 ms)
•   6 GO FORWARD 95 REVOLUTIONS ON BOTH ENCODERS
•   7 STOP, RESET ENCODERS, OPEN CLAW (wait 20 ms)
•   8 WAIT FOR MANUAL CONTROL

• NOW PUT IN STATE CHART WITH 4 COLUMNS
    –   LEFT COLUMN IS STATE NAME
    –   NEXT IS STATE OUTPUT
    –   NEXT IS TRIGGER TO GO TO NEXT STATE
    –   FINAL COLUMN IS NEXT STATE (if you do not count notes)
L = Auto Left; R = Auto Right; RS =
  encoder reset; Open & Close = Solenoid    STATE CHART
STATE NAME      OUTPUTS           TRIGGER        NEXT STATE   NOTES
START           L=R=0;            None           TWO
                RS=true;
                Close=True
TWO             L=R=.-4           ENCODERS =     THREE        TRICKY STEP TO
                RS = false        300                         STOP EACH
                Close =false                                  MOTOR
                                                              SEPARATELY
THREE           L=R=0;RS=true     100 ms         FOUR
FOUR            R=0; L=-.3;RS=f   ENCODER=25     FIVE
FIVE            L=R=0; RS=t       100 ms delay   SIX
SIX             L=R=-.4;RS=f      ENCODERS =95   SEVEN        AGAIN, TRICKY
SEVEN           L=R=0;RS=t;       100 ms delay   END
                Open =true
END             L=R=0, RS=f       100 ms delay   END
                Open = f
BUILD LV STATE MACHINE
• IN AUTONOMOUS
  – PUT LARGE WHILE LOOP
  – IN CENTER PUT MEDIUM SIZE CASE STRUCT
  – PUT GLOBAL OUTPUT VARIABLE ON RIGHT
  – PUT GLOBAL INPUTS ON LEFT
  – CREATE ENUM (numeric pallet)
    • Edit items to enter all STATE NAMES
  – CONNECT ENUM TO “?” OF CASE
  – CHANGE TUNNEL THRU WALL TO SHIFT REGISTER
BASIC BLOCKS IN AUTONOMOUS
     Leave original
   autonomous code
       disabled

                       OUTPUTS



   INPUTS
  WHILE LOOP
    CASE
NOW ADD ENUM
        ENUM FROM ‘NUMERIC’ MENU,
        RIGHT CLICK, EDIT ITEMS, INSERT
          STATE NAMES FROM CHART!
      ENUM GOES OUTSIDE WHILE, ON LEFT
COMPLETE FRAMEWORK

CONNECT ENUM TO ?       RIGHT CLICK ON CASE
 OF CASE; CHANGE      CONTROL BOX, ‘ADD CASE
TUNNEL TO SHIFT REG      FOR EVERY VALUE’
COMPLETE CONTENTS FOR EACH
    STATE… FROM CHART
State TWO
State THREE
State FOUR
State FIVE
State SIX
State SEVEN
State END
DEBUG USING RGD
• Robot Global Data can be very useful in debug
  if you include a STATE indicator (here is how)
   –   Put an indicator on the STATE line (right side of while loop)
   –   Right click on it (find) to locate it on front panel of Autonomous.vi
   –   Then copy it to Robot Global Data , call “current State”
   –   Delete it from the Block Diagram and replace it with Robot Global
       Data.. See next three slides.
• Now when you run the robot in Autonomous mode, you can
  watch Robot Global Data and see if things run in the correct
  order.
Create an indicator on the STATE
                  variable line




Then right click on it and
    ‘find indicator’
Then put a copy on front panel of ROBOT GLOBAL
                      DATA
Label the Enum, “Current STATE”,
              Save RGD
   Delete the first enum indicator
Connect the RGD to the state variable
                 line.
NOTES
• I used 100 ms as a time delay just to let
  everything rest before going to next state
  (where there is a delay)
• Shoot me an email if you have questions

• Good luck!

More Related Content

What's hot (6)

slope of a line
slope of a lineslope of a line
slope of a line
 
Algebra Solving Open Sentences Involving Absolute Value
Algebra  Solving Open Sentences Involving Absolute ValueAlgebra  Solving Open Sentences Involving Absolute Value
Algebra Solving Open Sentences Involving Absolute Value
 
properties of exponents
properties of exponentsproperties of exponents
properties of exponents
 
Inequalities powerpoint
Inequalities powerpointInequalities powerpoint
Inequalities powerpoint
 
Introduction to Regular Expressions
Introduction to Regular ExpressionsIntroduction to Regular Expressions
Introduction to Regular Expressions
 
Binomial expansion
Binomial expansionBinomial expansion
Binomial expansion
 

Similar to 7 Steps to Autonomous for FRC LabVIEW Programmers

FIRSTFare 2012 advanced lab view topics
FIRSTFare 2012 advanced lab view topicsFIRSTFare 2012 advanced lab view topics
FIRSTFare 2012 advanced lab view topics
Oregon FIRST Robotics
 
Define synchronous system.What is a dynamic indicator on a l.pdf
Define synchronous system.What is a dynamic indicator on a l.pdfDefine synchronous system.What is a dynamic indicator on a l.pdf
Define synchronous system.What is a dynamic indicator on a l.pdf
alshaikhkhanzariarts
 
13 down vote One reason we have a tendency to clock flip flops s.pdf
13 down vote One reason we have a tendency to clock flip flops s.pdf13 down vote One reason we have a tendency to clock flip flops s.pdf
13 down vote One reason we have a tendency to clock flip flops s.pdf
contact34
 
Applications of microcontroller(8051)
Applications of microcontroller(8051) Applications of microcontroller(8051)
Applications of microcontroller(8051)
vijaydeepakg
 
Twin wheeler modified for arduino simplified serial protocol to sabertooth v22
Twin wheeler modified for arduino simplified serial protocol to sabertooth v22Twin wheeler modified for arduino simplified serial protocol to sabertooth v22
Twin wheeler modified for arduino simplified serial protocol to sabertooth v22
josnihmurni2907
 
Preparatory_questions_final_exam_DigitalElectronics1 (1).pdf
Preparatory_questions_final_exam_DigitalElectronics1 (1).pdfPreparatory_questions_final_exam_DigitalElectronics1 (1).pdf
Preparatory_questions_final_exam_DigitalElectronics1 (1).pdf
rdjo
 
RubyConf 2015 - Stately State Machines with Ragel - Ian Duggan
RubyConf 2015 - Stately State Machines with Ragel - Ian DugganRubyConf 2015 - Stately State Machines with Ragel - Ian Duggan
RubyConf 2015 - Stately State Machines with Ragel - Ian Duggan
ijcd
 
Iai pmec amec_controller_catalog
Iai pmec amec_controller_catalogIai pmec amec_controller_catalog
Iai pmec amec_controller_catalog
Electromate
 

Similar to 7 Steps to Autonomous for FRC LabVIEW Programmers (20)

FIRSTFare 2012 advanced lab view topics
FIRSTFare 2012 advanced lab view topicsFIRSTFare 2012 advanced lab view topics
FIRSTFare 2012 advanced lab view topics
 
Define synchronous system.What is a dynamic indicator on a l.pdf
Define synchronous system.What is a dynamic indicator on a l.pdfDefine synchronous system.What is a dynamic indicator on a l.pdf
Define synchronous system.What is a dynamic indicator on a l.pdf
 
13 down vote One reason we have a tendency to clock flip flops s.pdf
13 down vote One reason we have a tendency to clock flip flops s.pdf13 down vote One reason we have a tendency to clock flip flops s.pdf
13 down vote One reason we have a tendency to clock flip flops s.pdf
 
Applications of microcontroller(8051)
Applications of microcontroller(8051) Applications of microcontroller(8051)
Applications of microcontroller(8051)
 
Instruction types
Instruction typesInstruction types
Instruction types
 
Twin wheeler modified for arduino simplified serial protocol to sabertooth v22
Twin wheeler modified for arduino simplified serial protocol to sabertooth v22Twin wheeler modified for arduino simplified serial protocol to sabertooth v22
Twin wheeler modified for arduino simplified serial protocol to sabertooth v22
 
Catalog mikro mikro mk232a-user
Catalog mikro mikro mk232a-userCatalog mikro mikro mk232a-user
Catalog mikro mikro mk232a-user
 
Catalog mikro mikro mk232a-user
Catalog mikro mikro mk232a-userCatalog mikro mikro mk232a-user
Catalog mikro mikro mk232a-user
 
Catalog mikro mikro mk232a-user-dienhathe.vn
Catalog mikro mikro mk232a-user-dienhathe.vnCatalog mikro mikro mk232a-user-dienhathe.vn
Catalog mikro mikro mk232a-user-dienhathe.vn
 
Preparatory_questions_final_exam_DigitalElectronics1 (1).pdf
Preparatory_questions_final_exam_DigitalElectronics1 (1).pdfPreparatory_questions_final_exam_DigitalElectronics1 (1).pdf
Preparatory_questions_final_exam_DigitalElectronics1 (1).pdf
 
Vt plc
Vt plcVt plc
Vt plc
 
Project on PLC (SILO)
Project on PLC (SILO)Project on PLC (SILO)
Project on PLC (SILO)
 
Interfacing Stepper motor with 8051
Interfacing Stepper motor with 8051Interfacing Stepper motor with 8051
Interfacing Stepper motor with 8051
 
Elevator1
Elevator1Elevator1
Elevator1
 
report_2
report_2report_2
report_2
 
Sometimes tells me funny stories from his childhood
Sometimes tells me funny stories from his childhoodSometimes tells me funny stories from his childhood
Sometimes tells me funny stories from his childhood
 
Basicelectricity3
Basicelectricity3Basicelectricity3
Basicelectricity3
 
Arduino based applications-part 3
Arduino based applications-part 3Arduino based applications-part 3
Arduino based applications-part 3
 
RubyConf 2015 - Stately State Machines with Ragel - Ian Duggan
RubyConf 2015 - Stately State Machines with Ragel - Ian DugganRubyConf 2015 - Stately State Machines with Ragel - Ian Duggan
RubyConf 2015 - Stately State Machines with Ragel - Ian Duggan
 
Iai pmec amec_controller_catalog
Iai pmec amec_controller_catalogIai pmec amec_controller_catalog
Iai pmec amec_controller_catalog
 

More from Oregon FIRST Robotics

Oregon FIRST PNW Championship Poster 2014 3
Oregon FIRST PNW Championship Poster 2014 3Oregon FIRST PNW Championship Poster 2014 3
Oregon FIRST PNW Championship Poster 2014 3
Oregon FIRST Robotics
 
Oregon FIRST PNW Championship Poster 2014 2
Oregon FIRST PNW Championship Poster 2014 2Oregon FIRST PNW Championship Poster 2014 2
Oregon FIRST PNW Championship Poster 2014 2
Oregon FIRST Robotics
 
Oregon FIRST PNW Championship Poster 2014 1
Oregon FIRST PNW Championship Poster 2014 1Oregon FIRST PNW Championship Poster 2014 1
Oregon FIRST PNW Championship Poster 2014 1
Oregon FIRST Robotics
 
Oregon FIRST PNW Championship Poster 2014 4
Oregon FIRST PNW Championship Poster 2014 4Oregon FIRST PNW Championship Poster 2014 4
Oregon FIRST PNW Championship Poster 2014 4
Oregon FIRST Robotics
 
First fare 2013 business plan presentation
First fare 2013   business plan presentationFirst fare 2013   business plan presentation
First fare 2013 business plan presentation
Oregon FIRST Robotics
 
First fare 2013 competitive analysis presentation
First fare 2013   competitive analysis presentationFirst fare 2013   competitive analysis presentation
First fare 2013 competitive analysis presentation
Oregon FIRST Robotics
 
First fare 2013 website design for frc teams
First fare 2013   website design for frc teamsFirst fare 2013   website design for frc teams
First fare 2013 website design for frc teams
Oregon FIRST Robotics
 
FIRSTFare 2013 overview of electronics-2014
FIRSTFare 2013   overview of electronics-2014FIRSTFare 2013   overview of electronics-2014
FIRSTFare 2013 overview of electronics-2014
Oregon FIRST Robotics
 
First fare 2013 manipulators firstfare 2013
First fare 2013   manipulators firstfare 2013First fare 2013   manipulators firstfare 2013
First fare 2013 manipulators firstfare 2013
Oregon FIRST Robotics
 
First fare 2013 district model overview 2014
First fare 2013   district model overview 2014First fare 2013   district model overview 2014
First fare 2013 district model overview 2014
Oregon FIRST Robotics
 
First fare 2013 crowdfunding 101 (beginner) with notes
First fare 2013   crowdfunding 101 (beginner) with notesFirst fare 2013   crowdfunding 101 (beginner) with notes
First fare 2013 crowdfunding 101 (beginner) with notes
Oregon FIRST Robotics
 
2013 FRC Autodesk Oregon Regional -- All you need to know webinar
2013 FRC Autodesk Oregon Regional -- All you need to know webinar2013 FRC Autodesk Oregon Regional -- All you need to know webinar
2013 FRC Autodesk Oregon Regional -- All you need to know webinar
Oregon FIRST Robotics
 
2013 Autodesk Oregon Regional Poster.11x17
2013 Autodesk Oregon Regional Poster.11x172013 Autodesk Oregon Regional Poster.11x17
2013 Autodesk Oregon Regional Poster.11x17
Oregon FIRST Robotics
 
2013 Autodesk Oregon Regional Poster - 4
2013 Autodesk Oregon Regional Poster - 42013 Autodesk Oregon Regional Poster - 4
2013 Autodesk Oregon Regional Poster - 4
Oregon FIRST Robotics
 
2013 Autodesk Oregon Regional Poster - 3
2013 Autodesk Oregon Regional Poster - 32013 Autodesk Oregon Regional Poster - 3
2013 Autodesk Oregon Regional Poster - 3
Oregon FIRST Robotics
 

More from Oregon FIRST Robotics (20)

Oregon FIRST PNW Championship Poster 2014 3
Oregon FIRST PNW Championship Poster 2014 3Oregon FIRST PNW Championship Poster 2014 3
Oregon FIRST PNW Championship Poster 2014 3
 
Oregon FIRST PNW Championship Poster 2014 2
Oregon FIRST PNW Championship Poster 2014 2Oregon FIRST PNW Championship Poster 2014 2
Oregon FIRST PNW Championship Poster 2014 2
 
Oregon FIRST PNW Championship Poster 2014 1
Oregon FIRST PNW Championship Poster 2014 1Oregon FIRST PNW Championship Poster 2014 1
Oregon FIRST PNW Championship Poster 2014 1
 
Oregon FIRST PNW Championship Poster 2014 4
Oregon FIRST PNW Championship Poster 2014 4Oregon FIRST PNW Championship Poster 2014 4
Oregon FIRST PNW Championship Poster 2014 4
 
First fare 2013 business plan presentation
First fare 2013   business plan presentationFirst fare 2013   business plan presentation
First fare 2013 business plan presentation
 
First fare 2013 competitive analysis presentation
First fare 2013   competitive analysis presentationFirst fare 2013   competitive analysis presentation
First fare 2013 competitive analysis presentation
 
First fare 2013 website design for frc teams
First fare 2013   website design for frc teamsFirst fare 2013   website design for frc teams
First fare 2013 website design for frc teams
 
First fare 2013 pneumatics 2013
First fare 2013   pneumatics 2013First fare 2013   pneumatics 2013
First fare 2013 pneumatics 2013
 
FIRSTFare 2013 overview of electronics-2014
FIRSTFare 2013   overview of electronics-2014FIRSTFare 2013   overview of electronics-2014
FIRSTFare 2013 overview of electronics-2014
 
First fare 2013 manipulators firstfare 2013
First fare 2013   manipulators firstfare 2013First fare 2013   manipulators firstfare 2013
First fare 2013 manipulators firstfare 2013
 
First fare 2013 district model overview 2014
First fare 2013   district model overview 2014First fare 2013   district model overview 2014
First fare 2013 district model overview 2014
 
First fare 2013 crowdfunding 101 (beginner) with notes
First fare 2013   crowdfunding 101 (beginner) with notesFirst fare 2013   crowdfunding 101 (beginner) with notes
First fare 2013 crowdfunding 101 (beginner) with notes
 
First fare 2013 basic-labview
First fare 2013   basic-labviewFirst fare 2013   basic-labview
First fare 2013 basic-labview
 
2013 Oregon Dept. of Education Grant Overview for FIRST Teams
2013 Oregon Dept. of Education Grant Overview for FIRST Teams2013 Oregon Dept. of Education Grant Overview for FIRST Teams
2013 Oregon Dept. of Education Grant Overview for FIRST Teams
 
2013 Oregon Dept. of Education FIRST Grant Overview
2013 Oregon Dept. of Education FIRST Grant Overview 2013 Oregon Dept. of Education FIRST Grant Overview
2013 Oregon Dept. of Education FIRST Grant Overview
 
FIRST Robotics Oregon Dept Of Education Grants - 2013
FIRST Robotics Oregon Dept Of Education Grants - 2013FIRST Robotics Oregon Dept Of Education Grants - 2013
FIRST Robotics Oregon Dept Of Education Grants - 2013
 
2013 FRC Autodesk Oregon Regional -- All you need to know webinar
2013 FRC Autodesk Oregon Regional -- All you need to know webinar2013 FRC Autodesk Oregon Regional -- All you need to know webinar
2013 FRC Autodesk Oregon Regional -- All you need to know webinar
 
2013 Autodesk Oregon Regional Poster.11x17
2013 Autodesk Oregon Regional Poster.11x172013 Autodesk Oregon Regional Poster.11x17
2013 Autodesk Oregon Regional Poster.11x17
 
2013 Autodesk Oregon Regional Poster - 4
2013 Autodesk Oregon Regional Poster - 42013 Autodesk Oregon Regional Poster - 4
2013 Autodesk Oregon Regional Poster - 4
 
2013 Autodesk Oregon Regional Poster - 3
2013 Autodesk Oregon Regional Poster - 32013 Autodesk Oregon Regional Poster - 3
2013 Autodesk Oregon Regional Poster - 3
 

7 Steps to Autonomous for FRC LabVIEW Programmers

  • 1. 7 steps to autonomous for FRC LabVIEW programmers Jim Chastain jimc2550@gmail.com
  • 2. PingPong BunnyBot • WE HAVE ENCODERS ON OUR WHEELS • We want Arcade manual control (single joystick) • In autonomous we want to use TANK control • AND A SOLENOID “CLAW” TO HOLD OUR BUNNY • IN AUTONOMOUS, WE WANT TO DESIGN A STATE MACHINE WHICH WILL : – MOVE FORWARD 10 FEET – TURN RIGHT – GO FORWARD 3 FEET – OPEN CLAW TO DROP BUNNYBOT – THEN STOP AND WAIT FOR TELEOP
  • 3. 7 steps to Autonomous • 1 Create list of all variables needed for autonomous – All inputs (encoders) – All outputs (drive motor signals, solenoid controls, encoder reset) – Add a Boolean “Auto Enable” • 2 From this list, set up an indicator in Robot Global Data for each one ( In Robot Main.vi assign value to “Auto Enable”) • 3 In “Timed Tasks.vi” read all sensors including joystick. • 4 Create a CASE struct in Timed Tasks.vi and use “Auto Enable” to switch controls between signals from “Autonomous” and “manual” control • 5 Make a list of all steps needed in autonomous, include steps to reset encoders; put steps in STATE CHART (4 columns) • 6 Build LABVIEW STATE MACHINE in Autonomous • 7 Use Robot Global Data to Debug
  • 4. set up list of auto variables • Autonomous inputs – Right and left encoders • Autonomous outputs – Auto drive right – Auto drive left – Auto sol Close (close solenoid) – Auto sol Open (open solenoid) – Auto enc reset (reset both encoders every time) • We also want a signal “Auto Enable” to be on Robot Global Data • THIS GIVES US A SINGLE CONTROL SIGNAL WHICH CAN BE USED to switch manual to auto.
  • 5. From list, create indicators on Robot Global DATA YOU MUST SAVE AFTER UPDATING RGD
  • 6. Read all sensors (and joystick) in Periodic tasks.vi I used the 10 ms loop, but changed it to 20 ms
  • 7. AUTO ENABLE GETS VALUE IN ROBOT MAIN.VI TRUE IN AUTONOMOUS, FALSE ALL OTHER STATES
  • 8. CREATE CASE TO SWITCH CONTROL SIGNALS THIS CASE SWITCHES CONTROL FOR MOTOR AND SOLENOID FALSE MEANS MANUAL CONTROL
  • 10. NOTE, WHEN I CONTROL DRIVE MOTORS IN PERIODIC TASK, I MUST DIASABLE CONTROL IN TELEOP.VI
  • 11. LIST OF STEPS FOR AUTONOMOUS • 1 START WITH WHEELS STOPPED, CLAW CLOSED; RESET ENCODERS • 2 GO FORWARD 300 REVOLUTIONS ON BOTH ENCODERS • 3 STOP, RESET BOTH ENCODERS, (wait 20 ms) • 4 RIGHT WHEEL STOPPED, LEFT WHEEL FORWARD 25 REVOLUTIONS (HALF SPEED) • 5 STOP, RESET BOTH ENCODERS (wait 20 ms) • 6 GO FORWARD 95 REVOLUTIONS ON BOTH ENCODERS • 7 STOP, RESET ENCODERS, OPEN CLAW (wait 20 ms) • 8 WAIT FOR MANUAL CONTROL • NOW PUT IN STATE CHART WITH 4 COLUMNS – LEFT COLUMN IS STATE NAME – NEXT IS STATE OUTPUT – NEXT IS TRIGGER TO GO TO NEXT STATE – FINAL COLUMN IS NEXT STATE (if you do not count notes)
  • 12. L = Auto Left; R = Auto Right; RS = encoder reset; Open & Close = Solenoid STATE CHART STATE NAME OUTPUTS TRIGGER NEXT STATE NOTES START L=R=0; None TWO RS=true; Close=True TWO L=R=.-4 ENCODERS = THREE TRICKY STEP TO RS = false 300 STOP EACH Close =false MOTOR SEPARATELY THREE L=R=0;RS=true 100 ms FOUR FOUR R=0; L=-.3;RS=f ENCODER=25 FIVE FIVE L=R=0; RS=t 100 ms delay SIX SIX L=R=-.4;RS=f ENCODERS =95 SEVEN AGAIN, TRICKY SEVEN L=R=0;RS=t; 100 ms delay END Open =true END L=R=0, RS=f 100 ms delay END Open = f
  • 13. BUILD LV STATE MACHINE • IN AUTONOMOUS – PUT LARGE WHILE LOOP – IN CENTER PUT MEDIUM SIZE CASE STRUCT – PUT GLOBAL OUTPUT VARIABLE ON RIGHT – PUT GLOBAL INPUTS ON LEFT – CREATE ENUM (numeric pallet) • Edit items to enter all STATE NAMES – CONNECT ENUM TO “?” OF CASE – CHANGE TUNNEL THRU WALL TO SHIFT REGISTER
  • 14. BASIC BLOCKS IN AUTONOMOUS Leave original autonomous code disabled OUTPUTS INPUTS WHILE LOOP CASE
  • 15. NOW ADD ENUM ENUM FROM ‘NUMERIC’ MENU, RIGHT CLICK, EDIT ITEMS, INSERT STATE NAMES FROM CHART! ENUM GOES OUTSIDE WHILE, ON LEFT
  • 16. COMPLETE FRAMEWORK CONNECT ENUM TO ? RIGHT CLICK ON CASE OF CASE; CHANGE CONTROL BOX, ‘ADD CASE TUNNEL TO SHIFT REG FOR EVERY VALUE’
  • 17. COMPLETE CONTENTS FOR EACH STATE… FROM CHART
  • 25. DEBUG USING RGD • Robot Global Data can be very useful in debug if you include a STATE indicator (here is how) – Put an indicator on the STATE line (right side of while loop) – Right click on it (find) to locate it on front panel of Autonomous.vi – Then copy it to Robot Global Data , call “current State” – Delete it from the Block Diagram and replace it with Robot Global Data.. See next three slides. • Now when you run the robot in Autonomous mode, you can watch Robot Global Data and see if things run in the correct order.
  • 26. Create an indicator on the STATE variable line Then right click on it and ‘find indicator’
  • 27. Then put a copy on front panel of ROBOT GLOBAL DATA
  • 28. Label the Enum, “Current STATE”, Save RGD Delete the first enum indicator Connect the RGD to the state variable line.
  • 29. NOTES • I used 100 ms as a time delay just to let everything rest before going to next state (where there is a delay) • Shoot me an email if you have questions • Good luck!