-
Notifications
You must be signed in to change notification settings - Fork 269
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
Allow specifying initial simulation time with a CLI argument #1801
Conversation
Signed-off-by: Joan Aguilar Mayans <joan@openrobotics.org>
Signed-off-by: Joan Aguilar Mayans <joan@openrobotics.org>
Signed-off-by: Joan Aguilar Mayans <joan@openrobotics.org>
Signed-off-by: Joan Aguilar Mayans <joan@openrobotics.org>
Signed-off-by: Joan Aguilar Mayans <joan@openrobotics.org>
Signed-off-by: Joan Aguilar Mayans <joan@openrobotics.org>
src/SimulationRunner.cc
Outdated
@@ -122,6 +122,12 @@ SimulationRunner::SimulationRunner(const sdf::World *_world, | |||
static_cast<int>(this->stepSize.count() / this->desiredRtf)); | |||
} | |||
|
|||
// Epoch | |||
// TODO: Decide on chrono precision. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cpplint wants a user assigned to each TODO
Missing username in TODO; it should look like "// TODO(my_username): Stuff." [readability/todo] [2]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was hoping to decide on this before merge. In fact, seeing how updatePeriod
uses nanosecond precision, I'll likely change this to the same precision and remove the TODO. That should also get CI to run a bit further.
Signed-off-by: Joan Aguilar Mayans <joan@openrobotics.org>
Signed-off-by: Joan Aguilar Mayans <joan@openrobotics.org>
Codecov Report
@@ Coverage Diff @@
## gz-sim7 #1801 +/- ##
===========================================
- Coverage 64.68% 64.61% -0.07%
===========================================
Files 343 347 +4
Lines 27430 27731 +301
===========================================
+ Hits 17743 17919 +176
- Misses 9687 9812 +125
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
…l-sim-time-2 Signed-off-by: Joan Aguilar Mayans <joan@openrobotics.org>
Signed-off-by: Joan Aguilar Mayans <joan@openrobotics.org>
Signed-off-by: Joan Aguilar Mayans <joan@openrobotics.org>
This now seems to be working fine on my machine for positive values. Negative values, on the other hand, result in a warning and the clock being reset to -1 ns every time the simulation is paused or reset:
Seeing that I couldn't find a It also seems CI is not particularly happy with the changes. On my last try on my machine (Jammy) I only got one failing test: Jobs: |
I think we shouldn't worry about supporting negative timestamps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to add some tests for this feature.
Signed-off-by: Aditya <aditya050995@gmail.com>
Signed-off-by: Aditya <aditya050995@gmail.com>
I marked this as ready for review |
Signed-off-by: Steve Peters <scpeters@openrobotics.org>
LGTM with green CI |
some of the CI jobs are green, and those that aren't have unrelated failures. I will go ahead and merge |
🎉 New feature
Summary
The
gz sim
command now accepts a new optional paramater:initial-sim-time
. This parameter controls the initial value of the simulation time.Test it
One should be able to run
gz sim --initial-sim-time [t]
, with[t]
being a floating point value, and have the simulation time start at[t]
seconds.Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-by
messages.