-
Notifications
You must be signed in to change notification settings - Fork 275
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
Add service and GUI to configure physics parameters (step size and real time factor) #536
Add service and GUI to configure physics parameters (step size and real time factor) #536
Conversation
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.
You have included the two elements as drawable (at least I can see the icon close to the name). You should include these new parameters to the Plotting class (src/gui/plugins/plotting/Plotting.hh, src/gui/plugins/plotting/Plotting.cc)
Using interpolate_x sdf value for animation playback speed Approved-by: Louise Poubel Approved-by: Ian Chen
Yea it was one of the parts I was not super sure about, I was not sure whether it would be useful to have the parameters drawable since, unlike other drawable parameters like |
I can imagine someone plotting that together with other data to see how it's affected. I don't think it's extremely necessary though, so it's up to you if you want to remove the plot icons or add full plot support. |
@mrushyendra can you sync your fork to this branch and sign-off your commits for the DCO error? I'll resync this branch afterwards. |
@luca-della-vedova Yep sure! Will do by the end of today Edit: Done |
Signed-off-by: Maganty Rushyendra <[email protected]>
Signed-off-by: Maganty Rushyendra <[email protected]>
Signed-off-by: Luca Della Vedova <[email protected]>
Signed-off-by: Luca Della Vedova <[email protected]>
Signed-off-by: Luca Della Vedova <[email protected]>
Signed-off-by: Luca Della Vedova <[email protected]>
Signed-off-by: Luca Della Vedova <[email protected]>
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.
Do you mind to add some tests to test/integration/user_commands.cc
?
dea49f4
to
b474cab
Compare
Signed-off-by: Luca Della Vedova <[email protected]>
Codecov Report
@@ Coverage Diff @@
## ign-gazebo4 #536 +/- ##
===============================================
- Coverage 77.36% 77.14% -0.22%
===============================================
Files 215 215
Lines 12029 12026 -3
===============================================
- Hits 9306 9278 -28
- Misses 2723 2748 +25
Continue to review full report at Codecov.
|
Signed-off-by: Luca Della Vedova <[email protected]>
Done! A simple "create world, check physics properties, set them through service and check them again". |
Signed-off-by: Luca Della Vedova <[email protected]>
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.
LGTM, just a minor comment
Signed-off-by: Luca Della Vedova <[email protected]>
Signed-off-by: Luca Della Vedova <[email protected]>
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.
LGTM
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.
I haven't tried it out yet, but here's some feedback 😉
There is a lot of code duplication for creating the physics parameters
Yeah it would be nice to clean this up a bit... It would take some refactoring. I think for now this PR is ok.
discussion about allowing reconfiguration of Gravity and MagneticField.
Yeah I think these can be handled separately
Signed-off-by: Luca Della Vedova <[email protected]>
Signed-off-by: Luca Della Vedova <[email protected]>
Signed-off-by: Luca Della Vedova <[email protected]>
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.
This is a really useful feature! I just have a small usability suggestion, and then feel free to merge 😉
Signed-off-by: Luca Della Vedova <[email protected]>
Thanks for the feature. One more usability problem is that you cannot set rtf without also setting time step via the service. I.e. a service call like this
results in stopped (or broken?) simulation, because time step is read as zero from the request. Setting both rtf and step size works, but I see this in the console:
Which is weird because I can't figure out where does the World.cpp file come from (I haven't found it anywhere). Would it be possible to check whether both rtf and time step are non-zero before using them? I think a zero value is wrong for both of them. |
That's coming from DART.
+1 - On Gazebo classic a zero "real time update rate" means "run as fast as possible", but we don't have that on Ignition, so I think it's safe to assume a value of zero is unset or user error. |
…al time factor) (#536) Signed-off-by: Maganty Rushyendra <[email protected]> Signed-off-by: Luca Della Vedova <[email protected]> Co-authored-by: mrushyendra <[email protected]> Co-authored-by: Louise Poubel <[email protected]>
Signed-off-by: ahcorde <[email protected]>
…eters (#812) * Add service and GUI to configure physics parameters (step size and real time factor) (#536) Signed-off-by: Maganty Rushyendra <[email protected]> Signed-off-by: Luca Della Vedova <[email protected]> Signed-off-by: ahcorde <[email protected]> Co-authored-by: mrushyendra <[email protected]> Co-authored-by: Louise Poubel <[email protected]> Co-authored-by: Luca Della Vedova <[email protected]>
This PR addresses #489 introducing a service in UserCommands advertised under
/world/world_name/set_physics
to set physics parameters (for now only step size and maximum real time factor), as well as updates to the ComponentInspector GUI to set them.An example of the GUI is below:
There are a few parts of the implementation that I found suspicious while writing, specifically:
SimulationRunner
OK? It is currently placed in the mainStep()
loop.SimulationRunner
constructor,SdfEntityCreator
world creation function andLevelManager
initialization.Physics
and aPhysicsCmd
component to hold the current physics data (the first) and send updates (the second), similar to what is done in Add Light Usercommand and include Light parameters in the componentInspector #482 withLight
andLightCmd
, as well asPose
andPoseCmd
.Gravity
andMagneticField
. Right now however, they have separate components, and they are not stored in thesdf::Physics
object, hence I suspect it might not be possible if we stick to having thePhysics
component store thesdf::Physics
object.Most importantly, it seems the physics component that is now updated in
SimulationRunner
isn't updated properly when theComponentInspector
field is deselected by moving the mouse away, instead of pressing return. It seems the value in the physics simulation is updated but the one in the GUI isn't, and there is a delay between the value displayed in the GUI and the one being actually used in the simulation (shown below):I could only get this to work by updating the Physics component in the
UserCommands
service callback but that sounded like a very hacky fix, I left it commented just to have an idea of what it would look like.