generated from tier4/ros2-project-template
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
push VLP32 results *almost* identical to original decoder
- Loading branch information
Showing
6 changed files
with
67 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
nebula_decoders/include/nebula_decoders/nebula_decoders_velodyne/decoders/vlp_32.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#pragma once | ||
|
||
#include "nebula_decoders/nebula_decoders_velodyne/decoders/velodyne_sensor.hpp" | ||
|
||
namespace nebula | ||
{ | ||
namespace drivers | ||
{ | ||
class VLP32 : public VelodyneSensor | ||
{ | ||
public: | ||
bool fillAzimuthCache() | ||
{ | ||
for (uint8_t i = 0; i < 16; i++) { | ||
laser_azimuth_cache_[i] = (VLP32_CHANNEL_DURATION / VLP32_SEQ_DURATION) * (i + i / 8); | ||
} | ||
return true; | ||
} | ||
|
||
// TODO: implement this function | ||
uint16_t getAzimuthCorrected( | ||
uint16_t azimuth, float azimuth_diff, int firing_sequence, int firing_order) | ||
{ | ||
float azimuth_corrected = azimuth + (azimuth_diff * laser_azimuth_cache_[firing_order]); | ||
|
||
return static_cast<uint16_t>(round(azimuth_corrected)) % 36000; | ||
} | ||
|
||
constexpr static int num_maintenance_periods = 0; | ||
|
||
constexpr static int num_simultaneous_firings = 2; | ||
|
||
constexpr static double firing_sequences_per_block = 1.0; | ||
|
||
constexpr static int channels_per_firing_sequence = 32; | ||
|
||
constexpr static float distance_resolution_m = 0.004f; // TODO: double check this | ||
|
||
private: | ||
float laser_azimuth_cache_[16]; | ||
}; | ||
} // namespace drivers | ||
} // namespace nebula |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters