Download presentation
Presentation is loading. Please wait.
Published byGerald Cummings Modified over 6 years ago
1
ROBOTC for VEX Online Professional Development
2
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.”
3
Sensor Information: Touch Sensors
4
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()
5
Move Forward until Pressed
6
Natural Language - Until
Commands that allow you to create behaviors where the robot acts “until” a certain event untilTouch() untilRelease() untilBump()
7
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:
8
Natural Language Move Forward until Pressed
9
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?
10
Additional Resources
11
Sensor Information: Potentiometer
12
Potentiometers Potentiometer Check 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
13
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.
14
Potentiometers
15
Natural Language - Until
Commands that allow you to create behaviors where the robot acts “until” a certain event untilPotentiometerGreaterThan() untilPotentiometerLessThan()
16
Natural Language Autonomous Arm Control
17
Potentiometers Variable Speed Program
Use the rotation of the potentiometer to control how fast the robots motors spin
18
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.
19
Sensor Information Ultrasonic Rangefinder
20
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()
21
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.
22
Forward until Near
23
Natural Language - Until
Commands that allow you to create behaviors where the robot acts “until” a certain event untilSonarGreaterThan() untilSonarLessThan()
24
Natural Language Forward until Near
25
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
26
Straight until Near
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.