30 #include <unordered_map>
34 #include <VirtualRobot/MathTools.h>
35 #include <VirtualRobot/VirtualRobot.h>
116 void createRemoteGuiTab();
121 void RemoteGui_update() override;
125 struct FramedFeatures
127 std::vector<Features> features;
131 void runPeriodically();
140 const std::vector<Features>& features);
142 Throttler& getOrCreateThrottler(std::string frame);
144 void drawFeatures(
const std::vector<Features>& features,
146 const std::string frame,
148 const Eigen::Isometry3f& global_T_sensor);
150 void mergeFeatures(
const std::vector<FramedFeatures>& framedFeatures,
163 void drawBoxes(const Properties& p, viz::Client& arviz);
167 static const std::string defaultName;
172 int taskPeriodMs = 100;
176 std::string robotName;
204 .angleThreshold = 2 * M_PIf32 / 1000.F * 5.F,
205 .maxDistance = 3
'000.F // [mm]
208 ChainApproximation::Params chainApproximationParams{
209 .distanceTh = 40.F // [mm]
214 bool drawRawPoints = {true};
215 bool visualizeSeparateFeatures = {false};
216 bool visualizeMergedFeatures = {true};
218 ArVizDrawer::Parameters arvizDrawer;
223 bool filterLaserScansWithCostmap = false;
224 float distance = 100.0;
226 std::string costmapProviderName = "distance_to_obstacle_costmap_provider";
227 std::string costmapName = "distance_to_obstacles_small_margin";
231 Properties properties;
232 /* Use a mutex if you access variables from different threads
233 * (e.g. ice functions and RemoteGui_update()).
234 std::mutex propertiesMutex;
237 /* (Requires the armarx::LightweightRemoteGuiComponentPluginUser.)
239 struct RemoteGuiTab : armarx::RemoteGui::Client::Tab
241 armarx::RemoteGui::Client::LineEdit boxLayerName;
242 armarx::RemoteGui::Client::IntSpinBox numBoxes;
244 armarx::RemoteGui::Client::Button drawBoxes;
249 /* (Requires the armarx::ArVizComponentPluginUser.)
250 * When used from different threads, an ArViz client needs to be synchronized.
252 std::mutex arvizMutex;
255 PeriodicTask<LaserScannerFeatureExtraction>::pointer_type task;
257 std::unique_ptr<FeatureExtractor> featureExtractor;
258 std::unique_ptr<ArVizDrawer> arVizDrawer;
260 std::unique_ptr<FrequencyReporter> frequencyReporterPublish;
261 std::unique_ptr<FrequencyReporter> frequencyReporterRun;
263 std::optional<armarx::navigation::algorithms::Costmap> obstacleDistancesCostmapSmallMargin;
265 std::unordered_map<std::string, Throttler> throttlers;
267 VirtualRobot::RobotPtr robot;
269 std::variant<std::monostate, VirtualRobot::MathTools::ConvexHull2DPtr, Eigen::Vector2f>
271 VirtualRobot::MathTools::ConvexHull2DPtr cableArea;
274 armem::client::plugins::ReaderWriterPlugin<armem::robot_state::VirtualRobotReader>*
275 virtualRobotReaderPlugin = nullptr;
277 armem::client::plugins::ReaderWriterPlugin<armem::laser_scans::client::Reader>*
278 laserScannerReaderPlugin = nullptr;
280 armem::client::plugins::ReaderWriterPlugin<memory::client::laser_scanner_features::Writer>*
281 laserScannerFeatureWriterPlugin = nullptr;
283 armem::client::plugins::ReaderWriterPlugin<navigation::memory::client::costmap::Reader>*
284 costmapReaderPlugin = nullptr;
286 } // namespace armarx::navigation::components::laser_scanner_feature_extraction