Session 12 Sensors and Timers. 3 Main Types of Robot Projects Command-Based Robot A more complicated project for more complicated robots Iterative Robot.

Slides:



Advertisements
Similar presentations
Introduction to Programming
Advertisements

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
Vex Robotics Introduction to Sensors. introduction to sensors Sensors assist robots in seeing and feeling the physical world through which they travel.
JavaWorkshop Part 3. Instead of going over previous years’ code. We will rewrite 2014’s code using the SimpleRobot Template But first let’s get thru OOP.
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.
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)
FRC LabVIEW Software Overview Joe Hershberger Staff Software Engineer National Instruments.
IR SENSORS AND ENCODERS. LCDs Timothy Friez Class # 2.
ROBOTC for VEX Online Professional Development
VEX Robotics Platform and ROBOTC Software
Java for Robots How to program an NXT robot with a Java Brain Bert G. Wachsmuth Seton Hall University.
LEGO NXT Robot Programming Introduction to Programming a Lego NXT robot in Java.
Program ultrasonic range sensor in autonomous mode
RC CAR CONTROLLER BASED ON INTEL GALILEO SOC PLATFORM Nadav Shiloach Sagi Sabag Supervisor: Idan Shmuel Spring 2014 One Semester Project PROJECT’S ENDING.
DISCLAIMER!!!! I AM A N00B! Please do note that everything that I have worked on is subject to questioning.. in fact.. I suggest it. This entire project.
ROBOTC for VEX On-Site Professional Development
Coding for the FIRST Tech Challenge: RobotC
FRC Robot Framework Labview Made Easy (er) For FIRST Robotics 1.
RobotC Advanced Concepts SSI Robotics September 7, 2013 Capitol College.
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.
An Objective and Component View (Not included Drive: Balance and Turret: Axis Camera)
Robot sensors MVRT 2010 – 2011 season. Analog versus Digital Analog Goes from 0 to 254 Numerous values Similar to making waves because there are not sudden.
FRC Robot Programming 1.PID Continued 2.Downloading and Deploying Code 3.Program a 2012 Robot from Spec Basic code For FIRST Robotics.
AUTOMATION WITH ROBOTC Starting to write and troubleshoot computer code.
2008 SBPLI/FIRST Programming Workshop Tom Boehm Patchogue Medford High School, Team 329 Motorola Inc. Mark McLeod Hauppauge High School Team 358 Northrop.
Code The Arduino Environment.
Introduction to Vexnet
Session 11 Intro to FRC API.
Automated Mechanisms Help. Potentiometers Potentiometer Check –Analog Port 2 How they work –Analog sensor –Measures rotation of a shaft between 0 and.
Programming with LabVIEW Intro to programming and.
Available at: – Program Functions to Accept Values Program Functions to Accept Values.
Week 12 - Monday.  What did we talk about last time?  Defining classes  Class practice  Lab 11.
INTERNET OF EVERYTHING SDU 2016 Week 4. Simple Digital and Analog Inputs  The Arduino’s ability to sense digital and analog inputs allows it to respond.
Structured Programming Dr. Atif Alhejali Lecture 4 Modifiers Parameters passing 1Structured Programming.
Creating Flexible, Script-Controlled Autonomous Software Example Explanation.
ROBOTC for VEX Online Professional Development. Homework Questions Thoughts? Questions?
Robotics Programming Wall Follow Line tracking for a set amount of time Line tracking for a distance.
Programming Applied Sensors in FIRST Robots Chris Elston – Team Download sample code:
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.
ROBOTC for CORTEX Teacher Training © 2011 Project Lead The Way, Inc. Automation and Robotics VEX.
Harpeth Hall Jan 2016 Introduction to Arduino Prepared for Harpeth Hall Winterim January 2016.
Introduction to Vexnet
Introduction to Programming in RobotC
INTRODUCTION TO ROBOTICS Part 5: Programming
OpModes in FTC Eric Golde.
Assist. Prof. Rassim Suliyev - SDU 2017
VEX IQ Curriculum Smart Machines Lesson 09 Lesson Materials:
Lecture 10 Sensors.
ROBOTC for VEX Online Professional Development
ROBOTC for VEX Online Professional Development
ROBOTC for VEX On-Site Professional Development
ROBOTC for VEX Online Professional Development
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Movement using Shaft Encoders
Using Encoders to go Straight
Introduction to Team 294 Programming Concepts
1 Code
Training 11/11/16 Robot Code (WPILib).
Auto Straightening using VEX Shaft Encoders
Acronyms Galore: Wired for Success
Lego EV3 Mindstorms SW Programming Blocks.
In the land of the blind, the one eyed man is king
Robotics Programming Using Shaft Encoders
frclabviewtutorials.com/workshop
Compiled from various Internet sources Presented by Mr. Hatfield
Introduction to Arduinos
Lego MINDSTORMS EV3.
Presentation transcript:

Session 12 Sensors and Timers

3 Main Types of Robot Projects Command-Based Robot A more complicated project for more complicated robots Iterative Robot Much more simple, but functionality is more limited Sample Robot Just the raw basics. Used for testing small things, or for highly advanced control flow.

Robot Run Modes TeleOperated – a human controls the robot Autonomous – the robot does stuff itself Practice – a simulation of a real match Test – anything you want it to be

Basic Code Declare variables Initialize variables Manually set motor controllers Drive robot with Joystick

Terminology: Variable Declaration Class Name / Variable Type Variable Name Access Modifier

Terminology: Variable Initialization Makes a new object of that class Constructor for Talon class Arguments / Parameters Constructor for this class

Terminology: Variable Use Arguments / Parameters Variable that stores an object of the Talon class Calls set method of that object

Side note: Java’s Math class Java has a built in class called “Math” Contains static methods and constants that do math things Trig, logs, exponentiation, rounding, PI, etc. Math.abs(a) – returns the absolute value of “a” (takes int, double, float) Math.signum(a) – returns 1 if it’s positive, -1 if it’s negative, 0 if it’s 0

Joystick Class double getX() double getY() returns X/Y axis value double getRawAxis(int axis) returns the value of an axis boolean getRawButton(int button) returns whether or not a button is pressed

Timer Class void start() starts the timer object void stop() stops the timer object void reset() sets timer object to 0 void get() gets the current time (seconds) boolean hasPeriodPassed(double period) returns if that amount of time has passed (seconds) If it has, subtract the current timer’s value by that amount (avoids drift) static double getFPGATimestamp() returns the system clock time in seconds

Importing the Timer Class There are lots of “Timer” classes in Java Make sure you import the right one Eclipse might automatically import a wrong class Delete it and type it out import edu.wpi.first.wpilibj.Timer;

Using the Timer Class Declare/Initialize variables reset and start the timer autonomousInit() is called once as soon as autonomous is enabled Run a motor at 20% speed if less than 2 seconds have passed else, stop the motor motors will continue to run at the previous set speed forever

Sensors Sensors give the program information on the real world Used to automate processes and require less work of drivers Transmits information back via an electrical signal

Analog vs Digital Signals Analog Indiscrete Can take on countless values Rational number (double) AnalogInput class Digital Quantized Only takes on discrete values In most of our cases, 2 Boolean DigitalInput class

Limit Switch Digital Signal Either pressed, or not pressed constructor = DIO port on roboRIO

Analog Ultrasonic Rangefinder Uses sound to measure distance Value returned is not to any particular scale It is directly proportional to the distance, however

Accelerometer Measures lateral forces The roboRIO has a built in accelerometer BuiltInAccelerometer class Could be used to help prevent a robot from tipping over Can integrate to get rough velocity & position of robot

Gyro Measures rotational forces Can integrate to get angular velocity and position built into special Gyro class

IMU Inertial Measurement Unit (AKA a fancy gyro with accelerometers) We have the navX-MXP board (AKA “the goods”) Has its own API A very specific setup to use it I’ll cover this later when needed

Potentiometer Sends out an analog signal depending on how much it’s turned Usually linear, sometimes logarithmic scaling Usually only measures up to 1 rotation

Quadrature Encoders Measures angular position of a shaft or axle Counts number of rises/falls in a digital signal and adds them up We’ll be using these indirectly with CAN Talon SRXs (Friday)

Extra: Smart Dashboard An application that displays values sent from the robot Useful for debugging and finding out what things are

Coming Up This Friday (11/20) CAN, Talon SRXs, and PID controllers Next Week (11/25, 11/27) Nothing: Thanksgiving Break The Week After That (12/2, 12/4) Command-Based Robot