-
Notifications
You must be signed in to change notification settings - Fork 342
[WIP] export occupancy UI #3091
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
Open
arjo129
wants to merge
21
commits into
main
Choose a base branch
from
arjo/feat/export_occupancy_ui
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 16 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
58361a5
Adds a system which enables exporting occupancy grids.
arjo129 d2791c2
Mostly style fixes
arjo129 1c7001f
Fix convergance issues
arjo129 f64434a
style
arjo129 255aaa4
Initial UI wireframe
arjo129 c5dc155
Initial implementation of GUI
arjo129 5e0956c
Fix typo
arjo129 8afd0a8
Merge branch 'main' into arjo/feat/export_occupancy_grid
iche033 30a270d
Bring up to speed to latest gz-math changes
arjo129 4fded03
Merge branch 'arjo/feat/export_occupancy_grid' of github.com:gazebosi…
arjo129 a6ed742
Make clean example
arjo129 d041f59
Merge branch 'main' into arjo/feat/export_occupancy_ui
arjo129 ac81d59
style
arjo129 84ac97a
style
arjo129 68fec4c
Revert stray change
arjo129 7f318a7
Revert stray change
arjo129 96cf88f
Add support for a "start ecploration button"
arjo129 b9a2582
Adds complete Export Occupancy Grid UI.
arjo129 0ce7175
style
arjo129 41022cc
Bikeshedding
arjo129 696aae2
Fix type issues
arjo129 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
gz_add_gui_plugin(ExportOccupancy | ||
SOURCES ExportOccupancy.cc | ||
QT_HEADERS ExportOccupancy.hh | ||
PRIVATE_LINK_LIBS | ||
gz-common::gz-common | ||
gz-common::io | ||
gz-math::gz-math | ||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,158 @@ | ||||||||
/* | ||||||||
* Copyright (C) 2025 Open Source Robotics Foundation | ||||||||
* | ||||||||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||
* you may not use this file except in compliance with the License. | ||||||||
* You may obtain a copy of the License at | ||||||||
* | ||||||||
* http://www.apache.org/licenses/LICENSE-2.0 | ||||||||
* | ||||||||
* Unless required by applicable law or agreed to in writing, software | ||||||||
* distributed under the License is distributed on an "AS IS" BASIS, | ||||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||
* See the License for the specific language governing permissions and | ||||||||
* limitations under the License. | ||||||||
* | ||||||||
*/ | ||||||||
|
||||||||
#include "ExportOccupancy.hh" | ||||||||
#include <gz/msgs/entity_factory.pb.h> | ||||||||
#include <gz/gui/Application.hh> | ||||||||
#include <gz/gui/MainWindow.hh> | ||||||||
#include <gz/plugin/Register.hh> | ||||||||
#include <gz/transport/Node.hh> | ||||||||
|
||||||||
#include "gz/sim/Util.hh" | ||||||||
#include "gz/sim/World.hh" | ||||||||
|
||||||||
#include <sstream> | ||||||||
#include <string> | ||||||||
|
||||||||
using namespace gz; | ||||||||
using namespace sim; | ||||||||
|
||||||||
class gz::sim::ExportOccupancyUiPrivate | ||||||||
{ | ||||||||
public: std::string worldName; | ||||||||
}; | ||||||||
|
||||||||
ExportOccupancyUi::ExportOccupancyUi() : | ||||||||
dataPtr(std::make_unique<ExportOccupancyUiPrivate>()) | ||||||||
{ | ||||||||
gui::App()->Engine()->rootContext()->setContextProperty( | ||||||||
"exportOccupancy", this); | ||||||||
} | ||||||||
|
||||||||
ExportOccupancyUi::~ExportOccupancyUi() | ||||||||
{ | ||||||||
|
||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
} | ||||||||
|
||||||||
void ExportOccupancyUi::LoadConfig( | ||||||||
const tinyxml2::XMLElement *_pluginElem) | ||||||||
{ | ||||||||
if (this->title.empty()) | ||||||||
this->title = "Export Occupancy"; | ||||||||
|
||||||||
gui::App()->findChild<gui::MainWindow *>()->installEventFilter(this); | ||||||||
} | ||||||||
|
||||||||
void ExportOccupancyUi::Update(const UpdateInfo &, | ||||||||
EntityComponentManager &_ecm) | ||||||||
{ | ||||||||
auto world = World(worldEntity(_ecm)); | ||||||||
if (!world.Valid(_ecm)) { | ||||||||
|
if (!world.Valid(_ecm)) { | |
if (!world.Valid(_ecm)) | |
{ |
arjo129 marked this conversation as resolved.
Show resolved
Hide resolved
arjo129 marked this conversation as resolved.
Show resolved
Hide resolved
arjo129 marked this conversation as resolved.
Show resolved
Hide resolved
arjo129 marked this conversation as resolved.
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright (C) 2025 Open Source Robotics Foundation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
#ifndef GZ_SIM_GUI_EXPORT_OCCUPANCY_HH_ | ||
#define GZ_SIM_GUI_EXPORT_OCCUPANCY_HH_ | ||
|
||
#include <memory> | ||
|
||
#include "gz/sim/gui/GuiSystem.hh" | ||
#include "gz/gui/qt.h" | ||
|
||
namespace gz | ||
{ | ||
namespace sim | ||
{ | ||
// Inline bracket to help doxygen filtering. | ||
inline namespace GZ_SIM_VERSION_NAMESPACE | ||
{ | ||
class ExportOccupancyUiPrivate; | ||
|
||
/// \brief A GUI plugin for a user to export the occupancy | ||
/// grid of the current world. | ||
class ExportOccupancyUi : public gz::sim::GuiSystem | ||
{ | ||
Q_OBJECT | ||
/// \brief Constructor | ||
public: ExportOccupancyUi(); | ||
|
||
/// \brief Destructor | ||
public: ~ExportOccupancyUi() override; | ||
|
||
// Documentation inherited | ||
public: void LoadConfig(const tinyxml2::XMLElement *_pluginElem) override; | ||
|
||
// Documentation inherited | ||
public: void Update(const UpdateInfo &, | ||
EntityComponentManager &_ecm) override; | ||
|
||
/// Triggers the export of our | ||
public: Q_INVOKABLE void StartExport(double _samples, double _range, | ||
double _rangeRes, double _angularRes, | ||
double _distanceFromGround, double _gridResolution, | ||
std::size_t _numWidth, std::size_t _numHeight); | ||
arjo129 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/// \internal | ||
/// \brief Pointer to private data | ||
private: std::unique_ptr<ExportOccupancyUiPrivate> dataPtr; | ||
}; | ||
} | ||
} | ||
} | ||
#endif |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
include
<memory>