Introduction to Programing the Cortex for BEST

Slides:



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

US First Robotics Lab View Tutorials Jim Thomas Lawrence Berkeley National Laboratory Team 496 Port Jeff Powerhouse.
Vex Robotics Program five: using the radio control transmitter.
BEST Robotic, Inc. easyC Team Training
Teacher/Mentor Institute Using the Cortex Carolyn Bauer July 21-22, 2014.
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.
1. 2 FRC 2010 Driver Station Doug Norman & Stephanie Brierty National Instruments January 8, 2010 Thanks to Joe Ross – Team 330.
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.
Teacher/Mentor Institute Hands-On Session: Building a Robot Scott McEwen & Kevin Barrett July 21-22, 2014.
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.
Vex 1.0 © 2005 Carnegie Mellon Robotics Academy Inc. Programming in easyC.
Copyright © 2012 BEST Robotics, Inc. All rights reserved.
Testbed: Exercises.
Drivers Station 2010 Joe Ross Team /12/2009.
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.
Driver Station MVRT 2009 – 2010 Season. Add information Breadboard Classmate PC USB Hub Joysticks Stop Button.
Coding for the FIRST Tech Challenge: RobotC
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.
Teacher/Mentor Institute Hands-On Session: Building a Robot Scott McEwen Chuck Powell.
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.
Teacher/Mentor Institute Hands-On Session: Building a Robot Carolyn Bauer July 30-31, 2015.
EasyC Programming Workshop January 30, 2008 Hauppauge High School SPBLI - FIRST Mark McLeod Advisor Hauppauge Team 358 Northrop Grumman Corp.
Vex Robotics Programming Sequence. Now that you’ve had some practice downloading and using the included programs, it's time to learn to write some of.
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.
Vex Robotics Program six: combining autonomous and radio control.
Introduction to Vexnet
Created by Blake Ross Start EasyC. Created by Blake Ross.
Teacher/Mentor Institute Using easyC David Dominguez June 2, 2015 Update Version.
Copyright © 2010 BEST Robotics, Inc. All rights reserved.
Vex Robotics Program Two: Using two motors. Program two: using the motors In the last section, you learned how to turn on one motor. Now, you will take.
Vex Robotics program three: using motors and sensors together.
Mechanical Components and Programming Ken Youssefi Introduction to Engineering – E10 1.
Project Overview  Introduction  Clawbot Build  Design Modification  Design Development  Programming  Sensors  Advanced Sensors  Open design challenges.
Teacher/Mentor Institute Intro to easyC Programming Scott McEwen July 21-22, 2016.
ROBOTC for CORTEX Teacher Training © 2011 Project Lead The Way, Inc. Automation and Robotics VEX.
Teacher/Mentor Institute Hands-On Session: Building a Robot Carolyn Bauer July 21-22, 2016.
After Construction Name: Per #:.
Project Overview Introduction Clawbot Build Design Modification
Introduction to Vexnet
BEST Robotic, Inc. MATLAB/Simulink Team Training
Introduction to Programming in RobotC
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Vex Cortex Controller System and Programming
ClawBot Beginning Programing.
VAB™ for INFINITY Tutorial
Using the VEX Cortex Processor
Using the VEX Cortex Processor
Hands-On Session: Mini-Competition
Introduction to Programming
ROBOTC for VEX Online Professional Development
Programming Scratch to Control a K’NEX Fairground Ride
FlowArm PLTW Programming
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Basics for Robotics Programming
Automation and Robotics
Programming Autonomy By Joshua Shaw.
UNITY TEAM PROJECT TOPICS: [1]. Unity Collaborate
VEXnet User's Guide.
Automation with RobotC
Automation with RobotC
Chapter 1 Introducing Small Basic
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
LEGO MINDSTORMS NXT PROGRAMMING
Presentation transcript:

Introduction to Programing the Cortex for BEST SA BEST Kickoff - 2019

Presentation Goals Primary Goals – understand how to: Secondary Goals Get and install software. Connect the Cortex for programming. Compile, link, and download the default program to the Cortex. Secondary Goals Components of the default program. Physical connections to Cortex. Joystick interface.

BEST Software Options RobotC for Cortex from VEX Robotics “Standard” C programming by writing text. Used in a number of competitions/products, so teams may have familiarity with this. Simulink from MathWorks Visual block programming. BEST specific online training available. EasyC from Intelitek Menu driven C programming Visual blocks with code – drag, drop, and configure. All options provide simple interfaces to motors, servos, switches, etc that are included in the BEST return kit.

easyC Software Installation Either download from link provided in “Software Access Instructions” or use the file provided on the USB drive to install the software. (Administrative access is needed). A license key is provided on the USB drive that will need to be used to activate the software when it is first started. The computer must have internet access to validate the license key. The licenses key can be copied to the clipboard from the text file on the USB drive, and then pasted into the activation form using the paste button on the form.

Connect the Cortex to the Computer The simplest way to connect the Cortex to the PC is directly with an A-A USB cable. The USB port powers the Cortex, so no battery is needed. Motors and servos cannot be used when connected this way. Refer to the return Kit information for other ways to connect. When connected properly: Robot light: Red/flashing Vexnet light: Green

Programming Vocabulary Compile – changes your C program into object code that the linker understands. Link – combines your program’s object code with library functions to create code that is executable on the Cortex processor. Download – transfers the machine code version of your program from the PC to the Cortex where it will execute (the IFI/Intelitek Loader will perform the transfer via the PC USB cable).

Programming Flow or 1. Write It. 2. Save It. 3. Compile & Link. (aka Build) 4. Download It. 5. Test It. Block-based Drag & Drop (Menu Cfg) Project Files Integrated Design Environment (IDE) Target (Cortex) or easyC V6 for Cortex User Created C Program easyC Project From Scratch Libraries (C Functions)

easyC Start Page EasyC supports other controllers so make sure it’s set to the Cortex To set the controller: Select: Tools-> controller

Open BEST Default Project

Build and Download

Compile and Link If build is successful, the option to download is provided. Shows status while compiling and linking. Errors will show up here.

Download the File to the Cortex Tip: It’s very common for teams to forget to download the code to the Cortex once they get code to compile without any errors.

VEX Cortex Connections Gnd (Blk) +5v (Red) Sig (Wht) USB 1 Analog in 8 1 1 2 Do not use Digital in/out 3-wire PWM servo/motor ctrl 12 9 10 Speaker Out SP Do not use Sig (Wht) +5v (Red) Gnd (Blk) Config Button Battery On/Off Switch

Joystick Controls and Values Channels numbers are labeled on joystick. Joysticks (1-4) return values between -127 and +127 in proportion to the stick position. Buttons (5-8) U/D/L/R return 1 when pressed and 0 when not pressed. Two channels of accelerometers provide values between -127 and +127 in proportion to the angle(s) at which the joystick is being held (tilted forward/back or left/right). 7 8 3-4 1-2 6 5

BEST Default Program Function Right Joystick Connected by program Cortex Channel Physical Connection 1 2 Motor 2 Motor 9 Right Drive Motor Left Drive Motor Left Joystick 3 Motor 5 “Claw” Servo 4 Motor 6 “Arm” Motor

BEST Default Code Outside the body of the program Declares global variables Defines names for constants to help make code easier to read.

Config block detail

Globals Block Detail

BEST Default Code “main” is the name of the function that is executed when the program is compiled. The main function includes everything between the matched curly braces {} The END label and indenting makes it easy to see the extent.

BEST Default Code Sets up region around center position of joysticks where there is no output. Eliminates the problem of having motors move when you really don’t want them to. Statements prior to the while loop are executed once.

Joystick Analog Deadband Configuration Screen Joystick positions of ±4 are output as zero.

BEST Default Code while (1) creates a loop where everything between the {} is repeated as “forever.” There should be no statements inside the while loop that require an external action before the next statement is executed. (More about this later.)

BEST Default Code The text in green are comments to help document the program. The “arcade2” function maps the right joystick channels to the driver motors.

Arcade -2 motor Configuration Screen

BEST Default Code “JoystickToServo” and “JoysticktoMotor” do essentially the same thing in mapping a joystick movement to a motor/servo output channel. The first statement includes an “invert” function that reverses the direction of the mapping.

Joystick to Servo Configuration Screen

Programming (step-by-step) Create a new project. Select “New Standalone Project” from the File menu Select “Joystick Project (wifi)” from the popup window Create your program; save your program. Drag & drop programming blocks to create your program Build (i.e.,compile and link) the code. Use the “Build and Download” option from the Build and Download Menu Errors will be reported in the “Outputs & Tasks” window Download the program to the Cortex Automatic if using the “Build and Download” option IFI/Intelitek Loader window will popup showing progress

Drag and Drop Blocks Configure block parameters by double clicking on icon. Drag blocks from here into program.

Example of bad while function use This section of code will prevent the statements below from being executed until the button is pressed. This means that the joystick values are not being read, and the other motors are not being controlled. Don’t make this mistake!

Do this instead … This just reads the button and then performs a function based on the state of the button. Without the “else” statement, the motor would turn on the first time the button is pressed and would never turn off.

Some other tips Use the BEST default program/project as a starting place for your robot program. Use the “Save As” function to save a copy of the project at different stages of development. This will make it easy to take a step backwards if you create a problem in the code. Make sure you name the different versions in a way to keep them straight (version numbers are good). Make sure to use the right version on game day!

… yeah, but that’s not enough. There are tutorials and examples built into easyC. . Forums on bestrobotics.org and vexforum.com and other forums. Be aware that non-BEST-specific forums may discuss capabilities that we don’t have. Try things: you can always go back to the default code or some other simplified version of the code if things stop working.