Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
4. Robot Sensors A sensor is any element that provides information from the to the robot, either about the environment or about the robot itself. Sensing can include contact switches, pressure transducers, encoders and resolvers, position, motion and rate detectors, photodetectors, temperature sensors, imagers, microphones, IR, ultrasonic range detectors and even monitors for internal circuit loads. We will investigate a number of different categories of sensors that can be implemented with the BasicX-24 microprocessor. Generally we need a way to convert a voltage level into a digital value. The BX-24 has 8 inputs that accept analog inputs (voltage levels) and convert them to numeric values (digital samples). These A/D converters are connected to pins 13-20. 4.1 Contact Sensors Switches - The simplest type of contact sensor is the switch. A switch can be a toggle type that can be set to remain on or off (i.e. the electrical path through the switch is connected or unconnected). Switches can be momentary switch is spring loaded so that once the force used to trip the switch is removed it returns to its original condition. Momentary switches can be normally open (no connection) or normally closed. Switches can be combined with some type of mechanical bumper or wisker to produce a contact sensor. Microswitches are types of switches that require a very small pressure or contact force to make/break the connection. Typically a microswitch is a momentary type. In order to permit a microprocessor to read the condition of a switch we need to provide a mechanism in which the switch varies a voltage level being read by the processor. Simple on/off measurements can be read by either a digital input or an analog input. In addition to the 8 A/D inputs the BX-24 has 8 digital input/output pins that can be used to drive other circuits such as our robot servo drive motors. Two alternative circuits are shown below for the interfacing of a switch with a digital circuit such as provided with the BX-24. The point in the circuit labeled I/O pin is connected to a TTL (transister-transister logic) compatible input line such as any I/O pin of the BasicX-24. The first method (on the left) involves referencing the I/O pin high through a high value resistor. Then a switch pulls the I/O pin low through a second smaller resistor. This method will work equally well for both normally-open and normally-closed switches. The second method (on the right) involves referencing the I/O pin to ground or low through a relatively high value resistor. A 100k resistor is used in the example diagram. The button is then used to pull the I/O pin high through a smaller resistor. Again, this method works equally well for both normally-open and normally-closed switches. BasicX-24 Example Programs* - This first example program assumes that you're using I/O pin 16 of a BX-24 and that you have a switch wired according to the diagram Shown above. The program reads the state of any switch connected to the pin and writes that value to a second pin (I/O pin 17, in this case). The logical state of the second I/O pin can then be verified with an oscilloscope or logic probe. An LED can also be used as shown below: Example program 1: Sub Main() Dim State as Byte Do ' Read I/O pin 16. State = GetPin(16) ' Copy the state to pin 17. Call PutPin(17, State) Loop End Sub This program works well with any type of switch, but if you try this example using a momentary switch you will notice that pin 17 only stays in the active state as long as the button is pressed. This program would not work if you wanted to toggle the state of an I/O pin for some time after the sense switch is closed. In order to make use of momentary buttons or switches a different approach is needed. This example program assumes that you are using pin 16 for the input and pin 17 for the output and have a momentary push button wired according to the diagram above. Example program 2 will use the bitwise binary XOR operation to toggle the state of pin 17 each time the momentary button is pressed. Example program 2: Sub Main() ' This program reads the state of a switch and toggles the ' state of an output pin whenever the switch is pressed. Const InputPin As Byte = 16 Const OutputPin As Byte = 17 ' Configure pins. Call PutPin(InputPin, bxInputTristate) Call PutPin(OutputPin, bxOutputHigh) Dim State as Byte State = 0 Do ' Toggle State if switch is pressed. If GetPin(InputPin) = 0 Then State = State Xor 1 ' Pause a quarter-second for button de-bounce. Call Delay(0.25) End If ' Write State to output pin. Call PutPin(OutputPin, State) Loop End Sub *This section taken from the Application Notes for the BasicX-24 by NetMedia. The program above is contained in a separate file called Buttons.bas provided on the BasicX-24 CD. 4.2 Pressure Transducers** Transducers are made from a material that converts one form of energy into another. In this section we will study a type of transducer that converts pressure or vibration into electrical energy (and vice versa). Piezoelectric polymer sensors are one of the most versatile and economical forms of pressure transducers available. There have been significant developments in the technology of piezoelectrics since the discovery of the piezoelectric effect by the Curie brothers over 100 years ago. They found that a quartz crystal changed its size when subjected to an electrical field and that the crystal produced an electrical charge when it was mechanically deformed. Since this discovery other materials have been demonstrated to exhibit this piezoelectric propery, from ceramics to whale bone. Of particular interest is the development of a piezoelectric polymer film called polyvinyidene flouride (PVDF). This material is also pyroelectric which means that it produces a change in electrical charge as a function of temperature. This temperature sensitivity must be accounted for in contact sensor applications but can be used to provide human motion detection capability. As a contact sensor we are interested in the conversion of mechanical force into an electrical charge. The basic layout of the PVDF film is shown below. In the typical application for robotics we will want the sensor circuit to generate a voltage that is proportional to the pressure (or strain) on the piezoelectric element. Since the PVDF response is also a function of temperature we need to compensate for temperature changes in our circuit. A circuit that provides an output compatible with our BasicX-24 (analog/digital I/O) is provided below. **Information in this section taken from the Basic Design Kit for Piezo Film Sensors available from Measurement Specialties, Inc. Sensor Products Division, 950 Forge Ave. Norristown, PA 19403 (610.650.1500) - www.msiusa.com U.S. Eastern Region Representative - James Goeke ([email protected]), U.S. Western Region Representative - Pete Smith ([email protected]). 4.3 Deduced Position/Orientation Sensors In robotic applications there is usually a need to know the position or orientation of the robot platform or some movable component on the robot. Examples include position of a mobile robot in a known environment, the distance moved from some starting position in an unknown or partially known environment or the orientation of a joint in a robot arm. Ideally we would like to know the actual position/orientation obtained from a direct measurement. However this usually requires prohibitively complex and expensive feedback systems (e.g. robot vision or GPS). A simpler alternative is to implement a system in which the position/orientation can be deduced or inferred from sensors. Examples of deduced position sensors are optical encoders (counters) on drive wheels or potentiometers on robotic arm joints. In fact the standard servo uses a potentiometer coupled to the drive shaft though a set of gears to deduce position of the shaft. Optical Encoders - A common type of deduced position sensor is the optical encoder. In its simplest form it consists of a disk with alternating light and dark bands around the circumerence as shown below. An LED (light emitting diode) and photodetector are positioned so that the variations can be counted as the disk rotates. An alternative to the bands is to use a disk with slotted holes. In this design the LED is placed on one side of the disk and the photodetector on the other. incremental encoder absolute encoder When attached to a drive wheel the optical encoder can be used to deduce the amount of motion from the number of counts. This type of encoder cannot account for slipping between the drive wheel and the surface over which the robot is moving. The single counter encoder is also known as a tachometer encoder and, by itself cannot determine the direction of motion. Obviously the robot controller can determine whether to add to the count or subtract from it based on the direction the drive wheel is being powered. Potentiometers - When the amount of motion is bounded such as in the joint of a robotic arm a potentiometer or mechanically variable resistor can be used to deduce orientation. The actuator moves the arm segment while the controller monitors the position of the potentiometer with a simple voltage divider circuit as shown. This system must be calibrated so that the orientation of the arm segment can be deduced from the output voltage of the potentiometer circuit. Accelerometers (Integrated) - Accelerometers measure the amount of acceleration (rate of change in speed). Recently micromachined solid state accelerometers have become available that use piezoelectrics to sense the pressure of a small suspended mass in each of the three orthogonal axes. Given the acceleration as a function of time in a particular direction we can compute (deduce) the change in position along that axis (See Theoretical Background 2.1 Mechanics). 4.4 Measured Position/Orientation Sensors In the previous section we learned methods to compute a robot's position in its environment using acceleration , or the number of wheel revolutions or other indirect measurements of motion. Now we will study ways to directly measure position relative to other objects or target markers. Stereo Imaging (Disparity) - One of the most popular methods to determine range is through stereo imaging or stereo disparity. The disparity is the difference in angular position of a target as viewed from two sensors separated transfersely off the baseline. Assuming that the two sensors are separated by a distance D We can compute the range by measuring the angular position of a target point in the two sensor's fields of view (FOVs). If the sensors are aligned so that the magnitude of the angle to a common target point is the same in their respective FOVs, we can obtain the range R to the target point directly by, R D 2 tan Angle Only (Known Target Locations) - In some applications the robot is required to stay inside a specified region. We can set markers around the perimeter of this region whose positions can be stored in the robot's memory. A common technique is to use IR LEDs transmiting at a known frequency. These beacon markers can be identified by a passive scanning IR detector on the mobile robot. As each target is detected and identified, its angular position can also be recorded. The relative angles between targets in known positions can be used to measure the position of the robot in the bounded region. The measured angle between any three known markers is enough information to obtain the robot's position. Additional marker positions can be used to reduce the measured position error. As shown in the diagram below, two markers are not sufficient to determine relative position. Given an angle a measured between two markers, there is an infinite number of possible observation points. The shape of this locus of points depends on the magniture of the measured angle. Including a third marker permits us to resolve a single point for the observation position. This will be the intersection of the fixed-angle curve for Markers A and B and the fixed-angle curve for Markers B and C. Range Only (Known Target Locations) - The distance (or range) to a set of known markers can also be used to determine the robot's relative position. Ranges can be measured using an active sensor onboard the observation platform and retroreflectors for markers. A retroreflector is a device that returns transmitted energy back along the same angle from which the incident energy was transmitted. The active sensor system transmits a pulse (acoustic or electromagnetic, for example) and then measures the time delay between the time of transmission and the time of the return pulse. This time delay divided by the speed of the transmitted pulse is twice the range to the marker. Two or more markers are sufficient to determine an unambiguous platform position. Instead of using an active sensor system on the platform itself we can replace the retroreflectors with active beacons. Rather than measuring the angle between the beacons we can measure the time between transmitted pulstes. To implement this technique we need a way for all the beacons to transmit at the same time (or at known intervals). This can be accomplished using a common timebase. The Global Positioning System (GPS) is based on this approach. 4.5 Proximity/Range Sensors When we do not have access to known markers or beacons we can use active sensor systems to measure the proximity or range to objects in the environment. Common proximity detectors are based on untrasonics and IR/Visible light. Ultrasonic Range Detectors*** - An ultrasonic range detector transmits an acoustic pulse (ping) and measures the time of the return pulse. Sometimes the receiver circuit is designed to receive the complete response function for a single ping. We will consider the single pulse system which detects the first return pulse that exceeds some predefined threshold. In order to compute the range to an object using ultrasonics we first need to know the speed of sound in air. Although the speed of sound is nominally 1029 fps it can vary depending on the air temperature, pressure and humidity. The speed of sound in an ideal gas (air is a close approximation to an ideal gas) is strictly a function of temperature. That is, where For example, the speed of sound at room temperature ( 22o C, 71.6o F ) is Given c and a time delay T we can determine the range R to the obstruction by, R = cT/2 from: NetMedia BasicX-24 Application Note: Using an Ultrasonic Rangefinder with BasicX IR/Visible Range Detectors - An alternative range detector uses an IR or visible light emitter and matching detector array. The emitter projects a focused spot on the wall or other obstacle being detected. The detector array uses a lens to focus an image of the spot onto one of the elements of a linear array of photosensors. Both the emitter and the detector assembly are angled as shown below. As the range increases the angle of the line of sight changes so that different photosensors are illuminated by the spot. The location of the spot image can be used to measure the distance to the spot. 4.6 Detecting Obstacles and Objects It is also important to be able to detect the presence of people, or other moving objects near the robot. In this section, we will study methods for detecting moving objects. Electromagnetic Field Detectors - A wide variety of proximity detectors are available that make use of the interruption of electromagnic fields. Typical configurations include a induction coil driven with a oscillating voltage. When an object enters the field created by this coil, the induction changes causing a shift in the frequency of the oscillator. This is equivalent to the technique used in a metal locator or a Therimin. Depending on the frequency, induction coils can be used to detect both ferrous and non-ferrous metals as well as certain dialectric materials and living things. Pyroelectric Detectors - Certain materials such as lithium tantalate can be used to detect heat. Motion detectors used in some burgular alarms use pyroelectric detectors designed to respond to energy in the 8-12 m waveband. This is the region of the electromagnetic spectrum corresponding to body heat (See Theoretical Background - 2.3 Optics). Differential Detection - Whether we are detecting IR, thermal, or visible light we can improve the ability to perceive movement by using or more detectors in a split field-of-view (FOV) and measuring the difference between the detectors. The LEGOTM Light Sensor can be used to track a light source, but is has limited accuracy because it measures absolute levels which are affected by ambient light levels (in the robot's environment). Michael Gasperi presents a design for a differential light sensor for the RCX unit at http://www.plazaearth.com /usr/gasperi/dlite.htm. His circuit is shown below: This circuit provides an ouput proportional to the difference in the light levels reaching the two cadmium sulfide photoresistors (CdS1 and CdS2). These components can be replaced with any other type of photoresistor desired. Note the use of the diodes to separate the source voltage (supplied by the RCX) from the signal from the LM324 operational amplifier. Adding lenses and the appropriate housing permits us to develop a differential light sensor that can "see" at longer ranges and with greater angular resolution. Such a sensor can be used to detect a hard-edge versus transition target placed on a light colored wall. By reversing the orientation of the grayscale transition to hard-edge we can use differential light detectors to recognize two different target points. This is a scheme for locating the two goals in table-top robot soccer. Turned vertically, such a sensor could also be used to detect a dark puck against a light colored floor. Four Quadrant Detector - We can extend the concept of the differential light sensor into two dimensions to create a four quadrant detector array. These arrays can be used to track a moving light source with a two-axis servo-driven tracking system. As shown in the diagram below, the orientation of the detector array can be adjusted until the image of the light spot creates an equal light level on all four detectors.