Programming Design ROBOTC Software Principles of Engineering

Slides:



Advertisements
Similar presentations
Engineering Roles We will be forming groups of 3 students
Advertisements

Automation and Robotics
VEX and Robot C Chris Patterson Presented by Modified by J. Andazola.
Developed in collaboration with Introduction to Programming.
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.
Connecting VEX and ROBOTC
Vex 1.0 © 2005 Carnegie Mellon Robotics Academy Inc. Programming in easyC.
Testbed: Exercises.
VEX Robotics Platform and ROBOTC Software
ROBOTC Software Introduction. ROBOTC Software ROBOTC developed specifically for classrooms and competitions Complete programming solution for VEX Cortex.
Introduction to the VEX ® Robotics Platform and ROBOTC Software © 2012 Project Lead The Way, Inc.Principles of Engineering.
Programming Design ROBOTC Software Principles of Engineering
Robot C and Natural Language
AUTOMATION WITH ROBOTC Starting to write and troubleshoot computer code.
Getting Started in RobotC // Comment task main() motor[] {} wait1Msec() ; = Header Code Compile Download Run Take out your notes.
ROBOTC for CORTEX.
The George Washington University Department of ECE ECE Intro: Electrical & Computer Engineering Dr. S. Ahmadi Class 4/Lab3.
Automated Mechanisms Help. Potentiometers Potentiometer Check –Analog Port 2 How they work –Analog sensor –Measures rotation of a shaft between 0 and.
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.
VEX and Robot C Chris Patterson Frisco ISD CTE Center Presented by.
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.
Automation and Robotics.  First you select the platform type so that you can use Natural Language PLTW.
ROBOTC for CORTEX Teacher Training. ROBOTC Overview Thinking about Programming.
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.
Robot C and Natural Language. Create a folder Create a folder on your desktop to insert all your Robot C files, Here you will begin with your template.
ROBOTC for CORTEX Teacher Training © 2011 Project Lead The Way, Inc.Automation and Robotics VEX.
Connect VEX and ROBOTC Electrical Engineer Responsibilities © 2011 Project Lead The Way, Inc.Automation and Robotics VEX.
ROBOTC for VEX Online Professional Development. Homework Questions Thoughts? Questions?
ROBOTC for VEX Online Professional Development By Jesse Flot.
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.
Basic Programming: Until Commands. The Problem with Wait States Motor Speed is affected by battery power. –If the battery is fully charged, the motors.
ROBOTC for CORTEX Teacher Training © 2011 Project Lead The Way, Inc. Automation and Robotics VEX.
Programming Design ROBOTC Software Principles Of Engineering
Electrical Engineer Responsibilities
VEX® Robotics Platform and ROBOTC Software
VEX® Robotics Platform and ROBOTC Software
ROBOTC for VEX Online Professional Development
Introduction to Programming
Electrical Engineer Responsibilities
VEX Robotics Platform and ROBOTC Software
ROBOTC for VEX On-Site Professional Development
ROBOTC for VEX Online Professional Development
Electrical Engineer Responsibilities
Automation and Robotics
Programming Design ROBOTC Software Computer Integrated Manufacturing
Electrical Engineer Responsibilities
Automation and Robotics
TECH 1 BAMS Technology Education
While Loops and If-Else Structures
VEX® Robotics Platform and ROBOTC Software
Getting Started in RobotC
VEX® Robotics Platform and ROBOTC Software
While Loops and If-Else Structures
Multitasking Emergency Stop Computer Integrated Manufacturing
Programming Design ROBOTC Software Principles Of Engineering
While Loops and If-Else Structures
While Loops and If-Else Structures
VEX® Robotics Platform and ROBOTC Software
While Loops and If-Else Structures
if-else Structures Principles of Engineering
Automation with RobotC
VEX® Robotics Platform and ROBOTC Software
Robotics Programming Using Shaft Encoders
While Loops and If-Else Structures
Automation with RobotC
Robotics Programming Using Shaft Encoders
While Loops and If-Else Structures
While Loops And If-Else Structures
Presentation transcript:

Programming Design ROBOTC Software Principles of Engineering © 2012 Project Lead The Way, Inc.

Behavior-Based Programming Presentation Name Course Name Unit # – Lesson #.# – Lesson Name Behavior-Based Programming A behavior is anything your robot does Example: Turn on a single motor or servo Three main types of behavior Complex behavior: Robot performs a complex task Example: automate fan control Simple behavior: Robot performs a simple task Example: fan stops when sensor is activated Basic behavior: Single command to a robot Example: start a motor Complex behaviors are broken down into simple behaviors, which are broken down into basic behaviors

Complex Behaviors Describe a task or overall goal that a program will accomplish A fan runs until someone needs it to stop. A safety device warning light turns on before a fan turns on. Another light indicates that a fan has stopped. This can be described as one or more complex behaviors

Creating Pseudocode Break down behaviors into individual actions Do not be concerned about syntax or which commands will be used with ROBOTC Simply describe them in short phrases Example Turn a motor on for three seconds Follow a line until it runs into a wall

Simple Behaviors Break each complex behavior down into simple behaviors List simple behaviors line by line in the correct sequence Describe actions and the prompt for each action to start

Creating Pseudocode Example Warning light turns on before the fan starts for three seconds Fan turns on and runs until a button is pressed A different light turns on for three seconds before the program stops

Basic Behaviors Break each simple behavior down further into basic behaviors Write in terms of the input and output relative to the device

Creating Pseudocode Example Program starts Light 1 (LED 1) turns on for three seconds Fan (Motor 1) turns on until a button (bumper switch) is pressed Light 2 (LED 2) turns on for 3 seconds Program ends

Identify Inputs and Outputs Identify the ports by which each input and output will be connected to the Cortex Be conscious which sensors are analog and which are digital Label a planning diagram

PLTW ROBOTC Program Template Presentation Name Course Name Unit # – Lesson #.# – Lesson Name PLTW ROBOTC Program Template Open Sample Program PLTWtemplate Enter an initial task description of the overall program goal in terms of complex behaviors Enter pseudocode in terms of basic behaviors in the pseudocode section of the PLTW ROBOTC program template Select File, Open Sample Program. Navigate to the PLTW folder. Select the PLTWtemplate file, then select Open.

PLTW ROBOTC Program Template

Program Design Enter label for inputs and outputs in the Motors and Sensors Setup window and change drop down to identify Use the Program Debugger to confirm that all inputs and outputs are working as expected

Motor 2 for 5 Seconds Presentation Name Course Name Unit # – Lesson #.# – Lesson Name Motor 2 for 5 Seconds This example is best demonstrated using the test bed.

Motor 2 for 5 Seconds All commands belonging to task main must be in between these curly braces.

Motor 2 for 5 Seconds

Motor 2 for 5 Seconds

Motor 2 for 5 Seconds End Result: rightMotor spins for 5.0 seconds Stops the port2 rightMotor. End Result: rightMotor spins for 5.0 seconds

Program Design Generally basic behaviors combine to create a complex behavior Troubleshoot basic behaviors individually as method of troubleshooting a complex behavior

Program Design Create code and test small behaviors or sets of behaviors individually Edit or add comments as you build code

Program Design Continue programming while testing individual behaviors Temporarily turn sections of code into comments using /* followed by */

Program Design Sections of code can also be temporarily turned into comments using Toggle Comment under the Edit and Code Formatting menus

Sample Programs

ROBOTC Natural Language Language developed especially for PLTW Lines of code for common robot behaviors are consolidated into single commands forward(); lineTrackforTime(); stop(); untilBump();

ROBOTC Natural Language Natural Language is a ROBOTC Platform Type

Presentation Name Course Name Unit # – Lesson #.# – Lesson Name ROBOT Motion Commands that cause the entire robot to perform a behavior

Movement Commands that allow control of individual motors or servos Presentation Name Course Name Unit # – Lesson #.# – Lesson Name Movement Commands that allow control of individual motors or servos

Motor Reversal Reversing motor polarity Check Reverse in Motors and Setup Change speed + / - in program startMotor(rightMotor, 63); startMotor(rightMotor, -63);

Presentation Name Course Name Unit # – Lesson #.# – Lesson Name Special Commands that control unique VEX® Hardware: LEDs and Flashlights

Presentation Name Course Name Unit # – Lesson #.# – Lesson Name Until Commands that allow behaviors to be created for the robot to perform until an event occurs such as: Button Press Encoder Count Reached

Presentation Name Course Name Unit # – Lesson #.# – Lesson Name Wait Commands that wait for an amount of time measured in seconds or milliseconds

Wait States Accuracy Motor Speed is affected by battery power Motors rotate faster when using a fully charged battery Motors rotate slower when using a partially depleted battery Device or robot does not move consistently as the battery power drains

Touch Sensors Digital sensor Caution Pressed = 1 and Released = 0 When sensor is pressed or released, its value may rapidly bounce between 0 and 1 briefly A brief wait command can reduce the bounce effect

References Carnegie Mellon Robotics Academy. (2011). ROBOTC. Retrieved from http://www.robotc.net