Creating Flexible, Script-Controlled Autonomous Software.

Slides:



Advertisements
Similar presentations
AP Computer Science Anthony Keen. Computer 101 What happens when you turn a computer on? –BIOS tries to start a system loader –A system loader tries to.
Advertisements

Robot Code MVRT 2010 – 2011 Season. Robot code controls the robot Robot Main.vi –Calls all the smaller SubVis Rules of programming the robot –Be careful.
R for Macroecology Aarhus University, Spring 2011.
Java Workshop. Quick java review Goal: We want the application to tell us what the nth fibonacci number is. Components needed to achieve the goal: A Scanner.
Slides revised 3/25/2014 by Patrick Kelley. 2 Procedures Unlike other branching structures (loops, etc.) a Procedure has to return to where it was called.
Add and Use a Sensor & Autonomous For FIRST Robotics
101.  Computers DO NOT think for themselves. For them to do anything they need to be told what to do.  Simply put computer programming is when you tell.
Chapter 9 Subprograms Specification: name, signature, actions Signature: number and types of input arguments, number and types of output results –Book.
Chapter 8 and 9 Review: Logical Functions and Control Structures Introduction to MATLAB 7 Engineering 161.
Section 2.3 Gauss-Jordan Method for General Systems of Equations
CS1061 C Programming Lecture 2: A Few Simple Programs A. O’Riordan, 2004.
ECE122 L11: For loops and Arrays March 8, 2007 ECE 122 Engineering Problem Solving with Java Lecture 11 For Loops and Arrays.
C ENTER FOR I NTEGRATED R ESEARCH C OMPUTING MATLAB
Games and Simulations O-O Programming in Java The Walker School
SOURCE 2006 Presentation by Luke Arntson Game Programming Optimization.
LabView Basics The Fighting Pi Controls Group. About LabView LabView is a highly adaptable programming GUI (Graphic User Interface) LabView compiles the.
Introduction to MATLAB Session 1 Prepared By: Dina El Kholy Ahmed Dalal Statistics Course – Biomedical Department -year 3.
1 Arrays Chapter 13 Especially read 13.1 – 13.2 Text introduces vectors, which we will not cover, in 13.3.
Weston Schreiber & Joshua Gabrielse Robotics Summer Training Programming #1: EasyC Basics.
Lists in Python.
1 Functions 1 Parameter, 1 Return-Value 1. The problem 2. Recall the layout 3. Create the definition 4. "Flow" of data 5. Testing 6. Projects 1 and 2.
Human Vision Robot (Light Sensor) Vision White/Light: 100 Black/Dark: 0 Colors:
Introduction to File I/O High-Level Functions 1.Data files 2."High level" File I/O 3.dlmread() 4.xlsread() 1.
2010 Control System Writing and Reading the cRio Presented By: Frank Larkin Lansdale Catholic Robotics, Team 272 First 2010 Kickoff, Jan
Understanding the TigerSHARC ALU pipeline Determining the speed of one stage of IIR filter – Part 3 Understanding the memory pipeline issues.
Matlab Basics Tutorial. Vectors Let's start off by creating something simple, like a vector. Enter each element of the vector (separated by a space) between.
20-753: Fundamentals of Web Programming 1 Lecture 12: Javascript I Fundamentals of Web Programming Lecture 12: Introduction to Javascript.
Flow Control and Functions ● Script files ● If's and For's ● Basics of writing functions ● Checking input arguments ● Variable input arguments ● Output.
PHP. What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server.
What does C store? >>A = [1 2 3] >>B = [1 1] >>[C,D]=meshgrid(A,B) c) a) d) b)
Understanding the TigerSHARC ALU pipeline Determining the speed of one stage of IIR filter – Part 2 Understanding the pipeline.
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room , Chris Hill, Room ,
File Input and Output (I/O) Engineering 1D04, Teaching Session 7.
Chapter 3 MATLAB Fundamentals Introduction to MATLAB Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Introduction to Perl “Practical Extraction and Report Language” “Pathologically Eclectic Rubbish Lister”
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
Introduction to PHP.
C++ / G4MICE Course Session 2 Basic C++ types. Control and Looping Functions in C Function/method signatures and scope.
Lecture 26: Reusable Methods: Enviable Sloth. Creating Function M-files User defined functions are stored as M- files To use them, they must be in the.
Introduction to Loops Iteration Repetition Counting Loops Also known as.
A (VERY) SHORT INTRODUCTION TO MATLAB J.A. MARR George Mason University School of Physics, Astronomy and Computational Sciences.
C++ / G4MICE Course Session 1 - Introduction Edit text files in a UNIX environment. Use the g++ compiler to compile a single C++ file. Understand the C++
Perl Day 5. Arrays vs Hash Arrays are one way to store multiple things in a variable. Hashes are another. Arrays are one way to store multiple things.
– Intermediate Perl 1/6/ Intermediate Perl - POD, parameters and configuration Intermediate Perl – Session 7 · POD –
Review of Previous Classes Declaring Variables - var myVar:DataType = value Data Types – Number, uint, String, Boolean Functions – parameters, return.
CSCI 156: Lab 11 Paging. Our Simple Architecture Logical memory space for a process consists of 16 pages of 4k bytes each. Your program thinks it has.
Chapter 1 Java Programming Review. Introduction Java is platform-independent, meaning that you can write a program once and run it anywhere. Java programs.
1 Project 7: Looping. Project 7 For this project you will produce two Java programs. The requirements for each program will be described separately on.
Fun fun ’til daddy takes your C turbo away! A C program is organized into one or more modules (source files created by a programmer), within which are.
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
Programming Fundamentals. Today’s Lecture Array Fundamentals Arrays as Class Member Data Arrays of Objects C-Strings The Standard C++ string Class.
Introduction to CMex E177 April 25, Copyright 2005, Andy Packard. This work is licensed under the Creative.
1 ENERGY 211 / CME 211 Lecture 4 September 29, 2008.
PHP Tutorial. What is PHP PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
Get your software working before putting it on the robot!
Creating Flexible, Script-Controlled Autonomous Software Example Explanation.
Get your software working before putting it on the robot! Example Explanation.
LEGO Robotics Workshop
EGR 2261 Unit 10 Two-dimensional Arrays
ROBOTC for VEX On-Site Professional Development
Procedures 101: There and Back Again
DBW - PHP DBW2017.
Introduction to MATLAB
In Class Program: Today in History
EKT150 : Computer Programming
An Introduction to VEX IQ Programming with Modkit
SE1H421 Procedural Programming LECTURE 4 Operators & Conditionals (1)
Spreadsheets, Modelling & Databases
Robotics Week 4 Functions and reusable code
Programming The ideal style of programming is Structured or
Presentation transcript:

Creating Flexible, Script-Controlled Autonomous Software

My Name: Chris Hibner Mentor FRC 51 - Wings of Fire  Control Systems Engineer  Involved with FIRST for a LONG time  Plenty of industry experience  Cool Degrees (Go Blue!) chiefdelphi.com: “Chris Hibner”

Why should I care about this? 1. Flexibility: do you really know what the optimal autonomous routine is? 2. Fast changes: no need to compile and deploy code. 3. “Building Block” method: easy to break the problem into small, manageable chunks. 4. Expandability: easy to add more features if you deem necessary.

 It is not a magic bullet to solve all of your autonomous problems.  It is simply a method of organizing your software.  The method presented here is not the only way to accomplish scripted autonomous  Most likely, it is not the best way.  It is a fairly simple way (and highly effective).

 The “Primitive”, or building block.  It is a single, simple move that you program your robot to do – usually a driving maneuver.  Think of it as a toolbox or a bag of tricks  What are some primitives that you would want in your autonomous software? Ex: 1. Delay / Do Nothing 2. Drive straight 3. Turn in place 4. Go to X,Y coordinate 5. etc.

 How to transition from one primitive to the next?  Exit conditions must be defined for each primitive  What would be the exit conditions for the primitives we decided on?  CAVEAT: What if you can’t get to the exit condition?  What parameters are needed by the primitives?  Operating parameters (heading, distance, power, etc.)  Exit Conditions

 Each primitive is like a function or class.  Parameters are passed to the primitive like arguments to a function  Ex: straight(heading, distance, power)  The primitives are selected and the parameters are passed to the primitive via a simple script.  Therefore: no need to change your software: just change the script!

 Each primitive is assigned a unique ID number (enumeration).  Each primitive has numeric parameters.  Since we only need numeric data, a matrix (2-D Array) can be used to represent the script.  Each column of the script is one primitive  1 st entry: primitive ID  2 nd entry: parameter 1  3 rd entry: parameter 2  Etc.  Number of entries in each column depends on the maximum number of parameters.

 The script is a matrix (2-D Array)  Each column represents one primitive  Example: ID 1 st column: Starting position 1 st primitive param1 param

 Example script means the following:  Column 1: Start at Hdg = 0; X = 261; Y = 203  Column 2: Drive Straight (ID 1), Hdg = 0, for 15 inches, power = 0.5, Roller at ID Hdg dist/time power roller kick

 Column 3: Do Nothing (ID 0) for 250 msec.  Column 4: Hold Position (ID 2), Hdg = 10 deg, for 500 msec, Max power = 1.0.  Column 5: Hold Position, Hdg = 10 deg, for 1500 msec, kick ball ID Hdg dist/time power roller kick

 The script can be as long or as short as you want. Each script can be different.  The script is stored on the cRIO as a.CSV file

 Column index is the key! – this selects the primitive and parameters from the matrix

 Use a “Case Structure” or “switch/case”  Each “Case” one primitive  Each case is numbered: set each case number to the primitive ID you selected.  In each case, put your code for that primitive (or call a function for the primitive) – don’t forget the exit condition logic in your code.  In each primitive, when you reach the exit condition, increment the array column index.  After incrementing the index, the next primitive happens automatically – like magic

 ColumnIndex = 1: ColumnIndex = 2:  In your software, when you reach the exit condition of one primitive:  Increment ColumnIndex (ColumnIndex++)  Next primitive will start “automagically”

 Cycling through the primitives: ColumIndex:

// atnArr is the autonArray // ind is the column index switch (atnArr[0][ind]) { case 0: ind = delay(atnArr[1][ind],atnArr[2][ind]); break; case 1: ind = straight(atnArr[1][ind],atnArr[2][ind]); break; Etc

uint8 ind = straight(float desiredHdg, float dist) { const float speed = 0.7; float turn = PID(desiredHdg, Hdg); rightDrive = (speed + turn); leftDrive = (speed – turn); // exit condition: if (encoderDist >= dist) { ind++; } return ind; }

 Separate 2-D array into each row:

 Index into each parameter via the Index:

 Use Case Structure (C++: switch/case)  Each case is a primitive.  Number each case with the primitive ID.  In each case, put your code for that primitive – don’t forget the exit condition logic.  Start autonomous with array index = 0 or 1 (depending if you use the first column for starting position).  In each primitive, when you reach the exit condition, increment the array index.  The next primitive starts automatically.

 cRIO file structure:

 How to read a file in the cRIO:  Use Read From Spreadsheet File.vi  AutonArray is our 2-D array

 Getting the scripts to the cRIO: FTP  FileZilla is free

 Let’s make a script for our autonomous code and run it in simulation.  Shameless plug for tomorrow’s presentation here.

1. Create your autonomous code in a sub-vi. 2. Put your sub-vi in AutonomousIndependent.vi 3. Hook up inputs (sensor readings) and outputs (motor commands) to your sub-vi. 4. Wrap a “while loop” around everything. (That’s all there is to it)

 Why: Add flexibility / fast autonomous changes  How: Determine your primitives  Determine primitive parameters – don’t forget exit conditions.  Create Case Structure – one case for each primitive.  Use 2-D array as a script to control the autonomous software  Primitive is determined by the column index. When you exit one primitive, increment the column index and the next primitive starts automatically.

 Spreadsheet program, such as Excel or OpenOffice Calc  FTP software (such as FileZilla)  Simulation program is nice to have.  2 nd shot at shameless plug

 Presentation material and sample software will be posted on chiefdelphi.com in CD- Media/Papers area.  Feel free to send me a PM on chiefdelphi.com : “Chris Hibner”