Skip to content
This repository has been archived by the owner on Feb 3, 2025. It is now read-only.

GUI option to change render rate #3127

Merged
merged 11 commits into from
Oct 28, 2021

Conversation

WilliamLewww
Copy link
Contributor

The effect is not easily seen due to the choppiness of the GIF, but the render rate switches between 62 -> 15.

render_options

Signed-off-by: William Lew <WilliamMilesLew@gmail.com>
Signed-off-by: William Lew <WilliamMilesLew@gmail.com>
Signed-off-by: William Lew <WilliamMilesLew@gmail.com>
Signed-off-by: William Lew <WilliamMilesLew@gmail.com>
Signed-off-by: William Lew <WilliamMilesLew@gmail.com>
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.

merging with gazebo11 should fix the ABI checker

also, I think you could add the render rate to the GUI section of the ModelListWidget on the left-hand side of the screen by adding some code to ModelListWidget::FillUserCamera, since that method already has a pointer to the user camera. If you do this, then you could remove the new code for RenderOptionsWindow, so you can ignore any comments I made about those files if you end up removing the code

@WilliamLewww WilliamLewww force-pushed the wlew/render_options_2 branch from d2700ec to fd7f550 Compare October 26, 2021 20:21
Signed-off-by: William Lew <WilliamMilesLew@gmail.com>
@WilliamLewww WilliamLewww force-pushed the wlew/render_options_2 branch from fd7f550 to 5745d2e Compare October 26, 2021 20:22
@WilliamLewww
Copy link
Contributor Author

merging with gazebo11 should fix the ABI checker

also, I think you could add the render rate to the GUI section of the ModelListWidget on the left-hand side of the screen by adding some code to ModelListWidget::FillUserCamera, since that method already has a pointer to the user camera. If you do this, then you could remove the new code for RenderOptionsWindow, so you can ignore any comments I made about those files if you end up removing the code

Changed the position of the render rate tool.
gui

* Fix the expectations in UNIT_ModelListWidtet_TEST to match
  the new layout.
* Remove a console error message that is currently printed
  whenever clicking on a non-clip Camera field.
* Clean up whitespace
* Share changedProperty variable across logic blocks.

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

nice work! I noticed a test failure and weird console error message while testing, so I've fixed those in a6a827d

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've noticed a few more things; I will fix them myself in another commit

@@ -24,6 +24,7 @@
#include <ignition/msgs/plugin_v.pb.h>

#include "gazebo/gui/qt.h"
#include "gazebo/gui/RenderWidget.hh"
Copy link
Member

Choose a reason for hiding this comment

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

I think we could use a forward declaration a few lines below as class RenderWidget; instead of including this header file

Copy link
Member

Choose a reason for hiding this comment

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

@@ -44,6 +45,8 @@ namespace gazebo
public: explicit ModelListWidget(QWidget *_parent = 0);
public: virtual ~ModelListWidget();

public: void ConnectRenderWidget(RenderWidget* renderWidget);
Copy link
Member

Choose a reason for hiding this comment

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

add doc-string for the new function, even though most others don't have them

Copy link
Member

Choose a reason for hiding this comment

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

@@ -132,6 +133,8 @@ namespace gazebo

/// \brief Node for ignition transport communication.
public: ignition::transport::Node ignNode;

public: RenderWidget* renderWidget;
Copy link
Member

Choose a reason for hiding this comment

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

add doc-string for the new member variable, even though some others don't have them

Copy link
Member

Choose a reason for hiding this comment

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

if (cam)
{
cam->SetRenderRate(this->dataPtr->variantManager->value(
this->ChildItem(cameraRenderRateProperty, "render rate")).toDouble());
Copy link
Member

Choose a reason for hiding this comment

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

nit: this value is duplicated; instead use a variable to store this value and reference it on this line and in the statement below

double renderRate = this->dataPtr->variantManager->value(
    this->ChildItem(cameraRenderRateProperty, "render rate")).toDouble();

Copy link
Member

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

Shouldn't the property name be set to render_rate as everything else in these menus is using this type of notation?
@scpeters @WilliamLewww

* doc-strings for new function and member variable
* de-duplicate code accessing render rate
* use forward declaration instead of header include

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

Mark just asked how feasible it would be to specify the GUI render rate from the <gui> element in a world file, and as I started thinking about how to implement it, it occurs to me that perhaps we should create a GUI event for changing the render rate instead of adding the ModelListWidget::ConnectRenderWidget method.

what do you think @iche033 ?

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

Mark just asked how feasible it would be to specify the GUI render rate from the <gui> element in a world file, and as I started thinking about how to implement it, it occurs to me that perhaps we should create a GUI event for changing the render rate instead of adding the ModelListWidget::ConnectRenderWidget method.

what do you think @iche033 ?

I've implemented the approach using a GUI event in 595f235

@iche033
Copy link
Contributor

iche033 commented Oct 27, 2021

I've implemented the approach using a GUI event in 595f235

yep, looks good to me.

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

I used invokeMethod in e9e162e at @iche033's suggestion to address some threading issues I found while testing an approach to loading the render rate from a world file

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 approve, though I also made a few changes to it

@scpeters
Copy link
Member

I'm not going to try reading the render rate from a world file in this PR

@scpeters scpeters changed the title Added new GUI option to change render rate. GUI option to change render rate Oct 28, 2021
Copy link
Contributor

@iche033 iche033 left a comment

Choose a reason for hiding this comment

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

works for me.

@scpeters scpeters merged commit 6941a39 into gazebosim:gazebo11 Oct 28, 2021
@HighPriest
Copy link

Is usage of this option documented somewhere? How can it be updated, other than manually in the GUI?
Can this property be set in a world file?
e.g

<gui>
  <camera>
    <render_rate>30</render_rate>
  </camera>
</gui>

It would be very useful, when running on a target machine, to reduce gzclient impact on performance.

@scpeters
Copy link
Member

Is usage of this option documented somewhere? How can it be updated, other than manually in the GUI? Can this property be set in a world file? e.g

<gui>
  <camera>
    <render_rate>30</render_rate>
  </camera>
</gui>

It would be very useful, when running on a target machine, to reduce gzclient impact on performance.

there is very simple code to set render rate from SDFormat, but it requires a change to the gui_camera protobuf message, which breaks ABI, so it can't be released in gazebo11 (see scpeters@07ceabf).

an alternative approach could be made that creates an ignition-transport service to allow gzclient to query gzserver for the render_rate value supplied in the SDFormat world file, similar to the approach in 42f7e48. This was more complex, and I did not have time to implement this when working on this pull request

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

Successfully merging this pull request may close these issues.

4 participants