Skip to content

Commit

Permalink
Remove deprecations
Browse files Browse the repository at this point in the history
Signed-off-by: Addisu Z. Taddese <[email protected]>
  • Loading branch information
azeey committed Jul 24, 2023
1 parent cd915f5 commit 2acd508
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 197 deletions.
48 changes: 0 additions & 48 deletions include/gz/sensors/Manager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -89,51 +89,6 @@ namespace gz
return result;
}

/// \brief Create a sensor from SDF without a known sensor type.
///
/// This creates sensors by looking at the given sdf element.
/// Sensors created with this API offer an gz-transport interface.
/// If you need a direct C++ interface to the data, you must get the
/// sensor pointer and cast to the correct type.
///
/// A <sensor> tag may have multiple <plugin> tags. A SensorId will be
/// returned for each plugin that is described in SDF.
/// If there are no <plugin> tags then one of the plugins shipped with
/// this library will be loaded. For example, a <sensor> tag with
/// <camera> but no <plugin> will load a CameraSensor from
/// gz-sensors-camera.
/// \sa Sensor()
/// \param[in] _sdf pointer to the sdf element
/// \return A sensor id that refers to the created sensor. NO_SENSOR
/// is returned on erro.
/// \deprecated Sensor registration is deprecated, so it's necessary to
/// provide the specific sensor type to create it. Use the templated
/// `CreateSensor` function.
public: gz::sensors::SensorId GZ_DEPRECATED(6) CreateSensor(
sdf::ElementPtr _sdf);

/// \brief Create a sensor from SDF without a known sensor type.
///
/// This creates sensors by looking at the given sdf element.
/// Sensors created with this API offer an gz-transport interface.
/// If you need a direct C++ interface to the data, you must get the
/// sensor pointer and cast to the correct type.
///
/// A <sensor> tag may have multiple <plugin> tags. A SensorId will be
/// returned for each plugin that is described in SDF.
/// If there are no <plugin> tags then one of the plugins shipped with
/// this library will be loaded. For example, a <sensor> tag with
/// <camera> but no <plugin> will load a CameraSensor from
/// gz-sensors-camera.
/// \sa Sensor()
/// \param[in] _sdf SDF sensor DOM object
/// \return A sensor id that refers to the created sensor. NO_SENSOR
/// is returned on erro.
/// \deprecated Sensor registration is deprecated, so it's necessary to
/// provide the specific sensor type to create it. Use the templated
/// `CreateSensor` function.
public: gz::sensors::SensorId GZ_DEPRECATED(6) CreateSensor(
const sdf::Sensor &_sdf);

/// \brief Add a sensor for this manager to manage.
/// \sa Sensor()
Expand All @@ -160,9 +115,6 @@ namespace gz
public: void RunOnce(const std::chrono::steady_clock::duration &_time,
bool _force = false);

/// \brief Adds colon delimited paths sensor plugins may be
public: void GZ_DEPRECATED(6) AddPluginPaths(const std::string &_path);

GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
/// \brief private data pointer
private: std::unique_ptr<ManagerPrivate> dataPtr;
Expand Down
64 changes: 0 additions & 64 deletions include/gz/sensors/SensorFactory.hh
Original file line number Diff line number Diff line change
Expand Up @@ -39,30 +39,6 @@ namespace gz
// forward declaration
class SensorFactoryPrivate;

/// \brief Base sensor plugin interface
/// \deprecated Sensor plugins are deprecated. Instantiate sensor objects
/// instead.
class GZ_SENSORS_VISIBLE SensorPlugin
{
/// \brief Instantiate new sensor
/// \return New sensor
public: virtual Sensor GZ_DEPRECATED(6) * New() = 0;
};

/// \brief Templated class for instantiating sensors of the specified type
/// \tparam Type of sensor being instantiated.
/// \deprecated Sensor plugins are deprecated. Instantiate sensor objects
/// instead.
template<class SensorType>
class SensorTypePlugin : public SensorPlugin
{
// Documentation inherited
public: SensorType GZ_DEPRECATED(6) * New() override
{
return new SensorType();
};
};

/// \brief A factory class for creating sensors
/// This class instantiates sensor objects based on the sensor type and
/// makes sure they're initialized correctly.
Expand Down Expand Up @@ -162,46 +138,6 @@ namespace gz
return sensor;
}

/// \brief Create a sensor from SDF without a known sensor type.
///
/// This creates sensors by looking at the given sdf element.
/// Sensors created with this API offer an gz-transport interface.
/// If you need a direct C++ interface to the data, you must get the
/// sensor pointer and cast to the correct type.
///
/// \sa Sensor()
/// \param[in] _sdf pointer to the sdf element
/// \return Null, as the function is deprecated.
/// \deprecated Sensor registration is deprecated, so it's necessary to
/// provide the specific sensor type to create it. Use the templated
/// `CreateSensor` function.
public: std::unique_ptr<Sensor> GZ_DEPRECATED(6) CreateSensor(
sdf::ElementPtr _sdf);

/// \brief Create a sensor from an SDF Sensor DOM object without a known
/// sensor type.
///
/// This creates sensors by looking at the given SDF Sensor DOM
/// object.
/// Sensors created with this API offer a gz-transport interface.
/// If you need a direct C++ interface to the data, you must get the
/// sensor pointer and cast to the correct type.
///
/// \sa Sensor()
/// \param[in] _sdf SDF Sensor DOM object.
/// \return A sensor id that refers to the created sensor. Null is
/// is returned on error.
/// \deprecated Sensor registration is deprecated, so it's necessary to
/// provide the specific sensor type to create it. Use the templated
/// `CreateSensor` function.
public: std::unique_ptr<Sensor> GZ_DEPRECATED(6) CreateSensor(
const sdf::Sensor &_sdf);

/// \brief Add additional path to search for sensor plugins
/// \param[in] _path Search path
/// \deprecated Sensor plugins aren't supported anymore.
public: void GZ_DEPRECATED(6) AddPluginPaths(const std::string &_path);

GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
/// \brief private data pointer
private: std::unique_ptr<SensorFactoryPrivate> dataPtr;
Expand Down
36 changes: 0 additions & 36 deletions src/Manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,6 @@ gz::sensors::Sensor *Manager::Sensor(
return iter != this->dataPtr->sensors.end() ? iter->second.get() : nullptr;
}

//////////////////////////////////////////////////
void Manager::AddPluginPaths(const std::string &)
{
gzwarn << "Trying to add plugin paths, but Gazebo Sensors doesn't support"
<< " plugins anymore." << std::endl;
}

//////////////////////////////////////////////////
bool Manager::Remove(const gz::sensors::SensorId _id)
{
Expand All @@ -82,32 +75,3 @@ void Manager::RunOnce(
s.second->Update(_time, _force);
}
}

/////////////////////////////////////////////////
SensorId Manager::AddSensor(
std::unique_ptr<sensors::Sensor> _sensor)
{
if (!_sensor)
return NO_SENSOR;
SensorId id = _sensor->Id();
this->dataPtr->sensors[id] = std::move(_sensor);
return id;
}

/////////////////////////////////////////////////
gz::sensors::SensorId Manager::CreateSensor(const sdf::Sensor &)
{
gzwarn << "Trying to create sensor without providing sensor type. Gazebo"
<< " Sensors doesn't support sensor registration anymore. Use the"
<< " templated `CreateSensor` function instead." << std::endl;
return NO_SENSOR;
}

/////////////////////////////////////////////////
gz::sensors::SensorId Manager::CreateSensor(sdf::ElementPtr)
{
gzwarn << "Trying to create sensor without providing sensor type. Gazebo"
<< " Sensors doesn't support sensor registration anymore. Use the"
<< " templated `CreateSensor` function instead." << std::endl;
return NO_SENSOR;
}
12 changes: 1 addition & 11 deletions src/Sensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,7 @@ bool SensorPrivate::PopulateFromSDF(const sdf::Sensor &_sdf)
}
else
{
// TODO(ahcorde): Remove this deprecation in gz-sensors8
if (element->HasElement("ignition_frame_id"))
{
gzwarn << "The `ignition_frame_id` tag is deprecated. "
<< "Please use `gz_frame_id` instead." << std::endl;
this->frame_id = element->Get<std::string>("ignition_frame_id");
}
else
{
this->frame_id = this->name;
}
this->frame_id = this->name;
}
}

Expand Down
25 changes: 0 additions & 25 deletions src/SensorFactory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@ class gz::sensors::SensorFactoryPrivate
using namespace gz;
using namespace sensors;

//////////////////////////////////////////////////
void SensorFactory::AddPluginPaths(const std::string &)
{
gzwarn << "Trying to add plugin paths, but Gazebo Sensors doesn't support"
<< " plugins anymore." << std::endl;
}

//////////////////////////////////////////////////
SensorFactory::SensorFactory() : dataPtr(new SensorFactoryPrivate)
{
Expand All @@ -43,21 +36,3 @@ SensorFactory::SensorFactory() : dataPtr(new SensorFactoryPrivate)
SensorFactory::~SensorFactory()
{
}

/////////////////////////////////////////////////
std::unique_ptr<Sensor> SensorFactory::CreateSensor(const sdf::Sensor &)
{
gzwarn << "Trying to create sensor without providing sensor type. Gazebo"
<< " Sensors doesn't support sensor registration anymore. Use the"
<< " templated `CreateSensor` function instead." << std::endl;
return nullptr;
}

/////////////////////////////////////////////////
std::unique_ptr<Sensor> SensorFactory::CreateSensor(sdf::ElementPtr)
{
gzwarn << "Trying to create sensor without providing sensor type. Gazebo"
<< " Sensors doesn't support sensor registration anymore. Use the"
<< " templated `CreateSensor` function instead." << std::endl;
return nullptr;
}
15 changes: 2 additions & 13 deletions src/Util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,8 @@ std::string gz::sensors::customType(sdf::ElementPtr _sdf)

if (!_sdf->HasAttribute("gz:type"))
{
// TODO(CH3): Deprecated. Remove on tock.
// Try deprecated ignition:type attribute if gz:type attribute is missing
if (_sdf->HasAttribute("ignition:type"))
{
gzwarn << "The `ignition:type` attribute is deprecated. Please use "
<< "`gz:type` instead." << std::endl;
return _sdf->Get<std::string>("ignition:type");
}
else
{
gzerr << "Custom sensor missing `gz:type` attribute." << std::endl;
return std::string();
}
gzerr << "Custom sensor missing `gz:type` attribute." << std::endl;
return std::string();
}

return _sdf->Get<std::string>("gz:type");
Expand Down

0 comments on commit 2acd508

Please sign in to comment.