Default_Routine(); - PWM Mapping /******************************************************************** * FUNCTION NAME: Default_Routine * PURPOSE: Performs.

Slides:



Advertisements
Similar presentations
Teacher/Mentor Institute Using the Cortex Chuck Powell.
Advertisements

Khaled A. Al-Utaibi Interfacing an LED The Light Emitting Diode (LED) Applications DC Characteristics & Operation Interfacing to.
EMS1EP Lecture 9 Analog to Digital Conversion (ADC) Dr. Robert Ross.
2008 KOP IR Sensor Workshop January 12, 2008 Hauppauge High School SPBLI - FIRST Mark McLeod Advisor Hauppauge Team 358 Northrop Grumman Corp.
Digital & Analog Inputs. Review Fundamental parts of an Arduino program are … Setting output types using pinMode. Declaring variables Can write a digital.
Photos and Sensor Instructions
Available at: – Program Optical Quad Encoders in Autonomous Mode Program optical quad encoders in autonomous mode.
EIGHTH GRADE ROBOTICS KITTATINNY REGIONAL HIGH SCHOOL MR. SHEA Introduction to Programming
FRC LabVIEW Software Overview Joe Hershberger Staff Software Engineer National Instruments.
RobotC Programming for LEGO Mindstorms NXT Carnegie Mellon Dacta Lego Timothy Friez Miha Štajdohar SOURCES:
LEGO Mindstorms NXT Carnegie Mellon Dacta Lego Timothy Friez Miha Štajdohar SOURCES:
Introduction to LabVIEW Seth Price Department of Chemical Engineering New Mexico Tech Rev. 10/5/14.
IR SENSORS AND ENCODERS. LCDs Timothy Friez Class # 2.
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.
LEGO Mindstorms NXT Programming We will be using the Common Palette for our Robots This is how you download your program onto the brick Drag and drop a.
Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lab 7P. 1Winter Quarter Stop Light Lab 7.
ARDUINO PROGRAMMING Working with the Arduino microcontroller.
FIRST Robotics Team 1619 Programming Workshop Programming the Control System Mark Dotterweich Team 1619 Mentor Presentation available at:
1 iSee Player Tutorial Using the Forest Biomass Accumulation Model as an Example ( Tutorial Developed by: (
Program ultrasonic range sensor in autonomous mode
Programming Concepts Part B Ping Hsu. Functions A function is a way to organize the program so that: – frequently used sets of instructions or – a set.
Lab 1 - Microcontrollers Complete the program template below being sure to select the correct parameters to meet the requirements (see the Microcontroller.
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.
Programming and Controls for FIRST – The Basics Tom Barch, Scott VanBrocklin and Kayla Peltier February 5 th, 2008.
Programming Concepts (Part B) ENGR 10 Introduction to Engineering 1 Hsu/Youssefi.
Programming and Controls Workshop – The Basics Tom Barch.
Available at: Lesson 3.6 – Program Line Follower in Autonomous Mode Program Line Follower in Autonomous Mode.
Teacher/Mentor Institute Using easyC Joel Kirkland July 30-31, 2015.
ROBOTC Training Session 1 Timothy Friez 1/10/08 Revision 1.
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.
Instrumentation & Control Engg. Section Electrical Engineering Department Ahmedabad , Gujarat.
David GiandomenicoFeedback Control for your FIRST Robot’s DrivetrainDec 2010 WRRF Workshops #1 David Giandomenico Team mentor for Lynbrook Robotics – Team.
An Objective and Component View (Not included Drive: Balance and Turret: Axis Camera)
Example Design Programming controls for an imaginary robot. The robot has to drive around, use a camera to track a green light, aim using a turret, and.
Available at: Lesson 3.5 – Program Light Sensor in Autonomous Mode Program Light Sensor in Autonomous Mode.
FRC Robot Programming 1.PID Continued 2.Downloading and Deploying Code 3.Program a 2012 Robot from Spec Basic code For FIRST Robotics.
Microcomputers Final Project.  Camera surveillance is an important aspect of Robotics.  Autonomous robots require the use of servos for camera control.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
Understanding The 2008 FRC Robot Controller Chris Gregory FRC1089 – Team Mercury
Photos and Sensor Instructions
LEGO® MINDSTORMS® NXT Move Block.
ARDUINO 1. Basics  Comments  /* * Blink * * The basic Arduino example. Turns on an LED on for one second, * then off for one second, and so on... We.
Teacher/Mentor Institute Using easyC David Dominguez June 2, 2015 Update Version.
The George Washington University Department of ECE ECE Intro: Electrical & Computer Engineering Dr. S. Ahmadi Class 4/Lab3.
1-3 GPIO_Output(LuminaryLibrary) 1.Alter the output current to 4mA 2.Let LED0 turn on but LED 1 turn off. Modify your program in E:\yourname\arm.
My first robot programming - Simple “Go” Young Joon Kim MSRDS First Beginner Course – STEP4.
VEX and Robot C Chris Patterson Frisco ISD CTE Center Presented by.
Innovation First Hardware & Default Program The 5¢ Tour... Dr. Joe January 5, 2002.
Casne.ncl.ac.uk Taking care of the CrumbleBot Please do NOT stress the robot's motors 1.Do NOT push the robot 2.Do NOT hold the.
Atmega328p Introduction for Digital and PWM Output Brion L Fuller II Robotics Club.
Programming Applied Sensors in FIRST Robots Chris Elston – Team Download sample code:
ROBOTC for CORTEX Teacher Training © 2011 Project Lead The Way, Inc. Automation and Robotics VEX.
Introduction to Programming in RobotC
Microprocessors Tutorial 1: Arduino Basics
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Basics for Robotics Programming
Introduction to Team 294 Programming Concepts
CS-4540 Robotics - Lab 05 Switch inputs to the Arduino Uno
Training 11/11/16 Robot Code (WPILib).
VEXnet User's Guide.
Photos and Sensor Instructions
1.15: Dual Joystick Control (Tank)
An Introduction to VEX IQ Programming with Modkit
RobotC Programming for LEGO Mindstorms NXT
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Interface ckt for demo Outputs Inputs V PIN 0 10K PIN 4 GND GND
Introduction to Programing the Cortex for BEST
Presentation transcript:

Default_Routine(); - PWM Mapping /******************************************************************** * FUNCTION NAME: Default_Routine * PURPOSE: Performs the default mappings of inputs to outputs. * CALLED FROM: this file, Process_Data_From_Master_uP routine * ARGUMENTS: none * RETURNS: void */ void Default_Routine(void) { /* Analog Inputs (Joysticks) to PWM Outputs * * This maps the joystick axes to specific PWM outputs. */ pwm01 = p1_y; pwm02 = p2_y; pwm03 = p3_y; pwm04 = p4_y; pwm05 = p1_x; pwm06 = p2_x; pwm07 = p3_x; pwm08 = p4_x; pwm09 = p1_wheel; pwm10 = p2_wheel; pwm11 = p3_wheel; pwm12 = p4_wheel; ifi_aliases.h contains all of these macro definitions and more… OUTPUTS INPUTS unsigned char Range: 0 to 255

Default_Routine(); - 1 Joystick Drive /* Joystick Drive * * This code mixes the Y and X axes on Port 1 to allow one joystick drive. * Joystick forward = Robot forward * Joystick backward = Robot backward * Joystick right = Robot rotates right * Joystick left = Robot rotates left * 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. */ pwm13 = pwm14 = Limit_Mix( p1_y + p1_x - 127); pwm15 = pwm16 = Limit_Mix( p1_y - p1_x + 127);

Default_Routine(); - Buttons to Relays /* Buttons to Relays * * This default code maps the joystick buttons to specific relay outputs. * Relays 1 and 2 use limit switches to stop the movement in one direction. * The & used below is the C symbol for AND */ relay1_fwd = p1_sw_trig & rc_dig_in01; /* FWD only if switch1 is not closed. */ relay1_rev = p1_sw_top & rc_dig_in02; /* REV only if switch2 is not closed. */ relay2_fwd = p2_sw_trig & rc_dig_in03; /* FWD only if switch3 is not closed. */ relay2_rev = p2_sw_top & rc_dig_in04; /* REV only if switch4 is not closed. */ relay3_fwd = p3_sw_trig; relay3_rev = p3_sw_top; relay4_fwd = p4_sw_trig; relay4_rev = p4_sw_top; relay5_fwd = p1_sw_aux1; relay5_rev = p1_sw_aux2; relay6_fwd = p3_sw_aux1; relay6_rev = p3_sw_aux2; relay7_fwd = p4_sw_aux1; relay7_rev = p4_sw_aux2; relay8_fwd = !rc_dig_in18; /* Power pump only if pressure switch is off. */ relay8_rev = 0; ifi_aliases.h lists these aliases

Default_Routine(); - Limit Switches /* PWM outputs Limited by Limit Switches */ Limit_Switch_Max(!rc_dig_in05, &pwm03); Limit_Switch_Min(!rc_dig_in06, &pwm03); Limit_Switch_Max(!rc_dig_in07, &pwm04); Limit_Switch_Min(!rc_dig_in08, &pwm04); Limit_Switch_Max(!rc_dig_in09, &pwm09); Limit_Switch_Min(!rc_dig_in10, &pwm09); Limit_Switch_Max(!rc_dig_in11, &pwm10); Limit_Switch_Min(!rc_dig_in12, &pwm10); Limit_Switch_Max(!rc_dig_in13, &pwm11); Limit_Switch_Min(!rc_dig_in14, &pwm11); Limit_Switch_Max(!rc_dig_in15, &pwm12); Limit_Switch_Min(!rc_dig_in16, &pwm12); void Limit_Switch_Max(unsigned char switch_state, unsigned char *input_value) { if (switch_state == CLOSED) { if(*input_value > 127) *input_value = 127; }

Default_Routine(); - Feedback LEDs I /* ROBOT FEEDBACK LEDs * * This section drives the "ROBOT FEEDBACK" lights on the Operator Interface. * The lights are green for joystick forward and red for joystick reverse. * These may be changed for any use that the user desires. */ if (user_display_mode == 0) /* User Mode is Off */ { /* Check position of Port 1 Joystick */ if (p1_y >= 0 && p1_y <= 56) { /* Joystick is in full reverse position */ Pwm1_green = 0; /* Turn PWM1 green LED - OFF */ Pwm1_red = 1; /* Turn PWM1 red LED - ON */ } else if (p1_y >= 125 && p1_y <= 129) { /* Joystick is in neutral position */ Pwm1_green = 1; /* Turn PWM1 green LED - ON */ Pwm1_red = 1; /* Turn PWM1 red LED - ON */ } else if (p1_y >= 216 && p1_y <= 255) { /* Joystick is in full forward position*/ Pwm1_green = 1; /* Turn PWM1 green LED - ON */ Pwm1_red = 0; /* Turn PWM1 red LED - OFF */ } else { /* In either forward or reverse position */ Pwm1_green = 0; /* Turn PWM1 green LED - OFF */ Pwm1_red = 0; /* Turn PWM1 red LED - OFF */ } /*END Check position of Port 1 Joystick

Default_Routine(); - Feedback LEDs II /* This drives the Relay 1 and Relay 2 "Robot Feedback" lights on the OI. */ Relay1_green = relay1_fwd; /* LED is ON when Relay 1 is FWD */ Relay1_red = relay1_rev; /* LED is ON when Relay 1 is REV */ Relay2_green = relay2_fwd; /* LED is ON when Relay 2 is FWD */ Relay2_red = relay2_rev; /* LED is ON when Relay 2 is REV */ Switch1_LED = !(int)rc_dig_in01; Switch2_LED = !(int)rc_dig_in02; Switch3_LED = !(int)rc_dig_in03; } /* (user_display_mode = 0) (User Mode is Off) */ else /* User Mode is On - displays data in OI 4-digit display*/ { User_Mode_byte = backup_voltage*10; /* so that decimal doesn't get truncated. */ } } /* END Default_Routine(); */

Places to modify: Add variables Initialization Modify Default_Routine() Add to slow loop Add to fast loop Add to Autonomous code in: user_routines.c in: user_routines_fast.c