Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove plugin interface and support custom sensors #90

Merged
merged 22 commits into from
Aug 12, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ Deprecated code produces compile-time warnings. These warning serve as
notification to users that their code should be upgraded. The next major
release will remove the deprecated code.

## Ignition Sensors 4.X to 5.X

* Plugins now use Ignition Plugin instead of Ignition Common's plugin framework.
* Macro `IGN_SENSORS_REGISTER_SENSOR` has been removed. Use `IGNITION_ADD_PLUGIN` instead.
+ ***Deprecation*** IGN_SENSORS_REGISTER_SENSOR(SensorName)
+ ***Replacement*** IGNITION_ADD_PLUGIN(ignition::sensors::SensorTypePlugin<SensorName>, ignition::sensors::SensorPlugin)
* Use `#include <ignition/plugin/Register.hh>`
* Privately link against `ignition-plugin${IGN_PLUGIN_VER}::register`

## Ignition Sensors 3.X to 4.X

Expand Down
1 change: 0 additions & 1 deletion include/ignition/sensors/CameraSensor.hh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

#include <sdf/sdf.hh>

#include <ignition/common/PluginMacros.hh>
#include <ignition/common/SuppressWarning.hh>
#include <ignition/common/Time.hh>

Expand Down
1 change: 0 additions & 1 deletion include/ignition/sensors/DepthCameraSensor.hh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <sdf/sdf.hh>

#include <ignition/common/Event.hh>
#include <ignition/common/PluginMacros.hh>
#include <ignition/common/SuppressWarning.hh>
#include <ignition/common/Time.hh>

Expand Down
1 change: 0 additions & 1 deletion include/ignition/sensors/LogicalCameraSensor.hh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

#include <sdf/sdf.hh>

#include <ignition/common/PluginMacros.hh>
#include <ignition/common/SuppressWarning.hh>
#include <ignition/common/Time.hh>

Expand Down
10 changes: 0 additions & 10 deletions include/ignition/sensors/SensorFactory.hh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <sdf/sdf.hh>

#include <ignition/common/Console.hh>
#include <ignition/common/PluginMacros.hh>
#include <ignition/common/SuppressWarning.hh>

#include <ignition/sensors/config.hh>
Expand All @@ -43,9 +42,6 @@ namespace ignition
/// \brief Base sensor plugin interface
class IGNITION_SENSORS_VISIBLE SensorPlugin
{
/// \brief Allows using shorter APIS in common::PluginLoader
public: IGN_COMMON_SPECIALIZE_INTERFACE(ignition::sensors::SensorPlugin)

/// \brief Instantiate new sensor
/// \return New sensor
public: virtual Sensor *New() = 0;
Expand Down Expand Up @@ -182,12 +178,6 @@ namespace ignition
private: std::unique_ptr<SensorFactoryPrivate> dataPtr;
IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING
};

/// \brief Sensor registration macro
#define IGN_SENSORS_REGISTER_SENSOR(classname) \
IGN_COMMON_REGISTER_SINGLE_PLUGIN(\
ignition::sensors::SensorTypePlugin<classname>, \
ignition::sensors::SensorPlugin)
}
}
}
Expand Down
1 change: 0 additions & 1 deletion include/ignition/sensors/ThermalCameraSensor.hh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <sdf/sdf.hh>

#include <ignition/common/Event.hh>
#include <ignition/common/PluginMacros.hh>
#include <ignition/common/SuppressWarning.hh>
#include <ignition/common/Time.hh>

Expand Down
5 changes: 4 additions & 1 deletion src/AirPressureSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#endif

#include <ignition/common/Profiler.hh>
#include <ignition/plugin/Register.hh>
#include <ignition/transport/Node.hh>

#include "ignition/sensors/GaussianNoiseModel.hh"
Expand Down Expand Up @@ -224,4 +225,6 @@ double AirPressureSensor::ReferenceAltitude() const
return this->dataPtr->referenceAltitude;
}

IGN_SENSORS_REGISTER_SENSOR(AirPressureSensor)
IGNITION_ADD_PLUGIN(
ignition::sensors::SensorTypePlugin<AirPressureSensor>,
ignition::sensors::SensorPlugin)
5 changes: 4 additions & 1 deletion src/AltimeterSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

#include <ignition/common/Profiler.hh>
#include <ignition/plugin/Register.hh>
#include <ignition/transport/Node.hh>

#include "ignition/sensors/AltimeterSensor.hh"
Expand Down Expand Up @@ -219,4 +220,6 @@ double AltimeterSensor::VerticalVelocity() const
return this->dataPtr->verticalVelocity;
}

IGN_SENSORS_REGISTER_SENSOR(AltimeterSensor)
IGNITION_ADD_PLUGIN(
ignition::sensors::SensorTypePlugin<ignition::sensors::AltimeterSensor>,
ignition::sensors::SensorPlugin)
24 changes: 24 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
sdformat${SDF_VER}::sdformat${SDF_VER}
PRIVATE
ignition-common${IGN_COMMON_VER}::profiler
ignition-plugin${IGN_PLUGIN_VER}::loader
)
target_compile_definitions(${PROJECT_LIBRARY_TARGET_NAME} PUBLIC DepthPoints_EXPORTS)

Expand All @@ -62,6 +63,7 @@ target_link_libraries(${camera_target}
${rendering_target}
PRIVATE
ignition-msgs${IGN_MSGS_VER}::ignition-msgs${IGN_MSGS_VER}
ignition-plugin${IGN_PLUGIN_VER}::register
ignition-transport${IGN_TRANSPORT_VER}::ignition-transport${IGN_TRANSPORT_VER}
)

Expand All @@ -72,6 +74,7 @@ target_link_libraries(${depth_camera_target}
PRIVATE
${camera_target}
ignition-msgs${IGN_MSGS_VER}::ignition-msgs${IGN_MSGS_VER}
ignition-plugin${IGN_PLUGIN_VER}::register
ignition-transport${IGN_TRANSPORT_VER}::ignition-transport${IGN_TRANSPORT_VER}
)

Expand All @@ -83,6 +86,7 @@ target_link_libraries(${lidar_target}
${rendering_target}
PRIVATE
ignition-msgs${IGN_MSGS_VER}::ignition-msgs${IGN_MSGS_VER}
ignition-plugin${IGN_PLUGIN_VER}::register
ignition-transport${IGN_TRANSPORT_VER}::ignition-transport${IGN_TRANSPORT_VER}
)

Expand All @@ -92,6 +96,7 @@ target_compile_definitions(${gpu_lidar_target} PUBLIC GpuLidarSensor_EXPORTS)
target_link_libraries(${gpu_lidar_target}
PRIVATE
ignition-msgs${IGN_MSGS_VER}::ignition-msgs${IGN_MSGS_VER}
ignition-plugin${IGN_PLUGIN_VER}::register
ignition-transport${IGN_TRANSPORT_VER}::ignition-transport${IGN_TRANSPORT_VER}
${lidar_target}
)
Expand All @@ -102,20 +107,37 @@ target_compile_definitions(${logical_camera_target} PUBLIC LogicalCameraSensor_E
target_link_libraries(${logical_camera_target}
PRIVATE
ignition-msgs${IGN_MSGS_VER}::ignition-msgs${IGN_MSGS_VER}
ignition-plugin${IGN_PLUGIN_VER}::register
ignition-transport${IGN_TRANSPORT_VER}::ignition-transport${IGN_TRANSPORT_VER}
)

set(magnetometer_sources MagnetometerSensor.cc)
ign_add_component(magnetometer SOURCES ${magnetometer_sources} GET_TARGET_NAME magnetometer_target)
target_link_libraries(${magnetometer_target}
PRIVATE
ignition-plugin${IGN_PLUGIN_VER}::register
)

set(imu_sources ImuSensor.cc)
ign_add_component(imu SOURCES ${imu_sources} GET_TARGET_NAME imu_target)
target_link_libraries(${imu_target}
PRIVATE
ignition-plugin${IGN_PLUGIN_VER}::register
)

set(altimeter_sources AltimeterSensor.cc)
ign_add_component(altimeter SOURCES ${altimeter_sources} GET_TARGET_NAME altimeter_target)
target_link_libraries(${altimeter_target}
PRIVATE
ignition-plugin${IGN_PLUGIN_VER}::register
)

set(air_pressure_sources AirPressureSensor.cc)
ign_add_component(air_pressure SOURCES ${air_pressure_sources} GET_TARGET_NAME air_pressure_target)
target_link_libraries(${air_pressure_target}
PRIVATE
ignition-plugin${IGN_PLUGIN_VER}::register
)

set(rgbd_camera_sources RgbdCameraSensor.cc)
ign_add_component(rgbd_camera SOURCES ${rgbd_camera_sources} GET_TARGET_NAME rgbd_camera_target)
Expand All @@ -124,6 +146,7 @@ target_link_libraries(${rgbd_camera_target}
PRIVATE
${camera_target}
ignition-msgs${IGN_MSGS_VER}::ignition-msgs${IGN_MSGS_VER}
ignition-plugin${IGN_PLUGIN_VER}::register
ignition-transport${IGN_TRANSPORT_VER}::ignition-transport${IGN_TRANSPORT_VER}
)

Expand All @@ -133,6 +156,7 @@ target_link_libraries(${thermal_camera_target}
PRIVATE
${camera_target}
ignition-msgs${IGN_MSGS_VER}::ignition-msgs${IGN_MSGS_VER}
ignition-plugin${IGN_PLUGIN_VER}::register
ignition-transport${IGN_TRANSPORT_VER}::ignition-transport${IGN_TRANSPORT_VER}
)

Expand Down
5 changes: 4 additions & 1 deletion src/CameraSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <ignition/common/StringUtils.hh>
#include <ignition/math/Angle.hh>
#include <ignition/math/Helpers.hh>
#include <ignition/plugin/Register.hh>
#include <ignition/transport/Node.hh>

#include "ignition/sensors/CameraSensor.hh"
Expand Down Expand Up @@ -647,4 +648,6 @@ double CameraSensor::Baseline() const
return this->dataPtr->baseline;
}

IGN_SENSORS_REGISTER_SENSOR(CameraSensor)
IGNITION_ADD_PLUGIN(
ignition::sensors::SensorTypePlugin<CameraSensor>,
ignition::sensors::SensorPlugin)
6 changes: 5 additions & 1 deletion src/DepthCameraSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
#include <ignition/math/Angle.hh>
#include <ignition/math/Helpers.hh>

#include <ignition/plugin/Register.hh>

#include <ignition/transport/Node.hh>

#include "ignition/sensors/DepthCameraSensor.hh"
Expand Down Expand Up @@ -632,4 +634,6 @@ double DepthCameraSensor::NearClip() const
return this->dataPtr->near;
}

IGN_SENSORS_REGISTER_SENSOR(DepthCameraSensor)
IGNITION_ADD_PLUGIN(
ignition::sensors::SensorTypePlugin<DepthCameraSensor>,
ignition::sensors::SensorPlugin)
5 changes: 4 additions & 1 deletion src/GpuLidarSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <ignition/common/Console.hh>
#include <ignition/common/Profiler.hh>
#include <ignition/msgs/Utility.hh>
#include <ignition/plugin/Register.hh>
#include <ignition/transport/Node.hh>

#include "ignition/sensors/GpuLidarSensor.hh"
Expand Down Expand Up @@ -372,4 +373,6 @@ void GpuLidarSensorPrivate::FillPointCloudMsg()
}
}

IGN_SENSORS_REGISTER_SENSOR(GpuLidarSensor)
IGNITION_ADD_PLUGIN(
ignition::sensors::SensorTypePlugin<GpuLidarSensor>,
ignition::sensors::SensorPlugin)
5 changes: 4 additions & 1 deletion src/ImuSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#endif

#include <ignition/common/Profiler.hh>
#include <ignition/plugin/Register.hh>
#include <ignition/transport/Node.hh>

#include "ignition/sensors/ImuSensor.hh"
Expand Down Expand Up @@ -302,4 +303,6 @@ math::Quaterniond ImuSensor::Orientation() const
return this->dataPtr->orientation;
}

IGN_SENSORS_REGISTER_SENSOR(ImuSensor)
IGNITION_ADD_PLUGIN(
ignition::sensors::SensorTypePlugin<ImuSensor>,
ignition::sensors::SensorPlugin)
5 changes: 4 additions & 1 deletion src/Lidar.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <ignition/common/Console.hh>
#include <ignition/common/Event.hh>
#include <ignition/common/Profiler.hh>
#include <ignition/plugin/Register.hh>
#include <ignition/transport/Node.hh>
#include <sdf/Lidar.hh>

Expand Down Expand Up @@ -448,4 +449,6 @@ bool Lidar::IsActive() const
return true;
}

IGN_SENSORS_REGISTER_SENSOR(Lidar)
IGNITION_ADD_PLUGIN(
ignition::sensors::SensorTypePlugin<Lidar>,
ignition::sensors::SensorPlugin)
9 changes: 5 additions & 4 deletions src/LogicalCameraSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@

#include <ignition/common/Console.hh>
#include <ignition/common/Profiler.hh>

#include <ignition/transport/Node.hh>

#include <ignition/math/Frustum.hh>
#include <ignition/math/Helpers.hh>
#include <ignition/plugin/Register.hh>
#include <ignition/transport/Node.hh>

#include "ignition/sensors/SensorFactory.hh"
#include "ignition/sensors/LogicalCameraSensor.hh"
Expand Down Expand Up @@ -209,4 +208,6 @@ msgs::LogicalCameraImage LogicalCameraSensor::Image() const
return this->dataPtr->msg;
}

IGN_SENSORS_REGISTER_SENSOR(LogicalCameraSensor)
IGNITION_ADD_PLUGIN(
ignition::sensors::SensorTypePlugin<LogicalCameraSensor>,
ignition::sensors::SensorPlugin)
5 changes: 4 additions & 1 deletion src/MagnetometerSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#endif

#include <ignition/common/Profiler.hh>
#include <ignition/plugin/Register.hh>
#include <ignition/transport/Node.hh>
#include <sdf/Magnetometer.hh>

Expand Down Expand Up @@ -238,4 +239,6 @@ math::Vector3d MagnetometerSensor::MagneticField() const
return this->dataPtr->localField;
}

IGN_SENSORS_REGISTER_SENSOR(MagnetometerSensor)
IGNITION_ADD_PLUGIN(
ignition::sensors::SensorTypePlugin<MagnetometerSensor>,
ignition::sensors::SensorPlugin)
2 changes: 0 additions & 2 deletions src/Manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
#include "ignition/sensors/Manager.hh"
#include <memory>
#include <unordered_map>
#include <ignition/common/PluginLoader.hh>
#include <ignition/common/Plugin.hh>
#include <ignition/common/Profiler.hh>
#include <ignition/common/SystemPaths.hh>
#include <ignition/common/Console.hh>
Expand Down
5 changes: 4 additions & 1 deletion src/RgbdCameraSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#pragma warning(pop)
#endif

#include <ignition/plugin/Register.hh>
#include <ignition/transport/Node.hh>

#include <sdf/Sensor.hh>
Expand Down Expand Up @@ -609,4 +610,6 @@ unsigned int RgbdCameraSensor::ImageHeight() const
return this->dataPtr->depthCamera->ImageHeight();
}

IGN_SENSORS_REGISTER_SENSOR(RgbdCameraSensor)
IGNITION_ADD_PLUGIN(
ignition::sensors::SensorTypePlugin<RgbdCameraSensor>,
ignition::sensors::SensorPlugin)
Loading