Skip to content

Commit 3eddbce

Browse files
committed
gz: print version number in init, remove gst plugin spam, rename function
1 parent effb9de commit 3eddbce

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

ROMFS/px4fmu_common/init.d-posix/px4-rc.gzsim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#!/bin/sh
22
# shellcheck disable=SC2154
33

4-
echo "INFO [init] Gazebo simulator"
5-
64
# Enforce minimum gz version as Harmonic (gz-sim8)
75
MIN_GZ_VERSION="8.0.0"
86
GZ_SIM_VERSION=$(gz sim --versions 2>/dev/null | head -n 1 | tr -d ' ')
@@ -17,14 +15,16 @@ if [ "$(printf '%s\n' "$GZ_SIM_VERSION" "$MIN_GZ_VERSION" | sort -V | head -n1)"
1715
gz_command="gz"
1816
gz_sub_command="sim"
1917

18+
echo "INFO [init] Gazebo simulator $GZ_SIM_VERSION"
19+
2020
# Specify render engine if `GZ_SIM_RENDER_ENGINE` is set
2121
# (for example, if you want to use Ogre 1.x instead of Ogre 2.x):
2222
if [ -n "${PX4_GZ_SIM_RENDER_ENGINE}" ]; then
2323
echo "INFO [init] Setting Gazebo render engine to '${PX4_GZ_SIM_RENDER_ENGINE}'!"
2424
gz_sub_command="${gz_sub_command} --render-engine ${PX4_GZ_SIM_RENDER_ENGINE}"
2525
fi
2626
else
27-
echo "ERROR [init] Gazebo gz sim version is too old ($GZ_SIM_VERSION). Minimum required version is $MIN_GZ_VERSION"
27+
echo "ERROR [init] Gazebo version too hold ($GZ_SIM_VERSION). Minimum required version is $MIN_GZ_VERSION"
2828
exit 1
2929
fi
3030

src/modules/simulation/gz_bridge/GZBridge.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
#include <iostream>
4444
#include <string>
4545

46+
static float generate_wgn();
47+
4648
GZBridge::GZBridge(const std::string &world, const std::string &model_name) :
4749
ModuleParams(nullptr),
4850
ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::rate_ctrl),
@@ -130,7 +132,7 @@ int GZBridge::init()
130132
std::string air_pressure_topic = "/world/" + _world_name + "/model/" + _model_name +
131133
"/link/base_link/sensor/air_pressure_sensor/air_pressure";
132134

133-
if (!_node.Subscribe(air_pressure_topic, &GZBridge::barometerCallback, this)) {
135+
if (!_node.Subscribe(air_pressure_topic, &GZBridge::airPressureCallback, this)) {
134136
PX4_ERR("failed to subscribe to %s", air_pressure_topic.c_str());
135137
return PX4_ERROR;
136138
}
@@ -254,7 +256,7 @@ void GZBridge::magnetometerCallback(const gz::msgs::Magnetometer &msg)
254256
_sensor_mag_pub.publish(report);
255257
}
256258

257-
void GZBridge::barometerCallback(const gz::msgs::FluidPressure &msg)
259+
void GZBridge::airPressureCallback(const gz::msgs::FluidPressure &msg)
258260
{
259261
const uint64_t timestamp = hrt_absolute_time();
260262

@@ -495,7 +497,7 @@ void GZBridge::odometryCallback(const gz::msgs::OdometryWithCovariance &msg)
495497
_visual_odometry_pub.publish(report);
496498
}
497499

498-
static float generate_wgn()
500+
float generate_wgn()
499501
{
500502
// generate white Gaussian noise sample with std=1
501503

src/modules/simulation/gz_bridge/GZBridge.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class GZBridge : public ModuleBase<GZBridge>, public ModuleParams, public px4::S
110110

111111
void clockCallback(const gz::msgs::Clock &msg);
112112
void airspeedCallback(const gz::msgs::AirSpeed &msg);
113-
void barometerCallback(const gz::msgs::FluidPressure &msg);
113+
void airPressureCallback(const gz::msgs::FluidPressure &msg);
114114
void imuCallback(const gz::msgs::IMU &msg);
115115
void poseInfoCallback(const gz::msgs::Pose_V &msg);
116116
void odometryCallback(const gz::msgs::OdometryWithCovariance &msg);

src/modules/simulation/gz_plugins/gstreamer/GstCameraSystem.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,6 @@ void GstCameraSystem::findCameraTopic()
175175
}
176176
}
177177
}
178-
179-
if (!_initialized) {
180-
gzdbg << "No camera topics found yet, will check again next update" << std::endl;
181-
}
182178
}
183179

184180
//////////////////////////////////////////////////

0 commit comments

Comments
 (0)