Sonar Data
SonarData
ID 276Periodic
- Payload
- ≥ 18 bytes, variable
- Packet
- ≥ 40 bytes
- Source
- vehicle
- Category
- Sensors
This message contains the data acquired by a single sonar measurement. The following describes the format used to fill the data field used in this message. (Byte order is little endian.)
Sidescan:
| Data | Name | Type |
|---|---|---|
| A | Ranges data | uintX_t |

- The type uintX_t will depend on the number of bits per unit, and it should be a multiple of 8.
- Furthermore, for now, 32 bits is the highest value of bits per unit supported.
Multibeam:
| Index | Section | Name | Type | Comments |
|---|---|---|---|---|
| 1 | H1 | Number of points | uint16_t | Number of data points |
| 2 | H2 | Start angle | fp32_t | In radians |
| 3 | H3 | Flags | uint8_t | Refer to next table |
| 4 | H4 ? | Angle scale factor | fp32_t | Used for angle steps in radians |
| 5 | H5 ? | Intensities scale factor | fp32_t | |
| 6 | D1 ? | Angle steps[H1] | uint16_t | Values in radians |
| 7 | D2 | Ranges[H1] | uintX_t | Ranges data points (scale factor from common field "Scaling Factor") |
| 8 | D3 ? | Intensities[H1] | uintX_t | Intensities data points |
| Section | Flag Label | Bit |
|---|---|---|
| H3.1 | Intensities flag | 0 |
| H3.2 | Angle step flag | 1 |

Notes:
- Each angle at step i can be calculated is defined by:
angle[i] = H2_start_angle + (32-bit sum of D1_angle_step[0] through D1_angle_step[i]) * H4_scaling_factor- If bit H4.1 is not set then sections H5 and D3 won't exist.
- If bit H4.2 is not set then sections H4 and D1 won't exist. In case this bit is set, then the angle steps is read from field "Beam Width" from "Beam Configuration".
- The type uintX_t will depend on the number of bits per unit, and it should be a multiple of 8.
- Furthermore, for now, 32 bits is the highest value of bits per unit supported.
How to write ranges and intensities data:
data_unit = (Integer) (data_value / scale_factor);
bytes_per_unit = bits_per_unit / 8;
LOOP: i = 0, until i = bytes_per_unit
byte[i] = (data_unit >> 8 * i) & 0xFF);
write(byte);Common:
#Fields
| Offset | Field | Type | Unit | Range | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | #typeType |
uint8_t |
Enumerated | – | Type of sonar.
|
||||||||||||
| 1 | #frequencyFrequency |
uint32_t |
Hz | – | Operating frequency. |
||||||||||||
| 5 | #min_rangeMinimum Range |
uint16_t |
m | – | Minimum range. |
||||||||||||
| 7 | #max_rangeMaximum Range |
uint16_t |
m | – | Maximum range. |
||||||||||||
| 9 | #bits_per_pointBits Per Data Point |
uint8_t |
bit | – | Size of the data unit. (Should be multiple of 8) |
||||||||||||
| 10 | #scale_factorScaling Factor |
fp32_t |
– | – | Scaling factor used to multiply each data unit to restore the original floating point value. |
||||||||||||
| 14 | #beam_configBeam Configuration |
message-list<BeamConfig> |
– | – | Beam configuration of the device. |
||||||||||||
| var | #dataData |
rawdata |
– | – | Data acquired by the measurement. |
#References
Carried inline by:
DirSonarData.measurementmessage