RobotC Sensors.

Slides:



Advertisements
Similar presentations
Robofest 2005 Introduction to Programming RIS 2.0 RCX Code.
Advertisements

Engineering Roles We will be forming groups of 3 students
VEX and Robot C Chris Patterson Presented by Modified by J. Andazola.
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.
Connecting VEX and ROBOTC
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.
ROBOTC for VEX On-Site Professional Development
Programming Design ROBOTC Software Principles of Engineering
AUTOMATION WITH ROBOTC Starting to write and troubleshoot computer code.
Photos and Sensor Instructions
Getting Started in RobotC // Comment task main() motor[] {} wait1Msec() ; = Header Code Compile Download Run Take out your notes.
By Droids Robotics INTERMEDIATE PROGRAMMING LESSON BRICK BUTTONS AS SENSORS.
Automated Mechanisms Help. Potentiometers Potentiometer Check –Analog Port 2 How they work –Analog sensor –Measures rotation of a shaft between 0 and.
RobotC Remote Control. Learning Objectives: Focusing on Virtual World with Physical Examples Understand Real-Time Joystick Mapping Understand how to use.
Programming your Robot
VEX and Robot C Chris Patterson Frisco ISD CTE Center Presented by.
Vex Robotics program three: using motors and sensors together.
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 VEX Online Professional Development. Homework Questions Thoughts? Questions?
Programming Design ROBOTC Software. Behavior-Based Programming A behavior is anything your robot does –Turning on a single motor or servo Three main types.
Robotics Programming Wall Follow Line tracking for a set amount of time Line tracking for a distance.
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
Know your Robot Electrical Parts
VEX IQ Curriculum Smart Machines Lesson 09 Lesson Materials:
ROBOTC for VEX Online Professional Development
ROBOTC for VEX Online Professional Development
Electrical Engineer Responsibilities
ROBOTC for VEX On-Site Professional Development
By Sanjay and Arvind Seshan
Robotics Programming Using Shaft Encoders
ROBOTC for VEX Online Professional Development
Electrical Engineer Responsibilities
Programming Design ROBOTC Software Computer Integrated Manufacturing
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Electrical Engineer Responsibilities
RobotC Sensors.
Movement using Shaft Encoders
Programming – Touch Sensors
Getting Started in RobotC
Automation and Robotics
BEGINNER EV3 PROGRAMMING Lesson
BEGINNER EV3 PROGRAMMING Lesson
While Loops and If-Else Structures
BEGINNER PROGRAMMING LESSON
Forward Until Touch Robot goes forward until it hits a wall.
Getting Started in RobotC
Line Following Behavior
BEGINNER PROGRAMMING LESSON
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
INTERMEDIATE PROGRAMMING LESSON
While Loops and If-Else Structures
RobotC While loop When and how to use the while loop
Automation with RobotC
Robotics Programming Using Shaft Encoders
Photos and Sensor Instructions
Robotics Programming Using Shaft Encoders
Remote Control For this activity we will use the Squarebot
While Loops and If-Else Structures
Automation with RobotC
Robotics Programming Using Shaft Encoders
While Loops and If-Else Structures
Programming Design ROBOTC Software Principles of Engineering
While Loops And If-Else Structures
LEGO MINDSTORMS NXT PROGRAMMING
Presentation transcript:

RobotC Sensors

Learning Objectives Take a look at some of the options for VEX Sensors Be able to configure sensors Be able to use a touch sensor/limit switch Be able to use the Ultrasonic Sensor to drive forward until you are near an object Be able to use light sensors to track a line

Sensor Ports Analog Ports 1-8 Light Sensor Line Tracking Potentiometer Accelerometer UART (Universal Asynchronous Receiver/Transmitter) Ports 1, 2 I2C Inter-integrated Circuit Protocol Allows several devices to be chained to one port. Digital Ports 1-12 Touch Sensors Limit Switch Bumper Switch Motor Encoder Ultrasonic Range Finder Speaker

Digital: Bumper Switch Senses when it is pushed 0 == not pushed false == not pushed 1 == pushed true == pushed

Sensor Setup 1) VEX Cortex Digital Sensors 1-12 3) Use the pull down menu to select the ‘Touch’ sensor. The ‘Touch’ sensor is used for the Bumper Switch and the Limit Switch. 2) Select the Port and name the sensor. Name: Start with a letter, no spaces, punctuation or reserved words. Describes the sensor 4) Click on ‘Apply’ the ‘OK’

Getting the Reading SensorValue(frontBumper);

Challenge Create a Bug Robot that will run forever, but when it hits something it will back up, turn and then keep on going. Use the Physical Robot or the Virtual Buggy bot on ‘Utility’ Huge Table challenge

PseudoCode Go forward Forever If I hit something Back up Turn Start going forward

Possible Solution Extensions Put multiple touch sensors on the front Add a touch sensor to the back and react when the back runs into something

Using the Limit Switch Can sense when arms reach their limit. Can sense when the robot bumps into something. 0 or false when not pressed 1 or true when pressed

Configuring the Limit Switch 1) Select the Digital Sensors Tab Robot -> Motors and Sensors Setup 3) Use the pull-down menu to select Touch. 2) Name the Sensor frontLimit 4) Apply and OK.

Preventing the Arm From Lowering Too Far Pseudo Code If the down button is pressed AND the limit switch is not pressed Go down AND? Remember the conjunctions?

Conjunctions Conditions can be combined using conjunctions && (AND) while ((SensorValue[rightEncoder]<1800) && (SensorValue[leftEncoder] <1800)) { //while both encoders are less than 1800 it will repeat the code in the {} block } || (OR) while ((SensorValue[rightEncoder]<1800) || (SensorValue[leftEncoder] <1800)) { // While either the leftEncoder<1800 or the rightEncoder is <1800 it will //repeat the code inside the {} block ! (NOT) Turns true to false and false to true while !(SensorValue(leftEncoder)>1800)

Putting it together Pseudo Code Has the robot wait until button 7D is pressed Pseudo Code Uses a timer to limit the driving time If the down button is pressed AND the limit switch is not pressed Go down Reduces the power to the motors to ½ the value from the remote Button 6U is for having the arm go up. If button 6D is pushed and the Limit Switch is not pushed. If no button is pushed OR 6Down is pushed and the limit switch is pushed.

Putting it together Virtual World Pseudo Code If the down button is pressed AND the limit switch is not pressed Go down The && can only combine two complete conditions.

Challenges Minefield Challenge Incorporate Limit Switch Extension Squarebot: Virtual World Your bot : Real World Incorporate Limit Switch Extension Incorporate a Potentiometer to provide more control Information on the Potentiometer on the next slide

Extension: Using the Potentiometer to Limit Go to http://education.rec.ri.cmu.edu/products/cortex_video_trainer/lesson/5-2LimitingtheArm3.html And follow the video trainer lesson