I have migrated a custom sensor plugin based on ray sensor (from gazebo classic) to a system plugin based on GPU lidar (gzsim - harmonic).

How can I convert this Load() method to gzsim?

void MyCustomSensor::Load(gazebo::sensors::SensorPtr _parent, sdf::ElementPtr _sdf) {
    ray_sensor_ = std::dynamic_pointer_cast<gazebo::sensors::RaySensor>(_parent);

    if (!ray_sensor_) {
        gzthrow("This plugin requires a Ray Sensor as its parent");


    connection_ = ray_sensor_->LaserShape()->ConnectNewLaserScans(
        std::bind(&MyCustomSensor::onNewScans, this));


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.