29 #include <Eigen/Eigen>
31 #include <VirtualRobot/VirtualRobot.h>
37 #include <RobotAPI/interface/core/RobotState.h>
39 #include <RobotAPI/interface/units/LaserScannerUnit.h>
40 #include <RobotAPI/interface/visualization/DebugDrawerInterface.h>
66 defineOptionalProperty<std::string>(
"LaserScannerTopicName",
"LaserScans",
"Name of the laser scan topic.");
67 defineOptionalProperty<std::string>(
"RobotStateComponentName",
"RobotStateComponent",
"Name of the RobotStateComponent to use.");
68 defineOptionalProperty<std::string>(
"DebugDrawerTopicName",
"DebugDrawerUpdates",
"Visualize the results here.");
69 defineOptionalProperty<std::string>(
"ReportVisuTopicName",
"SimulatorVisuUpdates",
"The topic on which the visualization updates are published.");
71 defineOptionalProperty<bool>(
"TopicReplayerDummy",
false,
"Enable to serve the purpose of a topic replayer dummy");
72 defineOptionalProperty<int>(
"UpdatePeriod", 25,
"Update period for laser scans in ms");
73 defineOptionalProperty<int>(
"VisuUpdateFrequency", 10,
"Visualization update frequency (Hz) for laser scans");
74 defineOptionalProperty<float>(
"GridCellSize", 20.0f,
"Size of the grid cells used to generate the occupancy map in mm");
75 defineOptionalProperty<std::string>(
"Frames",
"LaserScanner_1",
"Name of the frames to attach the sensor to (e.g. Node1,Node2,Node3)");
76 defineOptionalProperty<std::string>(
"Devices",
"127.0.0.1",
"Name of the devices to simulate (e.g. Device1,Device2,Device3)");
77 defineOptionalProperty<std::string>(
"MinAngles",
std::to_string(-
M_PI),
"Minumum angles to be reported in rad (e.g -2.35,-1.27,0)");
78 defineOptionalProperty<std::string>(
"MaxAngles",
std::to_string(
M_PI),
"Maxiumum angles to be reported in rad (e.g 2.35,1.27,3.14)");
79 defineOptionalProperty<std::string>(
"Steps",
"1081",
"Number of single steps (angle, distance) per scan (e.g 1081,360,270)");
80 defineOptionalProperty<std::string>(
"NoiseStdDev",
"40.0",
"Noise is added to the distance of single steps (e.g 40,30,20)");
81 defineOptionalProperty<bool>(
"visualization.enable",
false,
"If enabled, useful information will be visualized in ArViz");
116 virtual public armarx::LaserScannerUnitInterface,
125 return "LaserScannerSimulation";
161 void updateScanData();
163 void fillOccupancyGrid(std::vector<VirtualRobot::SceneObjectPtr>
const& sceneObjects);
165 GridDimension calculateGridDimension(VirtualRobot::SceneObjectSetPtr
const& objects)
const;
166 GridDimension calculateGridDimension(
const std::vector<VirtualRobot::BoundingBox>& boundingBoxes)
const;
167 GridDimension calculateGridDimension(
const std::vector<VirtualRobot::SceneObjectPtr>& sceneObjects)
const;
169 VirtualRobot::SceneObjectSetPtr getCollisionObjects(
const std::vector<VirtualRobot::SceneObjectPtr>& sceneObjects)
const;
171 std::vector<VirtualRobot::BoundingBox> boundingBoxes(VirtualRobot::SceneObjectSetPtr
const& objects)
const;
173 std::string topicName;
174 LaserScannerUnitListenerPrx topic;
175 std::string robotStateName;
178 std::string debugDrawerName;
183 bool topicReplayerDummy =
false;
184 int updatePeriod = 25;
185 float gridCellSize = 20.0f;
186 int visuUpdateFrequency = 10;
188 bool enableVisualization{
false};
190 float boxPosZ = 50.0f;
192 std::vector<LaserScannerSimUnit> scanners;
198 LaserScannerInfoSeq connectedDevices;
200 std::unique_ptr<ArVizDrawer> arvizDrawer;
202 std::unique_ptr<Throttler> visuThrottler;