Download presentation
Presentation is loading. Please wait.
Published byAugustine Atkins Modified over 6 years ago
1
ROBOTC for VEX Online Professional Development
2
Homework Questions Thoughts? Questions?
3
Swervebot
4
Cortex Swervebot LCD Display Quadrature Encoders Line Followers
Potentiometer Touch Sensors Ultrasonic Rangefinder Gyroscope
5
VEX LCD Screen
6
VEX LCD Screen 2 x 16 Character Array
Connects to the UART 2 Port on the Cortex Connects to the RX and TX ports on the PIC Display Sensor feedback or messages
7
VEX Remote Screen “Virtualized” VEX LCD in ROBOTC
Replicates on-screen what the VEX LCD displays Great teaching tool
8
VEX LCD Screen Commands (Part 1):
clearLCDLine(nLine); Clears the indicated line of the VEX LCD to blanks. displayLCDCenteredString(nLine, sString); Displays a character string centered on the indicated line of the VEX LCD. displayLCDChar(nLine, nPos, cChar); Displays a specific character on the VEX LCD. displayLCDNumber(nLine, nPos, nValue); Displays a integer number on the VEX LCD. displayLCDString(nLine, nPos, sString); Displays a character string on the VEX LCD.
9
VEX LCD Screen Commands (Part 2):
setLCDPos(nLine, nPos); Sets the next display position on the VEX LCD. displayNextLCDChar(cChar); Displays a specific character on the VEX LCD. displayNextLCDNumber(nValue); Displays a integer number on the VEX LCD. displayNextLCDString(sString); Displays a character string on the VEX LCD.
10
Class Activity: Hello World!
Use the VEX LCD Screen to display “Hello World!” on Line 1
11
Class Activity: Sensor Output
Part 1: Use the VEX LCD Screen to display the Ultrasonic Sensor value on Line 1, and the Potentiometer Value on Line 2. The program should update forever Part 2: Add/display the units for the Ultrasonic Sensor.
12
Additional Resources
13
Sensor Information Line Tracker
14
Line Tracking “Active” Light Sensor Set of 3 Analog Sensors
Sends out a IR beam, and measure how much is reflected back Each reads values between 0 and 4095 Using them The SensorValue[] command untilDark(), untilLight(), lineTrackforDistance(), lineTrackforTime() NL commands
15
Line Tracking Other Properties
The Line Tracker should be kept between ¼ and 1/8 of an inch of what it’s measuring for the best results. Constant, consistent lighting is also very important for achieving repeatable robot behavior. In order to use the Line Tracking sensor(s) you must first calculate a threshold that allows it to distinguish light from dark.
16
Thresholds Overview A Threshold is a value (usually halfway between) two extremes Light and dark (Light sensors) Near and Far (Ultrasonic) Thresholds allow your robot to make decisions via Boolean Comparisons Line Following Kits come with 3 sensors To use all three, you must choose a Threshold that will work with all 3 sensors, or 3 separate Thresholds
17
Threshold Calculation
Calculate an appropriate Threshold with the aid of the Sensor Debug Window In ROBOTC, create a program that configures your Line Following sensor. Trainer Notes: The following slides detail the process for determining a threshold.
18
Threshold Calculation
2. Download the Program to the Robot 3. Open the Sensor Debug Window
19
Threshold Calculation
4. Verify that the Program Debug Window’s Refresh Rate displays “Continuous” and press the Start button. Trainer Notes: Seeing “Continuous” means that the Sensor debug window will not be seeing continuous updates from the sensors.
20
Threshold Calculation
5. Place the line tracking sensor above the light surface. 6. Record the value for the sensor displayed in the Sensors Debug Window. *values displayed will vary from your values
21
Threshold Calculation
7. Place the line tracking sensor above the dark surface. 8. Record the value for the sensor displayed in the Sensors Debug Window. *values displayed will vary from your values
22
Threshold Calculation
9. Add the two values and divide by two. The result is the threshold for that sensor. Light reading + Dark Reading 2 = Threshold 10. Repeat the process for any other sensors 11. Use the threshold(s) in your program
23
Activity: Line Following
File > Open Sample Program > Line Follower > Triple Sensor Line Tracking.c Adjust the Motors and Sensors Setup for your robot configuration Adjust the threshold value for your threshold Try following different lines Tweak motor values to suit needs
24
Line Following
25
Natural Language – Until
Commands that allow you to create behaviors where the robot acts “until” a certain event untilDark() untilLight() These commands work with both the line tracking sensors and ambient light sensors
26
Forward until Dark / Light
Forward until Light
27
Natural Language - ROBOT Motion
Commands that cause the entire robot to perform a behavior lineTrackForRotations() lineTrackForTime()
28
Line Tracking for Rots. / Time
Line Track for Rotations Line Track for Time
29
Better Line Following What do you do when you don’t want to line track forever, or when the line tracking course is non-uniform?
30
Activity: Better Line Following
Part 1: Line Track for Distance Instead of line tracking forever, use the encoders to control how long Part 2: Optimized Line Tracking Not all lines are the same! Break a complicated course down into multiple pieces, based on how the lines are curved Write a separate line tracking behavior for each section Ideal opportunity for implementing functions!
31
Additional Resources
32
Gyroscopes
33
Gyroscopes Single-axis gyroscopic sensor
Detects a rotation of up to + / degrees per second Connects to analog inputs on VEX microcontrollers
34
Gyroscopes How they work:
Very Technical: Each sensor includes a sensing element composed of a single driving mass, kept in continuous oscillation and capable of reacting based on the “Coriolis effect” when an angular rate is applied Less technical: Basically, a component of the sensor is constantly vibrating. As the sensor turns clockwise or counter clockwise, that component vibrates differently, providing different voltage/sensor values
35
Coriolis Effect The Coriolis effect is a deflection of moving objects when they are viewed in a rotating frame of reference. In a frame of reference with clockwise rotation, the deflection is to the left of the motion of the object; in one with counter-clockwise rotation, the deflection is to the right. This effect is caused by the rotation of the Earth and the inertia of the mass experiencing the effect.
36
Gyroscopes Additional Information Activity: Precise Turning
Gyroscopes require a brief calibration period with the robot at rest. This gryo requires 1.1 seconds to properly calibrate. Gyroscopes should be mounted parallel to the axis you want to measure. Over time, gyroscopes will accumulate error caused by head, fluctuations in voltage, ect. For best performance, they should be fully reset at the beginning of your program. Activity: Precise Turning Good Better Even Better
37
Additional Resources
38
Homework VCVT Videos ROBOTC Blog Homework Assignments
Sensing > Line Tracking ROBOTC Blog LCD Screen Resources Gyro Resources Homework Assignments Table Bot Challenge Robo Slalom Level 2 Minefield Traversal
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.