Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions src/gui/plugins/component_inspector/ComponentInspector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#include "gz/sim/components/CenterOfVolume.hh"
#include "gz/sim/components/ChildLinkName.hh"
#include "gz/sim/components/Collision.hh"
#include "gz/sim/components/Geometry.hh"
#include "gz/sim/components/Factory.hh"
#include "gz/sim/components/Gravity.hh"
#include "gz/sim/components/Joint.hh"
Expand Down Expand Up @@ -88,6 +89,8 @@
#include "gz/sim/config.hh"
#include "gz/sim/EntityComponentManager.hh"
#include "gz/sim/gui/GuiEvents.hh"
#include "gz/sim/Model.hh"
#include "gz/sim/Link.hh"

#include "Inertial.hh"
#include "Pose3d.hh"
Expand Down Expand Up @@ -118,6 +121,9 @@ namespace gz::sim
/// \brief Nested model or not
public: bool nestedModel = false;

/// \brief Whether the model contains a plane collision geometry
public: bool modelContainsPlane = false;

/// \brief Whether currently locked on a given entity
public: bool locked{false};

Expand Down Expand Up @@ -537,6 +543,28 @@ void ComponentInspector::Update(const UpdateInfo &,
}
this->NestedModelChanged();

// Check if any collision in this model has plane geometry.
bool containsPlane = false;
sim::Model model(this->dataPtr->entity);
for (const auto &linkEntity : model.Links(_ecm))
{
sim::Link link(linkEntity);
for (const auto &collisionEntity : link.Collisions(_ecm))
{
auto geomComp = _ecm.Component<components::Geometry>(collisionEntity);
if (geomComp && geomComp->Data().Type() == sdf::GeometryType::PLANE) {
containsPlane = true;
break;
}
}
if (containsPlane)
{
break;
}
}
this->dataPtr->modelContainsPlane = containsPlane;
this->ModelContainsPlaneChanged();

continue;
}

Expand Down Expand Up @@ -1251,6 +1279,12 @@ bool ComponentInspector::NestedModel() const
return this->dataPtr->nestedModel;
}

/////////////////////////////////////////////////
bool ComponentInspector::ModelContainsPlane() const
{
return this->dataPtr->modelContainsPlane;
}

/////////////////////////////////////////////////
const std::string &ComponentInspector::WorldName() const
{
Expand Down
14 changes: 14 additions & 0 deletions src/gui/plugins/component_inspector/ComponentInspector.hh
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,13 @@ namespace sim
NOTIFY NestedModelChanged
)

/// \brief Contains Plane Collision
Q_PROPERTY(
bool modelContainsPlane
READ ModelContainsPlane
NOTIFY ModelContainsPlaneChanged
)

/// \brief System display name list
Q_PROPERTY(
QStringList systemNameList
Expand Down Expand Up @@ -330,6 +337,13 @@ namespace sim
/// \brief Notify that is nested model property has changed
signals: void NestedModelChanged();

/// \brief Get whether the model contains plane collision geometry
/// \return True if any collision in the model uses plane geometry
public: Q_INVOKABLE bool ModelContainsPlane() const;

/// \brief Notify that modelContainsPlane property has changed
signals: void ModelContainsPlaneChanged();

// Documentation inherited
protected: bool eventFilter(QObject *_obj, QEvent *_event) override;

Expand Down
6 changes: 6 additions & 0 deletions src/gui/plugins/component_inspector/ComponentInspector.qml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ Rectangle {
*/
property bool nestedModel : _ComponentInspector.nestedModel

/**
* True if the model contains plane collision geometry,
* which makes SetPose unsupported.
*/
property bool modelContainsPlane : _ComponentInspector.modelContainsPlane

/**
* Light grey according to theme
*/
Expand Down
2 changes: 1 addition & 1 deletion src/gui/plugins/component_inspector/Pose3d.qml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Rectangle {
x: margin + indentation
readOnly: {
var isModel = entityType == "model"
return !(isModel) || nestedModel
return !(isModel) || nestedModel || modelContainsPlane
}

xValue: model.data[0]
Expand Down