Download presentation
Presentation is loading. Please wait.
1
ROBOTC for VEX Online Professional Development
2
Homework Questions Thoughts? Questions?
3
Troubleshooting Student: My loop should only be running for 1 minute, but it never stops.
4
Student: “My program runs when the Cortex is connected to the computer, but when it’s not connected it just sits there doing nothing.”
5
Student: “My program runs when the Cortex is connected to the computer, but when it’s not connected it just sits there doing nothing.”
6
Student: “My motor should spin forward for 3
Student: “My motor should spin forward for 3 seconds, stop for 2 seconds, then reverse for 3 seconds, but it never stops in the middle.”
7
Sensor Information: Touch Sensors
8
Touch Sensors Touch Sensor Check How they work Two Types
Plugged into Digital 6 on the Cortex How they work Digital sensor - Pressed or Released 1 = Pressed, 0 = Released Watch out for “bouncing” Two Types Limit Switches (top) Bumper Switches (bottom) Setting them up ROBOTC Motors and Sensors Setup window Using them The SensorValue[] command untilTouch(), untilRelease(), until Bump()
9
Move Forward until Pressed
10
Natural Language - Until
Commands that allow you to create behaviors where the robot acts “until” a certain event untilTouch() untilRelease() untilBump()
11
Touch Sensors Other Properties Limitations
Limit Switch arm can be bent to create a more ideal “hit area” Both sensors spring back to “open” position Limitations Watch out for “bouncing”. As the sensor is pressed or released, it may bounce between 0 and 1 very briefly and quickly. A very brief wait can be inserted as part of the untilBump() command, or after the untilTouch() and untilRelease() commands to reduce the bouncing effect:
12
Natural Language Move Forward until Pressed
13
Touch Sensors Start Button
Remember how we used the Remote Control button to start the timer portion of the program? How would we implement the same thing with the limit switch?
14
Additional Resources
15
Sensor Information: Potentiometer
16
Potentiometers Potentiometer Check How they work
Analog Port 6 on Cortex How they work Analog sensor Measures rotation of a shaft between 0 and ~265 degrees Cortex returns values 0 - ~4095 Using them The SensorValue[] command untilPotentiometerGreaterThan, untilPotentiometerLessThan NL commands
17
Potentiometers Other Properties Limitations
Internal mechanical stops prevent the potentiometer from turning a full revolution. Limitations Caution: Excess torque against the internal mechanical stops (can be caused by hand or by a VEX motor) will cause them to wear away. The potentiometer will continue to function, but will have a “dead zone” where the mechanical stops were, where no new values are sent. Switching the direction the potentiometer is facing will also switch the direction it “counts”. For example: counter-clockwise turns will count 0 to 4095 on one side; on the other counter-clockwise turns will count 4095 – 0.
18
Potentiometers
19
Natural Language - Until
Commands that allow you to create behaviors where the robot acts “until” a certain event untilPotentiometerGreaterThan() untilPotentiometerLessThan()
20
Natural Language Autonomous Arm Control
21
Potentiometers Variable Speed Program
Use the rotation of the potentiometer to control how fast the robots motors spin
22
Advanced Arm Control Use the Touch Sensor and Potentiometer to control the minimum and maximum values of the arm. Follow videos in the VEX Cortex video Trainer.
23
Sensor Information Ultrasonic Rangefinder
24
The Ultrasonic Rangefinder
Ultrasonic Rangefinder Check Input into Digital Port 8 (Always lower port number) Output wire plugged into Digital Port 9 How they work Similar to how bats and submarines work Digital sensor – but returns distance values between 0 & 648 cm (Can also return values of -1 or -2) Cortex resolution can be in inches, cm, or even mm Using them Be careful not to use them immediately as your program starts – they take time to initialize and will return negative values The SensorValue[] command untilSonarLessThan(), untilSonarGreaterThan()
25
Ultrasonic Rangefinder
Other Properties The Ultrasonic Rangefinder is able to detect objects in a “cone” field of view. As objects get further away, the sensor is able to detect them further away from the center of the sensor. The sensor bases distance calculations off of sound waves, which means that some objects may not be detectable: soft objects that absorb sound, sharp objects that deflect sound, etc. Do not use the ultrasonic sensor as the very first command in your code. Until the first sound echo returns to the sensor, it will have a value of -1. A simple delay at the beginning of your program solves this.
26
Forward until Near
27
Natural Language - Until
Commands that allow you to create behaviors where the robot acts “until” a certain event untilSonarGreaterThan() untilSonarLessThan()
28
Natural Language Forward until Near
29
The Ultrasonic Rangefinder
Forward/Straight until Near Move straight forward until the robot is near an object, then stop Follow along with videos in VCVT
30
Straight until Near
31
Sensor Homework VCVT Videos Homework Assignments:
Sensing > Limiting the Arm (Optional) Movement > Shaft Encoders (Optional) Movement > Automated Straightening Sensing > Behaviors and Functions Sensing > Forward until Near Homework Assignments: Minefield Removal Level 2 Challenge The Speed of Sound Quick-tap Challenge
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.