17 const int pixels_per_column = 64;
18 const int columns_per_buffer = 16;
20 const int pixel_bytes = 12;
21 const int column_bytes = 16 + (pixels_per_column * pixel_bytes) + 4;
23 const int encoder_ticks_per_rev = 90112;
25 const std::array<float, OS1::pixels_per_column> beam_altitude_angles = {
26 16.611, 16.084, 15.557, 15.029, 14.502, 13.975, 13.447, 12.920,
27 12.393, 11.865, 11.338, 10.811, 10.283, 9.756, 9.229, 8.701,
28 8.174, 7.646, 7.119, 6.592, 6.064, 5.537, 5.010, 4.482,
29 3.955, 3.428, 2.900, 2.373, 1.846, 1.318, 0.791, 0.264,
30 -0.264, -0.791, -1.318, -1.846, -2.373, -2.900, -3.428, -3.955,
31 -4.482, -5.010, -5.537, -6.064, -6.592, -7.119, -7.646, -8.174,
32 -8.701, -9.229, -9.756, -10.283, -10.811, -11.338, -11.865, -12.393,
33 -12.920, -13.447, -13.975, -14.502, -15.029, -15.557, -16.084, -16.611,
36 3.164, 1.055, -1.055, -3.164, 3.164, 1.055, -1.055, -3.164,
37 3.164, 1.055, -1.055, -3.164, 3.164, 1.055, -1.055, -3.164,
38 3.164, 1.055, -1.055, -3.164, 3.164, 1.055, -1.055, -3.164,
39 3.164, 1.055, -1.055, -3.164, 3.164, 1.055, -1.055, -3.164,
40 3.164, 1.055, -1.055, -3.164, 3.164, 1.055, -1.055, -3.164,
41 3.164, 1.055, -1.055, -3.164, 3.164, 1.055, -1.055, -3.164,
42 3.164, 1.055, -1.055, -3.164, 3.164, 1.055, -1.055, -3.164,
43 3.164, 1.055, -1.055, -3.164, 3.164, 1.055, -1.055, -3.164,
46 struct trig_table_entry {
53 static trig_table_entry trig_table[pixels_per_column];
57 for (
int i = 0; i < pixels_per_column; i++) {
58 trig_table[i] = {sinf(beam_altitude_angles[i] * 2 * M_PI / 360.0
f),
59 cosf(beam_altitude_angles[i] * 2 * M_PI / 360.0
f),
68 inline const uint8_t*
nth_col(
int n,
const uint8_t* udp_buf) {
69 return udp_buf + (n * column_bytes);
74 memcpy(&res, col_buf,
sizeof(uint64_t));
80 memcpy(&ticks, col_buf + (3 * 4),
sizeof(uint32_t));
81 return (2.0 * M_PI * ticks / (
float)encoder_ticks_per_rev);
86 std::memcpy(&res, col_buf + (3 * 4),
sizeof(uint32_t));
92 memcpy(&res, col_buf + (2 * 4),
sizeof(uint32_t));
98 memcpy(&res, col_buf + (196 * 4),
sizeof(uint32_t));
103 inline const uint8_t*
nth_px(
int n,
const uint8_t* col_buf) {
104 return col_buf + 16 + (n * pixel_bytes);
109 memcpy(&res, px_buf,
sizeof(uint32_t));
116 memcpy(&res, px_buf + 4,
sizeof(uint16_t));
122 memcpy(&res, px_buf + 6,
sizeof(uint16_t));
128 memcpy(&res, px_buf + 8,
sizeof(uint16_t));
135 memcpy(&res, imu_buf,
sizeof(uint64_t));
141 memcpy(&res, imu_buf + 8,
sizeof(uint64_t));
147 memcpy(&res, imu_buf + 16,
sizeof(uint64_t));
154 memcpy(&res, imu_buf + 24,
sizeof(
float));
160 memcpy(&res, imu_buf + 28,
sizeof(
float));
166 memcpy(&res, imu_buf + 32,
sizeof(
float));
173 memcpy(&res, imu_buf + 36,
sizeof(
float));
179 memcpy(&res, imu_buf + 40,
sizeof(
float));
185 memcpy(&res, imu_buf + 44,
sizeof(
float));
uint32_t col_measurement_id(const uint8_t *col_buf)
static bool init_tables()
float col_h_encoder_count(const uint8_t *col_buf)
float imu_la_x(const uint8_t *imu_buf)
float imu_av_y(const uint8_t *imu_buf)
static bool tables_initialized
float col_h_angle(const uint8_t *col_buf)
uint16_t px_noise_photons(const uint8_t *px_buf)
uint64_t imu_gyro_ts(const uint8_t *imu_buf)
uint64_t imu_sys_ts(const uint8_t *imu_buf)
float cos_beam_altitude_angles
uint64_t col_timestamp(const uint8_t *col_buf)
float imu_la_y(const uint8_t *imu_buf)
const uint8_t * nth_col(int n, const uint8_t *udp_buf)
uint16_t px_reflectivity(const uint8_t *px_buf)
float imu_av_x(const uint8_t *imu_buf)
float beam_azimuth_angles
const uint8_t * nth_px(int n, const uint8_t *col_buf)
float imu_la_z(const uint8_t *imu_buf)
uint64_t imu_accel_ts(const uint8_t *imu_buf)
float sin_beam_altitude_angles
uint32_t px_range(const uint8_t *px_buf)
float imu_av_z(const uint8_t *imu_buf)
uint16_t px_signal_photons(const uint8_t *px_buf)
uint32_t col_valid(const uint8_t *col_buf)