Old Sensors

From Elcano Project Wiki
Jump to navigation Jump to search

Sonar

How the sonar subsystem connected to High-Level works.

SonarArray.JPG

This documentation is taken from Sonar2half.doc, in the Documentation folder in the GitHub repository.

Sonar Board

The board contains up to 8 sonars, numbered as in the diagram. The board acts as a slave to the host over an SPI line. The board has two RJ45 connectors, one to the High-Level board and the other to a second sonar unit. The line to High-Level carries the MOSI/MISO/CLK/SS lines for SPI. The connector to a second sonar unit has a UART serial connection to coordinate timing, but this has never been implemented. If there is a single unit, sonar 6 is rear-facing. If there is a second rear-facing unit, the second unit acts as a slave to the forward-facing unit. In the two-unit configuration, sonar position 6 is unpopulated. Position 12R is never used. The two boards have identical hardware, but will use different software. A better configuration would be to connect both the forward and rear facing units to the High-Level board.

Sonars are operated in three rounds, arranged so that there is no acoustic interference between them.

  1. Sonars at 12, 3, 4R, 7R, 9
  2. Sonars at 1, 3R, 6, 6R, 9R, 10
  3. Sonars at 2, 5R, 8R, 11

Board nomenclature is based on the forward position. When operated in the rear sonar positions are transformed as

12 → 6R

1 → 7R

2 → 8R

3 → 9R

6 → 12R

9 → 3R

10 → 4R

11 → 5R

Two or three pulse width signals on the board are wired together (by OR gates or diodes) and used to generate an interrupt when the pulse changes. The interrupt groups are:

IRQ1: 1, 2, 3 / 7R, 8R, 9R

IRQ2: 10, 11, 12 / 4R, 5R, 6R,

IRQ3: 6, 9 / 12R, 3R

During each sonar round, only one sonar will produce an interrupt.

Notes on 12/12/14:

The lines ADR_OK, ADR_0, ADR_1 and ADR_2 are not needed. They had been intended to select one of eight sonars. Instead, use lines RND_0 and RND_1, both attached to interrupts. These lines are sequenced according to a gray code (only one bit changes at a time):

(RND_0, RND_1) =

(0,1): Start a pulse on sonars at 12, 3 and 9 o'clock.

(1,1): Start a pulse on sonars at 1, 6 and 10 o'clock.

(1,0): Start a pulse on sonars at 2 and 11 o'clock.

(0,0): No action.

The resulting pulse is read on lines IRQ1, IRQ2 and IRQ3. On the forward pointing master, RND_0 and RND_1 are outputs. They are tied to the rear-facing slave, where they are inputs. On the slave, a change on any of lines RND_0 or RND_1 triggers an interrupt, which start the pulse on the appropriate sonars.

The hardware can read both pulse width range (IRQ_1 … 3) and analog range (SNR_1 … 12). It may be wise to use both, to make sure that they agree. No jumpers are needed. The analog values will change slowly, so interference with digital signals may not be significant.

On sonar:

Pin 1- Open or high

Pin 2 – To IRQ1, IRQ2 or IRQ3.

Pin 3 – To SNR_1, SNR_2, SNR_3, SNR_6, SNR_9, SNR_10, SNR_11 or SNR_12.

Pin 4 – Selected by RND_0 and RND_1.

Pin_5 – Serial data could go to D9, D10, D11 or D12, except that Arduino can only receive one software serial at a time. Probably not worth pursuing.

Pin 6 – Vcc

Pin 7 – Ground.

Timing

The default frequency for the SPI CLK is 4 MHz. The clock can be set to numbers between 8 MHz and 125 Khz.

-- Main.JohnsonB - 2017-06-27

  • SonarBoard.png:

<img src="%PUBURLPATH%/%WEB%/%TOPIC%/SonarBoard.png" alt="SonarBoard.png" width="969" height="1254" />

Lidar

How the lidar subsystem connected to High-Level works.

The LiDAR sensor is able to detect the distance and angle of any object in its view. This data can be used by the high-level software to determine where an obstacle is located for the vehicle to avoid.

Hardware

Scanse Sweep is a portable, rotating, horizontal-plane lidar unit. It has a maximum specified range of 40 meters and works best at ranges greater than 0.5 meter. Range data precision is 1 centimeter and range values are in centimeters. Angular resolution is user-configurable by adjusting sample rate and motor rotation frequency. Surface variables like reflectivity and environmental variables like strong illumination by sunlight limit measurement signal quality. Signal quality is a number between 0-255, with smaller numbers indicating poorer signal quality. Angle data precision is 0.0625 degrees and angle values are in degrees, expressed as a 16-bit fixed-point number with twelve integer bits and four fractional bits.

Angle bits Angle decimal (degrees)
...00000001 0.0625
...00010000 1.0
...00010001 1.0625

The Scanse Sweep lidar unit is connected to an Arduino Micro to capture and process range, angle, and signal quality data during a scan.

Software

Software on the Arduino Micro controls the Scanse Sweep. On startup, the setup() procedure resets the lidar, configures scan frequency and motor rotation frequency, waits for the motor to come up to speed, and configures the lidar to begin scanning. The loop() procedure requests the most recent complete scan reading, filters out invalid readings, and processes the signal for transmission to high level.

Filtering

Readings should be rejected if:

  • Range is greater than 4000cm or equal to 1cm
  • Angle is not within desired scan angles
  • Signal quality is above an arbitrary value

Warning: the lidar is always scanning during operation unless the software signals it to stop (not implemented). The Scanse Sweep is a class 1 laser device and designed to be eye-safe, but placing the eye directly in the path of the beam or the scan plane should be avoided or prevented.

Signal processing

Signal processing is required to limit bytes sent to HighLevel but still allow HighLevel to reconstruct obstacle data from the scan. At maximum sampling frequency, the lidar unit collects 1000 range readings per second. Some of these reading are filtered out. This results in tens or hundreds of readings during each pass. To reduce data bandwidth, the software uses a "max delta" value to break the scan into segments beginning and ending at points with a change in range greater than the max delta. This discards small changes in range, but detects larger changes in range that indicate obstacles. This balances the need to detect both obstacles and continuous surfaces like walls. A single straight surface is broken into several segments centered on the closest point. If obstacles are placed on front of the surface, the change in range for each obstacle produces one or more segments for each obstacle and one or more segments for each section of straight surface. How accurately this process reconstructs the field of obstacles depends on how many points are filtered out before signal processing: if obstacle data is missing, it will not begin or end a segment.

YDLIDAR

The YDLIDAR was worked on for the autonomous ATV capstone project summer of 2025 by Henry Haight. The lidar separates the data it detects and creates objects that can be used by the software. More information can be found on the GitHub page: https://github.com/elcano/Obstacles

Scanse Sweep

The Scanse Sweep is a lidar sensor. Its head spins around multiple times per second, and collects information about its lateral surroundings. The spin speed and sampling rate can be changed.

It sends readings over a serial connection, each of which includes the angle, distance, signal strength, and other information.

Blasé Johnson worked on the sweep in the summer of 2017. The following is from his 6/22/17 report.


Basic Sweep Obstacle Detection Algorithm

Goal

To use the readings from the sweep to determine if there is an obstacle present within a given distance in front of the trike, and to stop the trike if this is so. Sweep Operation Rotation and Speed The Sweep rotates counterclockwise. Its rotational speed can be set to any integral value between 0 Hz and 10 Hz (number of full rotations per second).

Sampling Rate

The sweep obtains readings according to a given sample rate. Three distinct sample rates can be used for the Sweep: 500 – 600 Hz 750 – 800 Hz 1000 – 1075 Hz\

Sample Data

Each reading from the Sweep contains these data:

  • A byte with sync/error bits, where the sync bit indicates whether the current reading is the first reading since the sensor last made a full rotation, one of the error bits indicates a communication error with the Lidar module, and the rest of the bits are reserved for future uses.
  • The azimuth (degree of angle with starting position), transmitted as a 16-bit fixed point number, where the 12 MSBs are the integral part and the 4 LSBs are the fractional part.
  • The distance from the nearest obstacle in centimeters, transmitted as a 16-bit integer.
  • A value representing the signal strength, transmitted as an unsigned 8-bit integer, where 0 is the lowest strength, and 255 is the highest strength.
  • A checksum, which is the remainder of the sum of the six previous bytes divided by 255.

Math

The trike will be expected to stop if an obstacle is detected within a certain distance from the front side of the vehicle, within the horizontal span of the trike. These distances are illustrated in Figure 1 as DISTANCE and WIDTH, respectively.  The grey lines in Figure 1 show the distances that will be measured by the Sweep if it detects an obstacle at the line. The formula for this distance is DISTANCE/cos(AZIMUTH) . The range of azimuths for the front side of the trike can be computed from the formula sarcsin(WIDTH/(2*DISTANCE)) and 360-arcsin(WIDTH/(2*DISTANCE)) for the right and left corners, respectively.

Process

Once the Sweep begins taking measurements, check the measurements whose azimuths lie within the boundaries of the front side of the trike. For each measurement within this range, determine if the distance from an obstacle in centimeters is equal to or less than DISTANCE/cos(AZIMUTH) . If so, stop the vehicle until a search of the measurements within the front boundary comes back negative, and a certain amount of time has passed since the last obstacle was detected.W

NEXT > Camera

External Links

Scanse

-- Main.JohnsonB - 2017-11-07

  • Figure 1: Distance from trike to detect obstacle & trike width:

<img src="%PUBURLPATH%/%WEB%/%TOPIC%/ScanseTrike.png" alt="ScanseTrike.png" width="397" height="463" />