ExampleCustomSensor.cpp
Go to the documentation of this file.
2 #include <gazebo/sensors/SensorFactory.hh>
3 
4 // Do not forget to register your sensor via this block of code.
5 // The first argument is the Gazebo sensor type, which is how you reference the
6 // custom sensor in SDF. It should also match the 'name' attribute in XML plugin
7 // definition (together with the 'sensors/' prefix).
8 using gazebo::sensors::Sensor;
9 using gazebo::sensors::SensorFactory;
10 extern "C"
11 {
12 GZ_REGISTER_STATIC_SENSOR("example_custom_sensor", ExampleCustomSensor)
13 }
14 
15 void gazebo::sensors::ExampleCustomSensor::Load(const std::string &_worldName)
16 {
17  Sensor::Load(_worldName);
18 
19  gzmsg << "Example custom sensor loaded" << std::endl;
20 }
21 
23 {
24  Sensor::Init();
25 
26  gzmsg << "Example custom sensor initialized" << std::endl;
27 }
28 
29 // you can also use other sensor categories
31  : Sensor(gazebo::sensors::SensorCategory::OTHER)
32 {
33 }
34 
gazebo::sensors::ExampleCustomSensor::ExampleCustomSensor
ExampleCustomSensor()
Definition: ExampleCustomSensor.cpp:30
gazebo::sensors::ExampleCustomSensor::Load
void Load(const std::string &_worldName) override
Definition: ExampleCustomSensor.cpp:15
gazebo::sensors::ExampleCustomSensor::Init
void Init() override
Definition: ExampleCustomSensor.cpp:22
gazebo
ExampleCustomSensor.h
gazebo::sensors::ExampleCustomSensor::~ExampleCustomSensor
~ExampleCustomSensor() override


gazebo_custom_sensor_preloader
Author(s): Martin Pecka
autogenerated on Sun Sep 3 2023 02:35:25