Skip to content

Commit

Permalink
fix: correct azimuth offset for vls128
Browse files Browse the repository at this point in the history
Signed-off-by: badai-nguyen <[email protected]>
  • Loading branch information
badai-nguyen committed Jan 22, 2024
1 parent 73a1e1b commit c407d65
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ void Vls128Decoder::unpack(const velodyne_msgs::msg::VelodynePacket & velodyne_p

// Correct for the laser rotation as a function of timing during the firings.
const float azimuth_corrected_f =
azimuth + (azimuth_diff * vls_128_laser_azimuth_cache_[firing_order]);
azimuth + (azimuth_diff * vls_128_laser_azimuth_cache_[firing_order])
- corrections.rot_correction * 180.0 / M_PI * 100;
const uint16_t azimuth_corrected = ((uint16_t)round(azimuth_corrected_f)) % 36000;

if (
Expand All @@ -226,13 +227,8 @@ void Vls128Decoder::unpack(const velodyne_msgs::msg::VelodynePacket & velodyne_p
// convert polar coordinates to Euclidean XYZ.
const float cos_vert_angle = corrections.cos_vert_correction;
const float sin_vert_angle = corrections.sin_vert_correction;
const float cos_rot_correction = corrections.cos_rot_correction;
const float sin_rot_correction = corrections.sin_rot_correction;

const float cos_rot_angle = cos_rot_table_[azimuth_corrected] * cos_rot_correction +
sin_rot_table_[azimuth_corrected] * sin_rot_correction;
const float sin_rot_angle = sin_rot_table_[azimuth_corrected] * cos_rot_correction -
cos_rot_table_[azimuth_corrected] * sin_rot_correction;
const float cos_rot_angle = cos_rot_table_[azimuth_corrected];
const float sin_rot_angle = sin_rot_table_[azimuth_corrected];

// Compute the distance in the xy plane (w/o accounting for rotation).
const float xy_distance = distance * cos_vert_angle;
Expand Down

0 comments on commit c407d65

Please sign in to comment.