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