Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change default update rate to 200 Hz #474

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/gazebo_mavlink_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ class GazeboMavlinkInterface : public ModelPlugin {
double groundtruth_lon_rad;
double groundtruth_altitude;

double imu_update_interval_ = 0.004; ///< Used for non-lockstep
double imu_update_interval_ = 0.005; ///< Used for non-lockstep

ignition::math::Vector3d gravity_W_;
ignition::math::Vector3d velocity_prev_W_;
Expand Down
12 changes: 6 additions & 6 deletions src/gazebo_mavlink_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,18 +303,18 @@ void GazeboMavlinkInterface::Load(physics::ModelPtr _model, sdf::ElementPtr _sdf
#endif
presetManager->CurrentProfile("default_physics");

// We currently need to have the real_time_update_rate at a multiple of 250 Hz for lockstep.
// Also, the max_step_size needs to match this (e.g. 0.004 s at 250 Hz or 0.002 s at 500 Hz).
// We currently need to have the real_time_update_rate at a multiple of 200 Hz for lockstep.
// Also, the max_step_size needs to match this (e.g. 0.005 s at 200 Hz or 0.0025 s at 400 Hz).
// Therefore we check these params and abort if they won't work.

presetManager->GetCurrentProfileParam("real_time_update_rate", param);
double real_time_update_rate = boost::any_cast<double>(param);
const int real_time_update_rate_int = static_cast<int>(real_time_update_rate + 0.5);

if (real_time_update_rate_int % 250 != 0)
if (real_time_update_rate_int % 200 != 0)
{
gzerr << "real_time_update_rate is " << real_time_update_rate_int
<< " but needs to be multiple of 250 Hz, aborting.\n";
<< " but needs to be multiple of 200 Hz, aborting.\n";
abort();
}

Expand All @@ -328,7 +328,7 @@ void GazeboMavlinkInterface::Load(physics::ModelPtr _model, sdf::ElementPtr _sdf
abort();
}

update_skip_factor_ = real_time_update_rate_int / 250;
update_skip_factor_ = real_time_update_rate_int / 200;

// Adapt the real_time_update_rate according to the speed
// that we ask for in the env variable.
Expand Down Expand Up @@ -648,7 +648,7 @@ void GazeboMavlinkInterface::OnUpdate(const common::UpdateInfo& /*_info*/) {

previous_imu_seq_ = last_imu_message_.seq();

// Always run at 250 Hz. At 500 Hz, the skip factor should be 2, at 1000 Hz 4.
// Always run at 200 Hz. At 400 Hz, the skip factor should be 2, at 1000 Hz 5.
if (!(previous_imu_seq_ % update_skip_factor_ == 0)) {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions worlds/baylands.world
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
<contact_surface_layer>0.001</contact_surface_layer>
</constraints>
</ode>
<max_step_size>0.004</max_step_size>
<max_step_size>0.005</max_step_size>
<real_time_factor>1</real_time_factor>
<real_time_update_rate>250</real_time_update_rate>
<real_time_update_rate>200</real_time_update_rate>
<magnetic_field>6.0e-6 2.3e-5 -4.2e-5</magnetic_field>
</physics>
</world>
Expand Down
4 changes: 2 additions & 2 deletions worlds/boat.world
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
<contact_surface_layer>0.001</contact_surface_layer>
</constraints>
</ode>
<max_step_size>0.004</max_step_size>
<max_step_size>0.005</max_step_size>
<real_time_factor>1</real_time_factor>
<real_time_update_rate>250</real_time_update_rate>
<real_time_update_rate>200</real_time_update_rate>
<magnetic_field>6.0e-6 2.3e-5 -4.2e-5</magnetic_field>
</physics>
</world>
Expand Down
4 changes: 2 additions & 2 deletions worlds/empty.world
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
<contact_surface_layer>0.001</contact_surface_layer>
</constraints>
</ode>
<max_step_size>0.004</max_step_size>
<max_step_size>0.005</max_step_size>
<real_time_factor>1</real_time_factor>
<real_time_update_rate>250</real_time_update_rate>
<real_time_update_rate>200</real_time_update_rate>
<magnetic_field>6.0e-6 2.3e-5 -4.2e-5</magnetic_field>
</physics>
</world>
Expand Down
4 changes: 2 additions & 2 deletions worlds/hippocampus.world
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
<contact_surface_layer>0.001</contact_surface_layer>
</constraints>
</ode>
<max_step_size>0.004</max_step_size>
<max_step_size>0.005</max_step_size>
<real_time_factor>1</real_time_factor>
<real_time_update_rate>250</real_time_update_rate>
<real_time_update_rate>200</real_time_update_rate>
<magnetic_field>6.0e-6 2.3e-5 -4.2e-5</magnetic_field>
</physics>
</world>
Expand Down
4 changes: 2 additions & 2 deletions worlds/iris_irlock.world
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
<contact_surface_layer>0.001</contact_surface_layer>
</constraints>
</ode>
<max_step_size>0.004</max_step_size>
<max_step_size>0.005</max_step_size>
<real_time_factor>1</real_time_factor>
<real_time_update_rate>250</real_time_update_rate>
<real_time_update_rate>200</real_time_update_rate>
<magnetic_field>6.0e-6 2.3e-5 -4.2e-5</magnetic_field>
</physics>

Expand Down
4 changes: 2 additions & 2 deletions worlds/ksql_airport.world
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
<contact_surface_layer>0.001</contact_surface_layer>
</constraints>
</ode>
<max_step_size>0.004</max_step_size>
<max_step_size>0.005</max_step_size>
<real_time_factor>1</real_time_factor>
<real_time_update_rate>250</real_time_update_rate>
<real_time_update_rate>200</real_time_update_rate>
<magnetic_field>6.0e-6 2.3e-5 -4.2e-5</magnetic_field>
</physics>
</world>
Expand Down
4 changes: 2 additions & 2 deletions worlds/mcmillan_airfield.world
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
<contact_surface_layer>0.001</contact_surface_layer>
</constraints>
</ode>
<max_step_size>0.004</max_step_size>
<max_step_size>0.005</max_step_size>
<real_time_factor>1</real_time_factor>
<real_time_update_rate>250</real_time_update_rate>
<real_time_update_rate>200</real_time_update_rate>
<magnetic_field>6.0e-6 2.3e-5 -4.2e-5</magnetic_field>
</physics>
</world>
Expand Down
4 changes: 2 additions & 2 deletions worlds/sonoma_raceway.world
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
<contact_surface_layer>0.001</contact_surface_layer>
</constraints>
</ode>
<max_step_size>0.004</max_step_size>
<max_step_size>0.005</max_step_size>
<real_time_factor>1</real_time_factor>
<real_time_update_rate>250</real_time_update_rate>
<real_time_update_rate>200</real_time_update_rate>
<magnetic_field>6.0e-6 2.3e-5 -4.2e-5</magnetic_field>
</physics>
</world>
Expand Down
4 changes: 2 additions & 2 deletions worlds/typhoon_h480.world
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
<contact_surface_layer>0.001</contact_surface_layer>
</constraints>
</ode>
<max_step_size>0.004</max_step_size>
<max_step_size>0.005</max_step_size>
<real_time_factor>1</real_time_factor>
<real_time_update_rate>250</real_time_update_rate>
<real_time_update_rate>200</real_time_update_rate>
<magnetic_field>6.0e-6 2.3e-5 -4.2e-5</magnetic_field>
</physics>
</world>
Expand Down
4 changes: 2 additions & 2 deletions worlds/uuv_hippocampus.world
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@
<contact_surface_layer>0.001</contact_surface_layer>
</constraints>
</ode>
<max_step_size>0.004</max_step_size>
<max_step_size>0.005</max_step_size>
<real_time_factor>1</real_time_factor>
<real_time_update_rate>250</real_time_update_rate>
<real_time_update_rate>200</real_time_update_rate>
<magnetic_field>6.0e-6 2.3e-5 -4.2e-5</magnetic_field>
</physics>
</world>
Expand Down
4 changes: 2 additions & 2 deletions worlds/warehouse.world
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
<contact_surface_layer>0.001</contact_surface_layer>
</constraints>
</ode>
<max_step_size>0.004</max_step_size>
<max_step_size>0.005</max_step_size>
<real_time_factor>1</real_time_factor>
<real_time_update_rate>250</real_time_update_rate>
<real_time_update_rate>200</real_time_update_rate>
<magnetic_field>6.0e-6 2.3e-5 -4.2e-5</magnetic_field>
</physics>

Expand Down
4 changes: 2 additions & 2 deletions worlds/yosemite.world
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
<contact_surface_layer>0.001</contact_surface_layer>
</constraints>
</ode>
<max_step_size>0.004</max_step_size>
<max_step_size>0.005</max_step_size>
<real_time_factor>1</real_time_factor>
<real_time_update_rate>250</real_time_update_rate>
<real_time_update_rate>200</real_time_update_rate>
<magnetic_field>6.0e-6 2.3e-5 -4.2e-5</magnetic_field>
</physics>
</world>
Expand Down