-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add acoustic environment vis scaffolding
Signed-off-by: Arjo Chakravarty <arjo@openrobotics.org>
- Loading branch information
Showing
7 changed files
with
282 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 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 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(EnvironmentVisualization | ||
SOURCES EnvironmentVisualization.cc | ||
QT_HEADERS EnvironmentVisualization.hh | ||
PRIVATE_LINK_LIBS | ||
gz-common${GZ_COMMON_VER}::gz-common${GZ_COMMON_VER} | ||
gz-common${GZ_COMMON_VER}::io | ||
gz-math${GZ_MATH_VER}::gz-math${GZ_MATH_VER} | ||
) |
105 changes: 105 additions & 0 deletions
105
src/gui/plugins/environment_visualization/EnvironmentVisualization.cc
This file contains 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,105 @@ | ||
/* | ||
* Copyright (C) 2022 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 "EnvironmentVisualization.hh" | ||
|
||
#include <gz/gui/Application.hh> | ||
#include <gz/gui/MainWindow.hh> | ||
#include <gz/sim/components/Environment.hh> | ||
#include <gz/sim/Util.hh> | ||
|
||
#include <gz/plugin/Register.hh> | ||
|
||
#include <atomic> | ||
#include <mutex> | ||
#include <string> | ||
#include <utility> | ||
#include <vector> | ||
|
||
#include <gz/common/CSVStreams.hh> | ||
#include <gz/common/DataFrame.hh> | ||
|
||
using namespace gz; | ||
using namespace sim; | ||
|
||
namespace gz | ||
{ | ||
namespace sim | ||
{ | ||
inline namespace GZ_SIM_VERSION_NAMESPACE | ||
{ | ||
/// \brief Private data class for EnvironmentVisualization | ||
class EnvironmentVisualizationPrivate | ||
{ | ||
/// \brief To synchronize member access. | ||
public: std::mutex mutex; | ||
|
||
/// \brief Whether to attempt an environmental data load. | ||
public: std::atomic<bool> needsLoad{false}; | ||
|
||
/// \brief Setup publishers | ||
public: | ||
|
||
/// \brief first load we need to scan for existing data sensor | ||
public: bool first; | ||
}; | ||
} | ||
} | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
EnvironmentVisualization::EnvironmentVisualization() | ||
: GuiSystem(), dataPtr(new EnvironmentVisualizationPrivate) | ||
{ | ||
gui::App()->Engine()->rootContext()->setContextProperty( | ||
"EnvironmentVisualization", this); | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
EnvironmentVisualization::~EnvironmentVisualization() | ||
{ | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
void EnvironmentVisualization::LoadConfig(const tinyxml2::XMLElement *) | ||
{ | ||
if (this->title.empty()) | ||
this->title = "Environment Visualization Resolution"; | ||
|
||
gui::App()->findChild<gui::MainWindow *>()->installEventFilter(this); | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
void EnvironmentVisualization::Update(const UpdateInfo &, | ||
EntityComponentManager &_ecm) | ||
{ | ||
_ecm.EachNew<components::Environment>( | ||
[]( | ||
const Entity &_entity, | ||
const components::Environment* environment | ||
) { | ||
|
||
} | ||
); | ||
|
||
auto environData = | ||
_ecm.Component<components::Environment>( | ||
worldEntity(_ecm)); | ||
} | ||
|
||
// Register this plugin | ||
GZ_ADD_PLUGIN(gz::sim::EnvironmentVisualization, gz::gui::Plugin) |
63 changes: 63 additions & 0 deletions
63
src/gui/plugins/environment_visualization/EnvironmentVisualization.hh
This file contains 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,63 @@ | ||
/* | ||
* Copyright (C) 2022 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_ENVIRONMENTVISUALIZATION_HH_ | ||
#define GZ_SIM_GUI_ENVIRONMENTVISUALIZATION_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 EnvironmentVisualizationPrivate; | ||
|
||
/// \class EnvironmentVisualization EnvironmentVisualization.hh | ||
/// gz/sim/systems/EnvironmentVisualization.hh | ||
/// \brief A GUI plugin for a user to load an Environment | ||
/// component into the ECM on a live simulation. | ||
class EnvironmentVisualization : public gz::sim::GuiSystem | ||
{ | ||
Q_OBJECT | ||
|
||
/// \brief Constructor | ||
public: EnvironmentVisualization(); | ||
|
||
/// \brief Destructor | ||
public: ~EnvironmentVisualization() override; | ||
|
||
// Documentation inherited | ||
public: void LoadConfig(const tinyxml2::XMLElement *_pluginElem) override; | ||
|
||
// Documentation inherited | ||
public: void Update(const UpdateInfo &, | ||
EntityComponentManager &_ecm) override; | ||
|
||
/// \internal | ||
/// \brief Pointer to private data | ||
private: std::unique_ptr<EnvironmentVisualizationPrivate> dataPtr; | ||
}; | ||
} | ||
} | ||
} | ||
#endif |
99 changes: 99 additions & 0 deletions
99
src/gui/plugins/environment_visualization/EnvironmentVisualization.qml
This file contains 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,99 @@ | ||
/* | ||
* Copyright (C) 2022 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. | ||
* | ||
*/ | ||
import QtQuick 2.9 | ||
import QtQuick.Controls 2.1 | ||
import QtQuick.Dialogs 1.0 | ||
import QtQuick.Controls.Material 2.1 | ||
import QtQuick.Layouts 1.3 | ||
import "qrc:/qml" | ||
|
||
|
||
GridLayout { | ||
columns: 8 | ||
columnSpacing: 10 | ||
Layout.minimumWidth: 350 | ||
Layout.minimumHeight: 400 | ||
anchors.fill: parent | ||
anchors.leftMargin: 10 | ||
anchors.rightMargin: 10 | ||
|
||
Label { | ||
Layout.row: 0 | ||
Layout.columnSpan: 8 | ||
horizontalAlignment: Text.AlignCenter | ||
id: instructionLabel | ||
color: "dimgrey" | ||
text: qsTr("For the actual pointcloud please open the point_cloud panel") | ||
} | ||
|
||
Label { | ||
Layout.row: 1 | ||
Layout.columnSpan: 2 | ||
horizontalAlignment: Text.AlignRight | ||
id: dimensionLabelX | ||
color: "dimgrey" | ||
text: qsTr("X resolution") | ||
} | ||
|
||
Slider { | ||
Layout.row: 1 | ||
Layout.column: 2 | ||
Layout.columnSpan: 6 | ||
id: stepSliderX | ||
from: 10 | ||
value: 2 | ||
to: 1000 | ||
} | ||
|
||
Label { | ||
Layout.row: 2 | ||
Layout.columnSpan: 2 | ||
horizontalAlignment: Text.AlignRight | ||
id: dimensionLabelY | ||
color: "dimgrey" | ||
text: qsTr("Y resolution") | ||
} | ||
|
||
Slider { | ||
Layout.row: 2 | ||
Layout.column: 2 | ||
Layout.columnSpan: 6 | ||
id: stepSliderY | ||
from: 10 | ||
value: 2 | ||
to: 1000 | ||
} | ||
|
||
Label { | ||
Layout.row: 3 | ||
Layout.columnSpan: 2 | ||
horizontalAlignment: Text.AlignRight | ||
id: dimensionLabelZ | ||
color: "dimgrey" | ||
text: qsTr("Z resolution") | ||
} | ||
|
||
Slider { | ||
Layout.row: 3 | ||
Layout.column: 2 | ||
Layout.columnSpan: 6 | ||
id: stepSliderZ | ||
from: 10 | ||
value: 2 | ||
to: 1000 | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/gui/plugins/environment_visualization/EnvironmentVisualization.qrc
This file contains 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,5 @@ | ||
<!DOCTYPE RCC><RCC version="1.0"> | ||
<qresource prefix="EnvironmentVisualization"> | ||
<file>EnvironmentVisualization.qml</file> | ||
</qresource> | ||
</RCC> |