29 #include <Eigen/Eigen>
31 #include <VirtualRobot/VirtualRobot.h>
38 #include <RobotAPI/interface/core/RobotState.h>
39 #include <RobotAPI/interface/units/LaserScannerUnit.h>
40 #include <RobotAPI/interface/visualization/DebugDrawerInterface.h>
65 defineOptionalProperty<std::string>(
66 "LaserScannerTopicName",
"LaserScans",
"Name of the laser scan topic.");
67 defineOptionalProperty<std::string>(
"RobotStateComponentName",
68 "RobotStateComponent",
69 "Name of the RobotStateComponent to use.");
70 defineOptionalProperty<std::string>(
71 "DebugDrawerTopicName",
"DebugDrawerUpdates",
"Visualize the results here.");
72 defineOptionalProperty<std::string>(
73 "ReportVisuTopicName",
74 "SimulatorVisuUpdates",
75 "The topic on which the visualization updates are published.");
77 defineOptionalProperty<bool>(
"TopicReplayerDummy",
79 "Enable to serve the purpose of a topic replayer dummy");
80 defineOptionalProperty<int>(
"UpdatePeriod", 25,
"Update period for laser scans in ms");
81 defineOptionalProperty<int>(
82 "VisuUpdateFrequency", 10,
"Visualization update frequency (Hz) for laser scans");
83 defineOptionalProperty<float>(
86 "Size of the grid cells used to generate the occupancy map in mm");
87 defineOptionalProperty<std::string>(
90 "Name of the frames to attach the sensor to (e.g. Node1,Node2,Node3)");
91 defineOptionalProperty<std::string>(
94 "Name of the devices to simulate (e.g. Device1,Device2,Device3)");
95 defineOptionalProperty<std::string>(
98 "Minumum angles to be reported in rad (e.g -2.35,-1.27,0)");
99 defineOptionalProperty<std::string>(
102 "Maxiumum angles to be reported in rad (e.g 2.35,1.27,3.14)");
103 defineOptionalProperty<std::string>(
106 "Number of single steps (angle, distance) per scan (e.g 1081,360,270)");
107 defineOptionalProperty<std::string>(
110 "Noise is added to the distance of single steps (e.g 40,30,20)");
111 defineOptionalProperty<bool>(
112 "visualization.enable",
114 "If enabled, useful information will be visualized in ArViz");
149 virtual public armarx::LaserScannerUnitInterface,
159 return "LaserScannerSimulation";
195 void updateScanData();
197 void fillOccupancyGrid(std::vector<VirtualRobot::SceneObjectPtr>
const& sceneObjects);
199 GridDimension calculateGridDimension(VirtualRobot::SceneObjectSetPtr
const& objects)
const;
201 calculateGridDimension(
const std::vector<VirtualRobot::BoundingBox>& boundingBoxes)
const;
203 calculateGridDimension(
const std::vector<VirtualRobot::SceneObjectPtr>& sceneObjects)
const;
205 VirtualRobot::SceneObjectSetPtr
206 getCollisionObjects(
const std::vector<VirtualRobot::SceneObjectPtr>& sceneObjects)
const;
208 std::vector<VirtualRobot::BoundingBox>
209 boundingBoxes(VirtualRobot::SceneObjectSetPtr
const& objects)
const;
211 std::string topicName;
212 LaserScannerUnitListenerPrx topic;
213 std::string robotStateName;
216 std::string debugDrawerName;
221 bool topicReplayerDummy =
false;
222 int updatePeriod = 25;
223 float gridCellSize = 20.0f;
224 int visuUpdateFrequency = 10;
226 bool enableVisualization{
false};
228 float boxPosZ = 50.0f;
230 std::vector<LaserScannerSimUnit> scanners;
236 LaserScannerInfoSeq connectedDevices;
238 std::unique_ptr<ArVizDrawer> arvizDrawer;
240 std::unique_ptr<Throttler> visuThrottler;