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.

Slides:



Advertisements
Similar presentations
US First Robotics Lab View Tutorials Jim Thomas Lawrence Berkeley National Laboratory Team 496 Port Jeff Powerhouse.
Advertisements

Session Objectives: Review basic math for single swerve module
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.
Add and Use a Sensor & Autonomous For FIRST Robotics
InnoSys Process Sequence. End Effector Components End Effector Prox Switch Load Cell Wire Conduit Crows Foot Nut Runner.
2008 KOP IR Sensor Workshop January 12, 2008 Hauppauge High School SPBLI - FIRST Mark McLeod Advisor Hauppauge Team 358 Northrop Grumman Corp.
Code – Mplab – IFI loader Nick and Kyle. Background Original C oriented Designed to be lightweight yet robust Very small subset of C.
Wait, sound sensor >70, Port 2 Flowchart – Heartbeat 1 Start Motor A, Move Backward, 1/3 Rotation, Power 20 Wait, 1 Second Sound Sensor (Port 2) Less than.
Drive Controls High Gear (?) Low Gear (?) Forward Reverse Left Right Used Button Camera Climbing Position Camera Shooting Position.
V EX C OACHES ' T RAINING October 12, Agenda for Today 9 – 10 AM : Tina Reeves and the Engineering Notebook 10 – Noon : Finish Building, Basic Robot.
EIGHTH GRADE ROBOTICS KITTATINNY REGIONAL HIGH SCHOOL MR. SHEA Introduction to Programming
Killer Autonomous Programming Make um say “Wow!” Presented By: Frank Larkin Lansdale Catholic Robotics, Team 272 FIRST Championships Forum, Atlanta Georgia.
RobotC Programming for LEGO Mindstorms NXT Carnegie Mellon Dacta Lego Timothy Friez Miha Štajdohar SOURCES:
EBOT: Programming Primer Sean Donovan Alexander Hecht Justin Woodard.
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.
FIRST Robotics Team 1619 Programming Workshop Programming the Control System Mark Dotterweich Team 1619 Mentor Presentation available at:
LabView Basics The Fighting Pi Controls Group. About LabView LabView is a highly adaptable programming GUI (Graphic User Interface) LabView compiles the.
The George Washington University Electrical & Computer Engineering Department ECE 002 Dr. S. Ahmadi Class 2.
Lab 1 - Microcontrollers Complete the program template below being sure to select the correct parameters to meet the requirements (see the Microcontroller.
Lego Robot Construction Project. Adam, Roger, Lu, Riana, Paul.
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.
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.
Autonomous Robot Project Lauren Mitchell Ashley Francis.
RobotC Advanced Concepts SSI Robotics September 7, 2013 Capitol College.
ROBOTC Training Session 1 Timothy Friez 1/10/08 Revision 1.
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.
David GiandomenicoFeedback Control for your FIRST Robot’s DrivetrainDec 2010 WRRF Workshops #1 David Giandomenico Team mentor for Lynbrook Robotics – Team.
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.
EV3 Workshop Oct 3, 2015 Instructor: Chris Cartwright
An Objective and Component View (Not included Drive: Balance and Turret: Axis Camera)
The George Washington University Department of ECE ECE 1010 Intro: Electrical & Computer Engineering –Introducing KIPR Link/Interface and Set-up –Continuation.
David GiandomenicoBasic Feedback Control 5/15/2012 David Giandomenico Team mentor for Lynbrook Robotics – FIRST #846 David Giandomenico Team mentor for.
Default_Routine(); - PWM Mapping /******************************************************************** * FUNCTION NAME: Default_Routine * PURPOSE: Performs.
FRC Robot Programming 1.PID Continued 2.Downloading and Deploying Code 3.Program a 2012 Robot from Spec Basic code For FIRST Robotics.
ALL TERRAIN ROBOT 1 Wilmer Arellano. The Client’s Need  Verbally presented at class time.  Modify the All Terrain Manual Robot into an autonomous Gripper.
Xtreme Robot Olympiad Programming Basics Dr. Peter Laz Associate Professor Department of Engineering University of Denver.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
Part III Robot Drive. Robot Main.vi The main body of your code: accesses all of the other programs in your project A big loop! Do not add any more loops.
Find the Mindstorms Icon on the computer.. To start a new program click go.
Session 12 Sensors and Timers. 3 Main Types of Robot Projects Command-Based Robot A more complicated project for more complicated robots Iterative Robot.
LEGO® MINDSTORMS® NXT Move Block.
Electronics and Controls
TU STORM The TU STORM Robot Controller: Innovation First Mini Robot Controller (Microchip PIC18F8520) Programmable in C Using MPLAB IDE.
Programming with LabVIEW Intro to programming and.
Microcontrollers, Microcomputers, and Microprocessors
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.
ME 120: Arduino PWM For Loops in Arduino ME 120 Mechanical and Materials Engineering Portland State University
Introduction to Robots and the Mind - Programming with Sensors - Bert Wachsmuth & Michael Vigorito Seton Hall University.
EV3 Programming: Moving and Turning CONFIDENTIAL © 2014 Cymer, LLC.
ME 120: Arduino PWM Breathing LED Code: Implementation on Arduino ME 120 Mechanical and Materials Engineering Portland State University
Arduino Application: Speed control of small DC Motors
Programming Applied Sensors in FIRST Robots Chris Elston – Team Download sample code:
Get In Gear. Opening Activity Describe what “speed” is. Give a verbal definition, any equations you know, and examples of different speeds.
ROBOTC for CORTEX Teacher Training © 2011 Project Lead The Way, Inc. Automation and Robotics VEX.
Introduction to Programming in RobotC
If you want to swing an robot arm or …
Mindstorm Robots 4th Grade Lesson 1.
ADVANCED BRAIN Training
Basics for Robotics Programming
Introduction to Team 294 Programming Concepts
Learning Outcomes Understand While Loop
Selection Learning Objective: to be able to design algorithms that use selection.
Introduction to RobotC
RobotC Programming for LEGO Mindstorms NXT
Introduction to Programing the Cortex for BEST
Presentation transcript:

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 shoot projectiles at the target. The drive system for the robot consists of two independent drive channels, controlled by two separate PWMs driven by two joysticks. The joysticks’ y-axes control the velocities of the drive motors; stopped, forward and reverse. The turret autonomously tracks the target using the CMU Cam2 and is limited in its travel to +/- 45 degrees by a potentiometer. The driver can re-center the turret with a button on the joystick, and can drive the shooter to load and fire with another button. The OI is programmed to have indicators for the drive controls and a “locked-on-target” LED.

void main (void) { #ifdef UNCHANGEABLE_DEFINITION_AREA IFI_Initialization (); /* DO NOT CHANGE! */ #endif User_Initialization(); /* You edit this in user_routines.c */ statusflag.NEW_SPI_DATA = 0; /* DO NOT CHANGE! */ while (1) /* This loop will repeat indefinitely. */ { #ifdef _SIMULATOR statusflag.NEW_SPI_DATA = 1; #endif if (statusflag.NEW_SPI_DATA) /* 26.2ms loop area */ { /* I'm slow! I only execute every 26.2ms because */ /* that's how fast the Master uP gives me data. */ Process_Data_From_Master_uP(); /* You edit this in user_routines.c */ if (autonomous_mode) /* DO NOT CHANGE! */ { User_Autonomous_Code(); /* You edit this in user_routines_fast.c */ } Process_Data_From_Local_IO(); /* You edit this in user_routines_fast.c */ /* I'm fast! I execute during every loop.*/ } /* while (1) */ } /* END of Main */

void Process_Data_From_Master_uP(void) { static unsigned char i; Getdata(&rxdata); /* Get fresh data from the master microprocessor. */ Camera_Process_Data_From_Master_uP(); Default_Routine(); /* Optional. See below. */ /* Add your own code here. (a printf will not be displayed when connected to the breaker panel unless a Y cable is used) */ printf("Port1 Y %3d, X %3d, Fire %d, Top %d\r",pwm01,pwm05,p1_sw_trig,p1_sw_top); /* printf EXAMPLE */ Generate_Pwms(pwm13,pwm14,pwm15,pwm16); Putdata(&txdata); /* DO NOT CHANGE! */ }

void Default_Routine(void) { //pwm01 left drive motors //pwm02 right drive motors //pwm03 firing motor //pwm04 shooter loader motor //relay1 turret rotator motor DriveControl(); TurretControl(); ShooterControl(); IndicatorOutput(); } /* END Default_Routine(); */

void DriveControl(void) { /*Using pwm01 as left drive motors and pwm02 as right * drive motors. We are limiting the change of the speed of * the drive motors to be less than +/-32. */ int delta = 32;//Allowable change to drive pwms per 26.2ms(tick) pwm01 = DeltaLimiter(delta, pwm01, p1_y); pwm02 = DeltaLimiter(delta, pwm02, p2_y); } int DeltaLimiter(int delta, int pwm, int joy) { if (joy > (pwm + delta)) { return (pwm + delta); } else { if (joy < (pwm - delta)) { return (pwm - delta); } else { return joy; }

void TurretControl(void) { int pot = Get_Analog_Value(turret_pot); int lowerBuffer = 10; if (p3_sw_top) { //recalibrate button if (pot < 124) { relay1_fwd = 1; relay1_rev = 0; } else { if (pot > 130) { relay1_fwd = 0; relay1_rev = 1; } else { relay1_fwd = 0; relay1_rev = 0; } } else { if (Get_Tracking_State() & STATE_PAN_ON_TARGET) {// Camera locked int min = 64; int max = 192; if (PAN_SERVO > (127 + lowerBuffer)) { relay1_fwd = DegreeLimiter(min, max, turret_pot); relay1_rev = 0; } else { if (PAN_SERVO < (127 - lowerBuffer)) { relay1_rev = DegreeLimiter(min, max, turret_pot); relay1_fwd = 0; } else { relay1_fwd = 0; relay1_rev = 0; } } else { relay1_fwd = 0; relay1_rev = 0; }

int DeltaLimiter(int delta, int pwm, int joy) { if (joy > (pwm + delta)) { return (pwm + delta); } else { if (joy < (pwm - delta)) { return (pwm - delta); } else { return joy; }

void ShooterControl(void) { if (p4_sw_trig) { pwm03 = 255; pwm04 = 255; } else { pwm03 = 127; pwm04 = 127; }

void IndicatorOutput(void) { //…Code Hidden Switch1_LED = !(int)rc_dig_in01; Switch2_LED = !(int)rc_dig_in02; if (Get_Tracking_State() & STATE_PAN_ON_TARGET ) { Switch3_LED = 1; } else { Switch3_LED = 0; }