Skip to content

Commit

Permalink
Utilize sensor manager to creat sensors
Browse files Browse the repository at this point in the history
Signed-off-by: Nate Koenig <[email protected]>
  • Loading branch information
Nate Koenig committed Jan 29, 2021
1 parent d2de367 commit 2f674e6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/SystemLoader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class ignition::gazebo::SystemLoaderPrivate
}

std::string pluginName = "";
for (auto name : pluginNames)
for (const auto &name : pluginNames)
{
pluginName = name;
}
Expand Down
24 changes: 3 additions & 21 deletions src/systems/sensors/Sensors.cc
Original file line number Diff line number Diff line change
Expand Up @@ -498,27 +498,9 @@ std::string Sensors::CreateSensor(const Entity &_entity,
return std::string();
}

// Create within ign-sensors
ignition::sensors::SensorId sensorId;
if (_sdf.Type() == sdf::SensorType::CAMERA)
{
std::unique_ptr<sensors::CameraSensor> cameraSensor =
std::make_unique<sensors::CameraSensor>();
cameraSensor->Load(_sdf);
sensorId = this->dataPtr->sensorManager.AddSensor(std::move(cameraSensor));
}
else if (_sdf.Type() == sdf::SensorType::THERMAL_CAMERA)
{
std::unique_ptr<sensors::ThermalCameraSensor> thermalCameraSensor =
std::make_unique<sensors::ThermalCameraSensor>();
thermalCameraSensor->Load(_sdf);
sensorId = this->dataPtr->sensorManager.AddSensor(
std::move(thermalCameraSensor));
}
else
{
sensorId = this->dataPtr->sensorManager.CreateSensor(_sdf);
}
// Create using ign-sensors
ignition::sensors::SensorId sensorId =
this->dataPtr->sensorManager.CreateSensor(_sdf);
auto sensor = this->dataPtr->sensorManager.Sensor(sensorId);

// Add to sensorID -> entity map
Expand Down

0 comments on commit 2f674e6

Please sign in to comment.