Hi,
I would like to have no gps noise in my gazebo sim (not gazebo classic). I have been trying to follow the instructions in Gazebo Simulation | PX4 Guide (main)
I see the instructions on how to eliminate sensor noise for gazebo classic: Gazebo Classic Simulation | PX4 Guide (main)
However the in gazebo sim there is no
<gpsNoise>true</gpsNoise>
in the sdf file. From my understanding the .sdf files of gazebo classic and gazebo sim are not transferable.
I also have been following the instructions in post Eliminating all sensor noise and bias
However based on the instructions, I think this is also for gazebo classic based on the dates of the question.
What I have tried:
in the default.sdf I looked for anything ‘gps’ but could not find anything
I then commented out the following in DataValidator.cpp
//} else if (_value_equal_count > _value_equal_count_threshold) {
// /* we got the exact same sensor value N times in a row */
// _error_mask |= ERROR_FLAG_STALE_DATA;
// ret = 0.0f;
I modified the following lines in SensorGpsSim.cpp
double latitude = gpos.lat; //+ math::degrees((double)generate_wgn() * 0.2 / CONSTANTS_RADIUS_OF_EARTH);
double longitude = gpos.lon; //+ math::degrees((double)generate_wgn() * 0.2 / CONSTANTS_RADIUS_OF_EARTH);
float altitude = gpos.alt; //+ (generate_wgn() * 0.5f);
I modified the following lines in SensorBaroSim.cpp to eliminate the noise and drift (I added and then subtracted the noise so I would not get the build error of a variable not used):
const float absolute_pressure_noisy = absolute_pressure + abs_pressure_noise + _baro_drift_pa - abs_pressure_noise - _baro_drift_pa ;
I could not find the “gazebo_imu_plugin and gazebo_barometer_plugin” in the default.sdf for gazebo sim.
I then did a
make clean
make distclean
make px4_sitl
However, all of this did not work . I feel this should be something simple based on how simple the approach is in the gazebo classic instructions, you just have to eliminate one line in the world .sdf (true).
I am using ubuntu 22
PX4 v 1.14
Gazebo Garden 7.7
If someone could show how to eliminate sensor noise in gazebo sim, I would really appreciate it! Thanks!