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

Set initial sim time from the command-line #3294

Merged
merged 7 commits into from
Feb 3, 2023

Conversation

audrow
Copy link
Contributor

@audrow audrow commented Jan 30, 2023

This PR adds the --initial_sim_time flag to gzserver. If the flag and a value is not provided, the behavior is not changed. This works with large times, such as epoch time and floating point numbers (see the test).

FYI @scpeters

Signed-off-by: Audrow Nash <audrow.j.nash@nasa.gov>
Signed-off-by: Audrow Nash <audrow.j.nash@nasa.gov>
Signed-off-by: Audrow Nash <audrow.j.nash@nasa.gov>
@scpeters
Copy link
Member

scpeters commented Feb 1, 2023

This PR adds the --initial_sim_time flag to gzserver.

I didn't realize that our gzserver CLI flags use _ as a separator. It makes sense to keep this patter, but I'm glad that gz-sim is using --initial-sim-time instead of --initial_sim_time

Copy link
Member

@scpeters scpeters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM other than a few minor comments

gazebo/Server.cc Outdated
@@ -194,6 +194,8 @@ bool Server::ParseArgs(int _argc, char **_argv)
"Absolute path in which to store state data")
("record_period", po::value<double>()->default_value(-1),
"Recording period (seconds).")
("initial_sim_time", po::value<double>(),
"Initial simulation time (seconds).")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the order of these arguments determines the formatting of the help string, so I would move this out of the middle of the record_* arguments to be next to iters

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 5cc4db3.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks; I pushed it one more line in 7f872b4

test/integration/world_with_initial_sim_time_from_cli.cc Outdated Show resolved Hide resolved
test/integration/world_with_initial_sim_time_from_cli.cc Outdated Show resolved Hide resolved
Signed-off-by: Audrow Nash <audrow.j.nash@nasa.gov>
Signed-off-by: Audrow Nash <audrow.j.nash@nasa.gov>
@audrow audrow requested a review from scpeters February 1, 2023 18:34
audrow and others added 2 commits February 1, 2023 10:36
Signed-off-by: Audrow Nash <audrow.j.nash@nasa.gov>
Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Copy link
Member

@scpeters scpeters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll merge after reviewing the CI results

@scpeters scpeters merged commit 86105ad into gazebosim:gazebo11 Feb 3, 2023
scpeters added a commit to ros-simulation/gazebo_ros_pkgs that referenced this pull request Mar 1, 2023
Expose gzserver CLI parameter added in
gazebosim/gazebo-classic#3294.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
scpeters added a commit to ros-simulation/gazebo_ros_pkgs that referenced this pull request Mar 2, 2023
Expose gzserver CLI parameter added in
gazebosim/gazebo-classic#3294.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
scpeters added a commit to ros-simulation/gazebo_ros_pkgs that referenced this pull request Mar 3, 2023
Expose gzserver CLI parameter added in
gazebosim/gazebo-classic#3294.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
scpeters added a commit to ros-simulation/gazebo_ros_pkgs that referenced this pull request Mar 3, 2023
Expose gzserver CLI parameter added in
gazebosim/gazebo-classic#3294.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
@peci1
Copy link
Contributor

peci1 commented Jul 3, 2023

Shouldn't this PR also adjust the time that is set in World::ResetTime()?

void World::ResetTime()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants