Programming and Controls for FIRST – The Basics Tom Barch, Scott VanBrocklin and Kayla Peltier February 5 th, 2008.

Slides:



Advertisements
Similar presentations
Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
Advertisements

Teacher/Mentor Institute Using the Cortex Chuck Powell.
US First Robotics Lab View Tutorials Jim Thomas Lawrence Berkeley National Laboratory Team 496 Port Jeff Powerhouse.
Computer Basics Hit List of Items to Talk About ● What and when to use left, right, middle, double and triple click? What and when to use left, right,
BEST Robotic, Inc. easyC Team Training
Jason Howard. Agenda I. How to download robotc II. What is tele-op used for? III. How to build a basic tele-op program IV. Getting the robot to drive.
Lab7: Introduction to Arduino
Mini-SumoBot Construction and Programming
1. 2 LabVIEW for FRC Doug Norman National Instruments January 6, 2012.
HYDRAULICS & PNEUMATICS
Vex Robotics Introduction to Sensors. introduction to sensors Sensors assist robots in seeing and feeling the physical world through which they travel.
Bread Boarding and Operating The IFI Robotic Control System.
Part 1: Introduction FRC Introduction  FRC 2907 since 2008  Each area of the robot has a team assigned  The Electronics team is headed this year.
Vex 1.0 © 2005 Carnegie Mellon Robotics Academy Inc. Programming in easyC.
Erik A. Cokeley Programming Workshop FIRST 2007.
Old control system ( ) MVRT. Main Circuit Breaker Connected to the red wire (power) of the battery When turned off, all power is cut off and robot.
LSU 06/04/2007BASIC Stamp Editor1 The BASIC Stamp Editor Programming Unit, Lecture 3.
1. A guide to wiring your robot. Jerry Skene Past mentor – Chantilly Robotics
Electro-Pneumatics Module 1
Driver Station MVRT 2009 – 2010 Season. Add information Breadboard Classmate PC USB Hub Joysticks Stop Button.
LabView Basics The Fighting Pi Controls Group. About LabView LabView is a highly adaptable programming GUI (Graphic User Interface) LabView compiles the.
1 iSee Player Tutorial Using the Forest Biomass Accumulation Model as an Example ( Tutorial Developed by: (
The George Washington University Electrical & Computer Engineering Department ECE 002 Dr. S. Ahmadi Class 2.
Available at: – Operate the Tumbler using a Jumper Pin Operate the Tumbler using the jumper pin.
Weston Schreiber & Joshua Gabrielse Robotics Summer Training Programming #1: EasyC Basics.
Teacher/Mentor Institute Hands-On Session: Building a Robot Scott McEwen Chuck Powell.
LabVIEW Workshop September 26, 2009 Hauppauge High School SPBLI - FIRST Mark McLeod Advisor Hauppauge Team 358 Northrop Grumman Corp.
Programming and Controls Workshop – The Basics Tom Barch.
Teacher/Mentor Institute Using easyC Joel Kirkland July 30-31, 2015.
BEST Robotic, Inc. easyC Breakout Session By: Guy Chetrit Programming With easyC September 15, Copyright © 2012 BEST Robotics, Inc. All rights reserved.
Gauge Operation and Software by Scott A. Ager. Computer Recommendations 750 MHz Pentium III 64 Meg SRAM 40 Gig Hard Drive 1024 x 768 graphics CD Writer.
ROBOTC Training Session 1 Timothy Friez 1/10/08 Revision 1.
Teacher/Mentor Institute Hands-On Session: Building a Robot Carolyn Bauer July 30-31, 2015.
How to Program the 2004 Robot Controller from Innovation First For new C programmers and non- technical types.
Beginner Programming Workshop Simona Doboli Assistant Professor Computer Science Department Hosftra University November.
EasyC Programming Workshop January 30, 2008 Hauppauge High School SPBLI - FIRST Mark McLeod Advisor Hauppauge Team 358 Northrop Grumman Corp.
7.2 V battery pack and charger Put the battery in the charger station at the end of the lab. period. Red light indicates charging. Ken Youssefi Introduction.
The George Washington University Department of ECE ECE 1010 Intro: Electrical & Computer Engineering –Introducing KIPR Link/Interface and Set-up –Continuation.
Overview What is Arduino? What is it used for? How to get started Demonstration Questions are welcome at any time.
Default_Routine(); - PWM Mapping /******************************************************************** * FUNCTION NAME: Default_Routine * PURPOSE: Performs.
9/2/ CS171 -Math & Computer Science Department at Emory University.
FRC Robot Programming 1.PID Continued 2.Downloading and Deploying Code 3.Program a 2012 Robot from Spec Basic code For FIRST Robotics.
Vex Robotics Program six: combining autonomous and radio control.
Introduction to Vexnet
Understanding The 2008 FRC Robot Controller Chris Gregory FRC1089 – Team Mercury
Session 11 Intro to FRC API.
Brain Software. Things you need Administrator Rights Know how to open a folder Know how to unzip a file??? Know any special changes your IT department.
Teacher/Mentor Institute Using easyC David Dominguez June 2, 2015 Update Version.
PRACTICAL ELECTRONICS MASTERCLASS (Mr Bell) (COMPUTERS REQUIRED FOR 1 ST & 2 nd PERIOD) 1.
Software Subsystem Scot Marshall Lead Manufacturing Test Engineer Constellation Project / Orion CEV Lockheed Martin Space Systems Michoud Operations Team.
Programming - Motion Intro to Robotics. Motors and Sensors Setup The first thing we need to do is tell ROBOTC that we have motors on our robot. Choose.
Electrical and Controls Workshop – The Basics Mike McIntyre & Rahamath Shaik September 26, 2015 (with props to Tom Barch!)
Automation and Robotics.  First you select the platform type so that you can use Natural Language PLTW.
Vex Robotics program three: using motors and sensors together.
Innovation First Hardware & Default Program The 5¢ Tour... Dr. Joe January 5, 2002.
Copyright © 2007 by Pearson Education 1 UNIT 6A COMBINATIONAL CIRCUIT DESIGN WITH VHDL by Gregory L. Moss Click hyperlink below to select: Tutorial for.
Programming Applied Sensors in FIRST Robots Chris Elston – Team Download sample code:
Teacher/Mentor Institute Intro to easyC Programming Scott McEwen July 21-22, 2016.
After Construction Name: Per #:.
Introduction to Vexnet
Making a 24hr Timer.
Basics for Robotics Programming
Introduction to Team 294 Programming Concepts
Programming - Buttons Intro to Robotics.
Programming - Buttons Intro to Robotics.
Running a Java Program using Blue Jay.
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Introduction to Programing the Cortex for BEST
Presentation transcript:

Programming and Controls for FIRST – The Basics Tom Barch, Scott VanBrocklin and Kayla Peltier February 5 th, 2008

Agenda  System Overview How the systems works – Controls Block Diagram Robot Controller Operator Interface  Controls Overview of the controls used and how they work  Programming How to get started with the EasyC Program Software Default Code Reference Guide – How and why to use MPLAB and IFE Loader – How to install and use Default Code – An overview Downloading the Code to the Robot Controller  Pneumatic Controls Overview of the pneumatics system – Block Diagram Controlling the pneumatics – Understanding the controls

Robot Controller or RC

Robot Controller System Block Diagram

Operator Interface or OI

Operator Interface System Block Diagram

Tether Communications

Radio vs. Tether communication  If the controllers ‘see’ a tether cable connection, then they will communicate via the tether port.  If no tether connection exists, then they will attempt to use the radio signal.  Note: Connecting via radio at the competition other than during a match is not allowed and can be dangerous if another teams operator interface controls your robot.

Controls  Understanding the controls will help to understand the software variables and how the software is modifying and outputting them to get the Robot to move.  The joystick is read by the Operator Interface and is transmitted to the Robot Controller. It usually drives a pwm output which controls a Victor 883 or 884 speed controller. The speed controller maybe wired to a drill motor.  By pressing the joystick, we hope to control the speed and direction of the motor to get the Robot to move.  Lets start with the Joystick.

Joystick  The joystick consists of two potentiometers mounted to a stick that vary as the stick is moved along its axis.  One potentiometer is mounted in the x axis or left – right direction and the other is mounted in the y axis or forward – backward direction.  As the potentiometer moves from one extreme to the other, the operator interface reads the voltage from 0 to 5 volts.  This voltage is broken into an 8 byte variable that ranges from 0 (0 volts) to 254 (5 volts).

Joystick - continued  Full forward in the y axis will result in p1_y = 254.  When the joystick is in the center, it reads 127.  Full backward would read 0

Victor Speed Controller  The input to the speed controller is a pwm signal that varies from software value of 0 to 254.  Battery and ground is supplied to two input terminals and the two output terminals can be wired to an electrical load like a drill motor.  At an input of 127, the two outputs which we will call m+ and m- are at 0 volt difference  As the pwm increases from 127 toward 254, the voltage varies from a positive difference of 0 to 12 volts.  As the pwm decreases from 127 towards 0, the voltage varies from a negative difference of 0 to 12 volts.

Victor 884 speed controller

Joystick to Motor  The joystick variable read by the Operator Interface is the same as the variable outputted to the pwm output to drive the motors forward and reverse.  In the default software, port one y axis is output directly to pwm01 port: pwm01 = p1_y;  In the default software, port two y axis is output directly to pwm02 port: pwm02 = p2_y;  The two of these make up the tank drive (two joystick).  The software also outputs joystick one x and y axis to pwm ports 13 and 15 to get one joystick drive.

Joystick Switches  Located on the joysticks are four switches that are read by the computer as 0 or a 1. When the switch is closed, then the variable is read as a one.  These switch inputs are mapped to the relay outputs. relay1_fwd = p1_sw_trig; relay1_rev = p1_sw_top; relay_5_fwd = p1_sw_aux1; relay_5_rev = p1_sw_aux2;

Spike Controller  The spike controller is a relay or electronic switch that will drive two outputs based on the inputs.  The reason for two input and two outputs are to enable the output to be driven positively or negatively to drive a small motor forward or reverse.  When the inputs to the relay are driven both as 0, then the outputs are both at 0 volts. One input is called Fwd and one is called Rev. One output is m+ the other is m-.  If the Fwd input is a 1 and the Rev input is a zero, then the m+ output will be 12volts and the m- output will be 0 volts.  The spike can be used to drive small motors, lights, air compressor, or any other 12 volt electrical load. The concern is the current draw which is much lower then the speed controllers.

Spike Blue Controller

Spike Truth Table  The truth table for the input to output is as follows:

Spike alternative circuit  The spike can also be used to drive two different outputs in a on/off sequence.  An example would be two solenoid valves.

Programming the Robot Controller

Using EasyC  “EasyC” is very useful for people who do not have much experience with programming.  It’s a much simpler version of the “C” language  Teams may choose to program with either “EasyC” or the standard “C” with MPLAB

Getting Started With EasyC

Begin by setting up your robot controller by selecting “Robot Controller Setup” in the Options toolbar.

Select the “FRC Robot Controller” and the “FRC (PIC18F8722)” device…and click “ok”.

Loader Setup  Go to the “Build and Download” toolbar and click “Loader Setup”  Make sure the settings are as follows…

Downloading Default Code Using EasyC You can either:  Write your own default code or  Use the one provided by the EasyC Software.

To download the default code provided by EasyC go to the “Build and Download” toolbar and click “Download Default Code”

It will ask you if you’re sure you want to download the program…click “yes” The computer will then erase the memory on the robot controller and download the default code.

Robot Controller Code  MPLAB IDE v6.30 is the C programming editor and complier from PC Microchips used to edit and compile the code.  IFE Loader is a program that will download the complied code into the robot.  None of this is necessary if the default code is used.  If modifications are necessary (custom functions are needed/variables need to change slightly), the code will only need modifications instead of a complete re-write.

Default Code Reference Guide  Available from Innovation First website (in the Robot Controller section at the bottom)  Shows OI wiring/variables to RC variables/output for the default code functions.  Contains the variable listing for modification of default code. FRC 2004 RC Default Code Reference Guide.pdf

Table of Contents

Joystick Function Joystick plugged into port 1 Y-Axis is forward – backwards (tank drive) P1_y is the variable used in the software to read this function RC PWM1 is the port that the left side victor should be plugged into to make port 1 the left joystick for tank style drive

Single Joystick Drive  Missing from default guide – It is on the front cover but hard to read.  Connect the right drive motors to PWM13 and/or PWM14 on the RC.  Connect the left drive motors to PWM15 and/or PWM16 on the RC.

MPLAB Install  Adobe PDF document exists on CD  Has the defaults and instructions for installing MPLAB as well as the IFE loader.  C-BOT_Install_ pdf C-BOT_Install_ pdf

MPLAB and Default code  After downloading the default code, place the unzipped files in a directory, preferable in c:\code\frccode.  MPLAB and First recommends a simple directory. My Documents is a complex directory in Windows 2000 and Windows XP.  Saving an old revision and creating a new one is done by copying the folder and pasting to new director (i.e. copy c:\code\frccode into a new directory c:\code\frccode1 and so on).

Opening the default workspace  Do not use the file open command. Use the open workspace command.

User_routine.c  Most of the code changes will be made in the user_routine.c file  Custom code should be placed in Process_Data_From_Master_uP function at /* Add your own code here */.  The specific functions for most of the inputs/outputs are in the Default_Routine which is at the bottom of User_routine.c The variables can be modified in the default routine, but make sure to use new revision directories here so that changes can be reversed.

Modifying a variable  Lets say that the right side joystick is backwards. When the joystick is pressed forward the robot moves backward.  There would be two options. Change the M+ and M- terminals on the Victor (this is actually the recommended fix)  The software could also be changed to reverse the direction on the motor.  Locate the default statement for the right controller pwm02 = p2_y;  The code could be modified as follows: pwm02 = 254 – p2_y;

Modifying a variable (continued) P2_yFormulapwm – 0 = – 254 = – 127 = – 42 = – 212 = – 86 = – 168 = 8686

Compiling the code  In MPLAB, select the Project menu and select the Build All command.  The Output window will have the comments on if the build was successful or if there are errors.  If there are errors, locate the error and fix.  Be careful with where the error occurs. The actual error can be many lines of code before the syntax error. An example would be a begin comment marker without an end marker. All the code will be commented out until the next end marker.

Loading the code into the RC  IFE Loader is the program used to download the compiled code.  Make sure that the RC program port is plugged into a serial com port on the computer.  Set the IFE loader to the com port plugged into.  Press the program button on the RC and then press the download button.  The terminal window can be used in conjunction with the printf command to display variables on the terminal window.  Remember that the printf statement will output every time the command executes. If the printf is in the slow loop it will print every 26.2ms or even faster in the fast loop. This may be hard to read with the data scrolling off the screen.  The buffer is a circular buffer so it won’t fill up. The old data won’t be there either, so you may need some type of logic to keep the data on the screen.

Pneumatic Controls Block Diagram

Pneumatic Controls  The air compressor is wired through a relay controlled by the pressure switch. When the pressure switch drops below the set switch point, the relay is energized turning on the air compressor. When the pressure exceeds the set switch point, the relay is de- energized turning off the air compressor.  Controlling the pneumatic cylinders is then accomplished through a single or double solenoid valve. “Single-acting” or single solenoid valve will extend the air cylinder while the solenoid is energized. When the solenoid is de- energized, the air cylinder will close. “Double-acting” or double solenoid valve will extend or open a air cylinder when one of the solenoids is activated and will close when the other solenoid is activated. After either solenoid is deactivated, the air cylinder will remain open or closed.  These solenoid valves are controlled via a spike.

Spike Truth Table Single Solenoid Valve (two valves wired to M+ & M-) INPUTSOUTPUTS FwdRevM+M-IndicatorSolenoid Function 00GND OrangeOff / Brake Condition (Default) 10+12VGNDGreenSolenoid1 Activates (M+) 01GND+12VRedSolenoid2 Activates (M-) 11+12V OffSolenoid 1 & 2 Activates Double Solenoid Valve (both positives wired to M+ & M- with grounds to ground block) INPUTSOUTPUTS FwdRevM+M-IndicatorSolenoid Function 00GND OrangeOff / Brake Condition (Default) 10+12VGNDGreenSolenoid Activates Direction A 01GND+12VRedSolenoid Activates Direction B 11+12V OffSolenoid Activation is unknown

Summary  There are other websites for resources.  The has many presentations on the subjects presented here.  Hopefully this has been informative and will help in the coming weeks.