ROBOTC Training Session 1 Timothy Friez 1/10/08 Revision 1.

Slides:



Advertisements
Similar presentations
Introduction to Programming
Advertisements

While Loops and If-Else Structures
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.
Automation and Robotics
VEX and Robot C Chris Patterson Presented by Modified by J. Andazola.
Developed in collaboration with Introduction to Programming.
Vex Robotics Introduction to Sensors. introduction to sensors Sensors assist robots in seeing and feeling the physical world through which they travel.
Autonomy using Encoders Intro to Robotics. Goal Our new task is to navigate a labyrinth. But this time we will NOT use motor commands in conjunction with.
Programing Concept Ken Youssefi/Ping HsuIntroduction to Engineering – E10 1 ENGR 10 Introduction to Engineering (Part A)
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:
IR SENSORS AND ENCODERS. LCDs Timothy Friez Class # 2.
Introduction to Sensors
1 Introduction to Coding. 2 Example Codes A lot of example codes are given with Arduino IDE A code can often be based on a previous example rather than.
Programming – Touch Sensors Intro to Robotics. The Limit Switch When designing robotic arms there is always the chance the arm will move too far up or.
Working with Arduino: Lesson #1: Getting Acquainted with the Kit EGN1007.
Testbed: Exercises.
What is RobotC?!?! Team 2425 Hydra. Overview What is RobotC What is RobotC used for What you need to program a robot How a robot program works Framework.
ROBOTC Software Introduction. ROBOTC Software ROBOTC developed specifically for classrooms and competitions Complete programming solution for VEX Cortex.
Program ultrasonic range sensor in autonomous mode
Coding for the FIRST Tech Challenge: RobotC Presented by: Audrey Yeoh Acknowledgements: Team Unlimited FTC 0001.
Coding for the FIRST Tech Challenge: RobotC
Programming and Controls for FIRST – The Basics Tom Barch, Scott VanBrocklin and Kayla Peltier February 5 th, 2008.
Teacher/Mentor Institute Using easyC Joel Kirkland July 30-31, 2015.
EasyC Programming Workshop January 30, 2008 Hauppauge High School SPBLI - FIRST Mark McLeod Advisor Hauppauge Team 358 Northrop Grumman Corp.
Programming Design ROBOTC Software Principles of Engineering
Default_Routine(); - PWM Mapping /******************************************************************** * FUNCTION NAME: Default_Routine * PURPOSE: Performs.
Available at: Lesson 3.5 – Program Light Sensor in Autonomous Mode Program Light Sensor in Autonomous Mode.
The George Washington University Electrical & Computer Engineering Department ECE 002 Dr. S. Ahmadi Class3/Lab 2.
RobotC Remote Control. Learning Objectives: Focusing on Virtual World with Physical Examples Understand Real-Time Joystick Mapping Understand how to use.
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.
Mindstorm NXT-G Introduction Towson University Robotics.
VEX and Robot C Chris Patterson Frisco ISD CTE Center Presented by.
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.
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.
Programming Basics - RobotC Introduction to Robotics.
Bot Shop Jane Taylor Dee Wallace Robot C For Vex.
Testbed Coding In this activity you will code different challenges for the Testbed. For each challenge a sample program is shown. Use what this sample.
Programming Design ROBOTC Software. Behavior-Based Programming A behavior is anything your robot does –Turning on a single motor or servo Three main types.
Decision Making: while loops and Boolean Logic. While Loops A while loop is a structure within ROBOTC which allows a section of code to be repeated as.
ROBOTC for CORTEX Teacher Training © 2011 Project Lead The Way, Inc. Automation and Robotics VEX.
Programming Design ROBOTC Software Principles Of Engineering
Introduction to Programming in RobotC
Introduction to Programming
Advanced EasyC Jim Cline July 20-21, 2017.
Automation and Robotics
Programming Design ROBOTC Software Computer Integrated Manufacturing
Programming - Motion Intro to Robotics.
Programming – Touch Sensors
Automation and Robotics
Working with Arduino: Lesson #1: Getting Acquainted with the Kit
Training 11/11/16 Robot Code (WPILib).
Programming – Remote Control Statements
Programming Basics - RobotC
Programming – Remote Control Statements
While Loops and If-Else Structures
Programming Design ROBOTC Software Principles Of Engineering
While Loops and If-Else Structures
While Loops and If-Else Structures
While Loops and If-Else Structures
Programming - Buttons Intro to Robotics.
Programming - Buttons Intro to Robotics.
Robotics Programming Using Shaft Encoders
Remote Control For this activity we will use the Squarebot
While Loops and If-Else Structures
RobotC Programming for LEGO Mindstorms NXT
While Loops and If-Else Structures
Programming Design ROBOTC Software Principles of Engineering
While Loops And If-Else Structures
Presentation transcript:

ROBOTC Training Session 1 Timothy Friez 1/10/08 Revision 1

Agenda ROBOTC Programming Fundamentals Using ROBOTC Interface Basic ROBOTC Programs Variables and the Debugger *Break* Competition Programming Using Sensors

ROBOTC Fundamentals Every program starts with a “task main” –Exception: Competition Template programming The “task main” is taken care of you behind the scenes. task main() { }

ROBOTC Fundamentals Programs consist of a number of statements. Statements tell the robot controller what to do. Motor[port1] = 127; is a statement All statements end with semicolons “;” Proper syntax (semicolons, brackets, etc) is very important.

ROBOTC Fundamentals Robots are dumb by nature. –They will only do what they are told. A robot will run forever unless told to stop. Motor[port1] = 127; Motor[port2] = 127; Robots will also only execute code once unless told otherwise. (a loop!)

ROBOTC Fundamentals Comments are very important for memory and understanding // - Single Line Comment /* Multiple line comments */

ROBOTC Fundamentals Robots require “Operating Systems” to run properly ROBOTC has it’s own Operating System, called Firmware. The firmware must be loaded onto the robot controller before.

Downloading the Firmware Three Steps to downloading firmware –1. Make sure your platform type is correct ROBOTC – Robot Menu – Platform Type – FRC –2. Make sure your robot is powered on and in Programming mode. On the FRC, hold the “PROG” button until two LEDs become orange. –3. Download the firmware ROBOTC – Robot Menu – Download Firmware – “FRC VM 0724.hex”

Motor Commands Motor[port] = speed; Motor – tells the controller we want to use a motor (PWM) port [port] – tells the controller what port to use –[port1], [port2], [port3], …, [port16] = speed; - assigns a value to the motor telling it what speed to travel is full forward, -127 is full reverse,0 is stop

Using Joysticks To control your robot using a joystick axis or a button, use these functions frcRF[port] – gets the value from a joystick axis –[port] – p1_y, p1_x, p1_wheel, … p2_x,…p3_x, etc. frcOIJoystickButtons[port] –[port] – oiButtonPort1Button1 through oiButtonPort4Button4

Slowing motors down ROBOTC lets you use math functions to control your motors speed Motor[port1] = (127 / 2); –This would actually set the motor to 63.5… rounded down to 63. You can use this when accessing sensor values and joystick values also Motor[port1] = (frcRF[p1_y] / 2) –This joystick input is now divided by 2 before being sent to the motor.

Using Loops A Loop will help a portion of your code execute repeatedly, until told to stop. while(true == true) { motor[port1] = frcRF[p1_y]; motor[port2] = frcRF[p2_y]; } This code will cause the motors to respond to the joystick values forever. –The loop reads (while true is equal to true)

Analog Sensors Very easy to read analog sensor values –SensorValue[port] –[port] = in1,in2,in3 … in16 while(SensorValue[in1] > 10) { motor[port1] = frcRF[p1_y]; motor[port2] = frcRF[p2_y]; } This program will run until an analog sensor on port 1 sees a value of less than 10. Analog sensor values can range from 0 to 1023

Digital Sensors Digital sensors are a little more complex –First you have to decide if you want the sensor port to be an input or output –frcDigitalIODirection[port] = condition; port – pio1, pio2, pio3, … pio18 condition – dirInput or dirOutput –Second you have read or assign the value –frcDigitalIOValue[port] If an input, this will read the value (either a 1 or 0) If an output, you can assign the value using a 1 or 0. –frcDigitalIOValue[port] = 1; // turns on the digital output port

Relays Relays are easy to control. There are 4 states possible for each relay: –frcRelay[port] = condition; –[port] – relay1, relay2, relay3 … relay8 –conditions: relayFwd – Sets the relay to forward relayRvs – Sets the relay to reverse relayOff – Sets the relay to a off (float) state relayBrake – Sets the relay to a braking (short) state

Final Notes Make sure to check back with for updates and support. Join the robotc.net forums at – useful community website for getting all other FIRST related questions answeredwww.chiefdelphi.com Any questions: Post to forums, or me at