refactor: restructure lidarlib into xlidar-driver plugin SDK
- LidarManager facade (liblidar_manager.so): dlopen plugin discovery, available_drivers map<driver_id, PluginRegistry>, create_lidar_device, config.json load/save with legacy lidarlib migration - Common LidarDriverInterface + DriverInfo/DeviceConfig plugin ABI (extern C get_driver_info / create_driver_instance) - Plugins: driver_rplidar (ported from xlocd, Slamtec SDK), driver_olei, driver_sick_code (TiM CoLa-A), driver_sick_safety (nanoScan3), driver_espe - Diagnostics extended with rplidar health + firmware; FOV filter window, range override and legacy remap window unified in DeviceConfig - Rewritten README, diagnostics doc and examples (list_drivers, example, lidar_app) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
28
examples/list_drivers.cpp
Normal file
28
examples/list_drivers.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
// Discover plugins and print every registered driver.
|
||||
// ./list_drivers [plugins_dir] (default: ./plugins)
|
||||
#include "lidar_manager.hpp"
|
||||
#include <cstdio>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
const std::string plugins_dir = (argc > 1) ? argv[1] : "plugins";
|
||||
|
||||
xlidar::LidarManager manager(plugins_dir);
|
||||
size_t count = manager.load_all_plugins();
|
||||
printf("%zu driver(s) in %s\n\n", count, plugins_dir.c_str());
|
||||
|
||||
for (const auto& [driver_id, plugin] : manager.available_drivers()) {
|
||||
const xlidar::DriverInfo& info = plugin.info;
|
||||
printf("%s\n", driver_id.c_str());
|
||||
printf(" vendor: %s\n", info.vendor.c_str());
|
||||
printf(" model: %s\n", info.model.c_str());
|
||||
printf(" transport: %s%s\n", xlidar::to_string(info.transport),
|
||||
info.transport_selectable ? " (selectable)" : "");
|
||||
printf(" models: ");
|
||||
for (size_t i = 0; i < info.supported_models.size(); ++i)
|
||||
printf("%s%s", i ? ", " : "", info.supported_models[i].c_str());
|
||||
printf("\n");
|
||||
printf(" description: %s\n", info.description.c_str());
|
||||
printf(" file: %s\n\n", plugin.file_path.c_str());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user