Team 5220 Roboknights. Outline  Getting Started  Hardware Setup/Wiring  Software Setup/Pragmas  Programming with RobotC  Grammar/Syntax  Basic Statements.

Slides:



Advertisements
Similar presentations
Introduction to Programming
Advertisements

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.
Variables and Functions ROBOTC Software. Variables A variable is a space in your robots memory where data can be stored, including whole numbers, decimal.
08/2012Tanya Mishra1 EASYC for VEX Cortex Llano Estacado RoboRaiders FRC Team 1817.
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.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 4 – Introducing Algorithms, Pseudocode and.
Structure of a C program
COMP 14 Introduction to Programming Miguel A. Otaduy May 18, 2004.
Guide To UNIX Using Linux Third Edition
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Adrian Ilie COMP 14 Introduction to Programming Adrian Ilie June 30, 2005.
Programming Part 1 Armond R. Smith Zhenying Wu. Overview of this Class ● Transition from FTC -> FRC ● Using Your Resources ● Java Keywords o Data Types.
RobotC For Beginners Tyler Lutz and Keaton Bonds DRSS Enterprise.
How to turn on the robot How to start Bluetooth How to connect to robot How to initialize the robot How to not break the robot Sec Getting Started.
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.
Coding for the FIRST Tech Challenge: RobotC Presented by: Audrey Yeoh Acknowledgements: Team Unlimited FTC 0001.
Coding for the FIRST Tech Challenge: RobotC
PYTHON: PART 2 Catherine and Annie. VARIABLES  That last program was a little simple. You probably want something a little more challenging.  Let’s.
Program A computer program (also software, or just a program) is a sequence of instructions written in a sequence to perform a specified task with a computer.
Programming With C.
CSE 1301 Lecture 2 Data Types Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
Variables and Functions. Open your Encoder program Let’s begin by opening the “Labyrinth Auto Straight” code. Save this file as Labyrinth with variables.
CPS120: Introduction to Computer Science Decision Making in Programs.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 2: Variables & Data Types.
CMP-MX21: Lecture 4 Selections Steve Hordley. Overview 1. The if-else selection in JAVA 2. More useful JAVA operators 4. Other selection constructs in.
COMPUTER PROGRAMMING II SUMMER 2011 Visual Basic to C#
Programming 101 EPGY Middle School Programming Adam Leeper.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
AP Computer Science edition Review 1 ArrayListsWhile loopsString MethodsMethodsErrors
ICT Introduction to Programming Chapter 4 – Control Structures I.
Variables and Functions ROBOTC Software © 2012 Project Lead The Way, Inc.Principles of Engineering.
General Computer Science for Engineers CISC 106 Lecture 12 James Atlas Computer and Information Sciences 08/03/2009.
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.
Variables and Functions ROBOTC Software. Variables A variable is a space in your robots memory where data can be stored, including whole numbers, decimal.
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 3.
Chad’s C++ Tutorial Demo Outline. 1. What is C++? C++ is an object-oriented programming (OOP) language that is viewed by many as the best language for.
Introduction to Algorithmic Processes CMPSC 201C Fall 2000.
Alice and Java Unit 7 1. Day 1  Objective: Gain an introduction to Java and Eclipse  Essential skill: DM-1: Use technology to advance critical thinking.
Programming Basics - RobotC Introduction to Robotics.
Presentation By :- Nikhil R. Anande ( ) Electronic & Communication Engineering. 3 nd Year / 5 th Semester FACULTY GUIDE : RAHIUL PATEL SIR MICROCONTROLLER.
Introduction to Programming the Arduino Dr Gaw 3/21/14.
Variables. A variable is a space in your robot’s memory where you can store data, such as whole numbers, decimal numbers, and words. Variable names follow.
Variables and Functions
INTRODUCTION TO ROBOTICS Part 5: Programming
Discussion 4 eecs 183 Hannah Westra.
Chapter 1.2 Introduction to C++ Programming
Chapter 1.2 Introduction to C++ Programming
Chapter 1.2 Introduction to C++ Programming
Chapter 1.2 Introduction to C++ Programming
Variables and Functions
Variables and Functions
Variables and Functions
Movement using Shaft Encoders
Using Encoders to go Straight
Variables and Functions
Variables and Functions
Variables and Functions
Variables and Functions
Using variables, for..loop and functions to help organize your code
Variables and Functions
Variables Numbers can be stored and retrieved while a program is running if they are given a home. The way that integers and decimal numbers are stored.
Programming Basics - RobotC
While Loops and If-Else Structures
While Loops and If-Else Structures
While Loops and If-Else Structures
Robotics Programming Using Shaft Encoders
Basic Programming Concepts
C Language B. DHIVYA 17PCA140 II MCA.
Presentation transcript:

Team 5220 Roboknights

Outline  Getting Started  Hardware Setup/Wiring  Software Setup/Pragmas  Programming with RobotC  Grammar/Syntax  Basic Statements  Programming constructs, logic, etc.  Style, organization  Top 5 problems Team 5220 Roboknights

Wiring  Basic Setup: Team 5220 Roboknights

Software Setup  Pragmas – EXTREMELY IMPORTANT!  Connecting the robot by Bluetooth  Turn on Bluetooth on computer and robot  Add robot under “Bluetooth devices” on computer  Go to “Communication Link Setup” in RobotC  Select Robot and connect Team 5220 Roboknights

RobotC Syntax (“Grammar”)  The statement:  Each statement tells the program to do something, e.g. move a motor.  Statements can have parameters  Statements are separated by semicolons.  Lot of statements are pre-defined for you: if you think there should be a statement to do something, there probably is. Use google.  Blocks, compound statements, curly brackets {} Team 5220 Roboknights

RobotC Syntax Continued  Tasks  task main: This is what actually runs  Creating new tasks  Using your tasks: StartTask and StopTask  Multithreading  Functions  Similar syntax to tasks – Notable differences:  Wait for completion  Parameters  Returning a value Team 5220 Roboknights

Variables  Variables are what we use to store data throughout the program.  Declaration, e.g. int x;  Assignment operator, =  +=, ++, --  Using variables  Most common variable types:  Int: integer  Double: decimal number  String: string of characters, text segment  Bool: boolean, true or false  Global vs. Local Team 5220 Roboknights

RobotC Basic Statements:  motor [motorName] = int power  Sets a motor to a certain power, from – 100 to 100.  servo [servoName] = int position  For a 180 degree servo, sets the servo position to the specified position, from 0 to 255.  For a CR servo, if position 127, moves forwards, if position == 127, stops. Team 5220 Roboknights

RobotC Basic Statements Continued:  SensorValue [sensorName]  Reads the value of the specified sensor  nMotorEncoder [motorName]  Reads the value of the specified motor encoder  wait1Msec (int time)  Stops the program at this statement for the specified amount of time in milliseconds. Team 5220 Roboknights

RobotC Basic Statements Continued:  nxtDisplayTextLine (int lineNumber, string text) And remember…  #define name value  Assigns the value to the name for the rest of the gram, e.g. #define Number 72 means that “Number” can be used anywhere that 72 would.  #include filename.extension  Adds the specified file as a header. Team 5220 Roboknights

Flow Control  Boolean testing, true or false  if, else if, and else system  switch, case, and default system  Loops  while {} statement  for () statement  Break, continue, and return: Escaping from the flow Team 5220 Roboknights

Compiling and Errors  Compiling: turns RobotC code into machine code.  Errors: The bane of all programming:  Compiler  The compiler helps point out errors, yet it can be misleading. Forgetting one bracket might lead to a boatload of errors in other places!  Logical  Not noticed by compiler, kind of like speaking correct grammar, but conveying the wrong meaning, e.g. variable x is 1 when it should be 2. Team 5220 Roboknights

Style and Organization  Standard Casing: Capital word-breaks for tasks, camel case for functions and variables  Name your variables sensibly!  Make code re-usable, e.g. code to move motors a certain distance belongs in a function  Add spacing, line breaks and indentation so you can read the code.  Store values used in multiple places in variables/constants that can easily be changed.  Comments: // and /* Team 5220 Roboknights

Typical Autonomous Program Format: Team 5220 Roboknights

Typical TeleOp Program Format: Team 5220 Roboknights

Top 5 annoying problems 1. Pragma Errors – especially when using encoders. 2. Locating logical errors – especially when logic in program is complex 3. Inconsistency of motor distances: Solve with encoders and sensors 4. Motors burning out: If nothing is moving, don’t try to move the motor more! 5. Messy / Hard to change code: Think of organization from the beginning. Team 5220 Roboknights

Contact Info Website (with slides and example code): com Team 5220 Roboknights

Thanks For Watching!  Any Questions? Team 5220 Roboknights