diff --git a/src/modules/simulation/gz_bridge/GZBridge.cpp b/src/modules/simulation/gz_bridge/GZBridge.cpp index ddf54a36cc..3ef65e186f 100644 --- a/src/modules/simulation/gz_bridge/GZBridge.cpp +++ b/src/modules/simulation/gz_bridge/GZBridge.cpp @@ -90,32 +90,46 @@ int GZBridge::init() } // OPTIONAL: - if (!subscribeNavsat(false)) { - return PX4_ERROR; + if (_sim_gz_en_gps.get()) { + if (!subscribeNavsat(false)) { + return PX4_ERROR; + } } - if (!subscribeAirPressure(false)) { - return PX4_ERROR; + if (_sim_gz_en_baro.get()) { + if (!subscribeAirPressure(false)) { + return PX4_ERROR; + } } - if (!subscribeDistanceSensor(false)) { - return PX4_ERROR; + if (_sim_gz_en_lidar.get()) { + if (!subscribeDistanceSensor(false)) { + return PX4_ERROR; + } } - if (!subscribeAirspeed(false)) { - return PX4_ERROR; + if (_sim_gz_en_aspd.get()) { + if (!subscribeAirspeed(false)) { + return PX4_ERROR; + } } - if (!subscribeOpticalFlow(false)) { - return PX4_ERROR; + if (_sim_gz_en_flow.get()) { + if (!subscribeOpticalFlow(false)) { + return PX4_ERROR; + } } - if (!subscribeOdometry(false)) { - return PX4_ERROR; + if (_sim_gz_en_odom.get()) { + if (!subscribeOdometry(false)) { + return PX4_ERROR; + } } - if (!subscribeLaserScan(false)) { - return PX4_ERROR; + if (_sim_gz_en_lidar.get()) { + if (!subscribeLaserScan(false)) { + return PX4_ERROR; + } } // ESC mixing interface diff --git a/src/modules/simulation/gz_bridge/GZBridge.hpp b/src/modules/simulation/gz_bridge/GZBridge.hpp index 39dccb44af..9f90f4dfea 100644 --- a/src/modules/simulation/gz_bridge/GZBridge.hpp +++ b/src/modules/simulation/gz_bridge/GZBridge.hpp @@ -194,6 +194,12 @@ private: const float _vel_markov_time = 0.85f; // Velocity Markov process coefficient DEFINE_PARAMETERS( - (ParamInt) _sim_gps_used + (ParamInt) _sim_gps_used, + (ParamInt) _sim_gz_en_lidar, + (ParamInt) _sim_gz_en_flow, + (ParamInt) _sim_gz_en_aspd, + (ParamInt) _sim_gz_en_baro, + (ParamInt) _sim_gz_en_odom, + (ParamInt) _sim_gz_en_gps ) }; diff --git a/src/modules/simulation/gz_bridge/parameters.c b/src/modules/simulation/gz_bridge/parameters.c index 26f874e893..0616da562f 100644 --- a/src/modules/simulation/gz_bridge/parameters.c +++ b/src/modules/simulation/gz_bridge/parameters.c @@ -39,3 +39,69 @@ * @group UAVCAN */ PARAM_DEFINE_INT32(SIM_GZ_EN, 0); + +/** + * Enable laser/lidar sensors in Gazebo bridge + * + * @boolean + * @reboot_required true + * @group Simulation + * @value 0 Disabled + * @value 1 Enabled + */ +PARAM_DEFINE_INT32(SIM_GZ_EN_LIDAR, 1); + +/** + * Enable optical flow sensor in Gazebo bridge + * + * @boolean + * @reboot_required true + * @group Simulation + * @value 0 Disabled + * @value 1 Enabled + */ +PARAM_DEFINE_INT32(SIM_GZ_EN_FLOW, 1); + +/** + * Enable airspeed sensor in Gazebo bridge + * + * @boolean + * @reboot_required true + * @group Simulation + * @value 0 Disabled + * @value 1 Enabled + */ +PARAM_DEFINE_INT32(SIM_GZ_EN_ASPD, 1); + +/** + * Enable barometer/air pressure sensor in Gazebo bridge + * + * @boolean + * @reboot_required true + * @group Simulation + * @value 0 Disabled + * @value 1 Enabled + */ +PARAM_DEFINE_INT32(SIM_GZ_EN_BARO, 1); + +/** + * Enable odometry in Gazebo bridge + * + * @boolean + * @reboot_required true + * @group Simulation + * @value 0 Disabled + * @value 1 Enabled + */ +PARAM_DEFINE_INT32(SIM_GZ_EN_ODOM, 1); + +/** + * Enable GPS/NavSat sensor in Gazebo bridge + * + * @boolean + * @reboot_required true + * @group Simulation + * @value 0 Disabled + * @value 1 Enabled + */ +PARAM_DEFINE_INT32(SIM_GZ_EN_GPS, 1);