Skip to content
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 sensors to a link via the GUI #1188

Merged
merged 88 commits into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
fc9ee3c
add an add entity button to component inspector. Currently only enabl…
iche033 Oct 7, 2021
12fa0da
add model editor gui plugin that inserts visuals to the scene in the …
iche033 Oct 11, 2021
5364f51
write to ECM
iche033 Oct 12, 2021
007ce1c
get updated GUI ECM info in world control CB
adlarkin Oct 14, 2021
cdd9e50
support adding light links
iche033 Oct 15, 2021
4e7cec8
Merge branch 'ign-gazebo6' into model_editor_add_link
iche033 Oct 20, 2021
051db64
working on adding tests
adlarkin Oct 19, 2021
4dc56c9
remove TODO note, issue fixed by #1131
adlarkin Oct 21, 2021
2fc031d
Merge branch 'ign-gazebo6' into adlarkin/process_gui_ecm_changes
adlarkin Oct 21, 2021
1dbcbd5
Merge branch 'ign-gazebo6' into adlarkin/process_gui_ecm_changes
adlarkin Oct 22, 2021
8f7714c
notify other GUI plugins of added/removed entities via GUI events
adlarkin Oct 22, 2021
c2055ca
Merge remote-tracking branch 'origin/adlarkin/added_removed_entities_…
iche033 Oct 22, 2021
3b967a3
use const ref for constructor input params
adlarkin Oct 25, 2021
afd5b8c
guarantee 64 bit entity IDs with gazebo::Entity instead of unsigned int
adlarkin Oct 25, 2021
3031b3c
testing makr as new entity func
iche033 Oct 25, 2021
399416c
rm printouts
iche033 Oct 25, 2021
d634a4a
Merge branch 'adlarkin/added_removed_entities_event' into model_edito…
iche033 Oct 25, 2021
79518bf
register type
iche033 Oct 25, 2021
413a075
refactor render util
iche033 Oct 26, 2021
6cab7b4
apply GUI ECM's diff to server ECM at end of pause interval
adlarkin Oct 26, 2021
cf08593
Merge branch 'ign-gazebo6' into adlarkin/process_gui_ecm_changes
adlarkin Oct 26, 2021
d726c70
use gui event to update server
adlarkin Oct 29, 2021
c8f0c0b
Merge branch 'ign-gazebo6' into adlarkin/process_gui_ecm_changes
adlarkin Oct 29, 2021
4ca97b1
Working on sensor addition and editing
Oct 29, 2021
8903632
merged with ashton's changes
Oct 29, 2021
3ca5d9d
handle step and support original control service
adlarkin Nov 2, 2021
8a36e6e
Reduced code duplication
Nov 2, 2021
ae91a9d
Set gazebo's default to use the event based system
Nov 2, 2021
ceddf03
Testing things out
Nov 2, 2021
6fee54a
Merge branch 'adlarkin/process_gui_ecm_changes' into nkoenig/model_ed…
Nov 2, 2021
aa3fb43
updates
Nov 2, 2021
4c81d38
workaround for avoiding crash on exit
iche033 Nov 2, 2021
44f7859
refactor, comment out unused menu items
iche033 Nov 4, 2021
fbe09f1
remove commented out code, add CreateLight function
iche033 Nov 4, 2021
2f4aa41
merge
iche033 Nov 4, 2021
b7957c8
add model editor src files
iche033 Nov 4, 2021
493d155
remove more commented out code
iche033 Nov 4, 2021
9d3b499
Merge branch 'ign-gazebo6' into model_editor_add_link
Nov 8, 2021
5c73581
merged with ign-gazebo6
Nov 8, 2021
9a14cd2
Merged with model_editor_add_link
Nov 8, 2021
5624de8
Fix build
Nov 8, 2021
a246fdd
use entity instead of entity name
Nov 8, 2021
ac5791d
Merge branch 'ign-gazebo6' into model_editor_add_link
Nov 8, 2021
c3c6862
Update link add menu
Nov 8, 2021
3a3a011
Merged
Nov 8, 2021
75e5d9d
Merge branch 'ign-gazebo6' into nkoenig/model_editor_add_link_entity
Nov 8, 2021
18514cd
Updating add sensor
Nov 8, 2021
2ba0982
Updates
Nov 8, 2021
f01958f
Merge branch 'model_editor_add_link' into nkoenig/model_editor_add_li…
Nov 8, 2021
034c45e
Merge branch 'nkoenig/model_editor_add_link_entity' into add_link_men…
Nov 8, 2021
1a15c96
Added back in sensor menu
Nov 8, 2021
72658bb
Merge branch 'add_link_menu_updates' into nkoenig/model_editor_add_se…
Nov 8, 2021
f752b04
Updates
Nov 8, 2021
3b2be66
Updates
Nov 8, 2021
a8c3eb7
Updates
Nov 8, 2021
26965e3
use entity instead of entity name (#1176)
nkoenig Nov 8, 2021
fcc87a2
Adding sensors
Nov 8, 2021
539295c
Add link menu updates (#1177)
nkoenig Nov 9, 2021
1c4f59c
fix adding ellipsoid
iche033 Nov 9, 2021
7ad8ad1
Merge branch 'ign-gazebo6' into model_editor_add_link
iche033 Nov 9, 2021
0ecc731
merge model_editor into component_inspector
iche033 Nov 9, 2021
ca1a11a
merge
iche033 Nov 9, 2021
5aba7b8
fixing warnings
iche033 Nov 9, 2021
cf2d651
Merge branch 'ign-gazebo6' into model_editor_add_link
iche033 Nov 9, 2021
1a6c5b6
Merge branch 'ign-gazebo6' into model_editor_add_link
Nov 9, 2021
7dc2eae
Adjust tool tips
Nov 9, 2021
bf9f8d5
Merged with model_editor_add_link
Nov 9, 2021
c9b9844
Updates
Nov 9, 2021
a16b328
updates
Nov 9, 2021
e684d3b
updates
Nov 9, 2021
cafbe77
updates
Nov 9, 2021
574cadb
Adding lidar menu
Nov 9, 2021
fca9dd3
Merged
Nov 10, 2021
1ae9d25
Merged and added new icons
Nov 18, 2021
852b6b4
alphabetize
Nov 18, 2021
3c0d794
merged
Nov 22, 2021
0ced648
Merge branch 'nkoenig/model_editor_add_sensor' of github.com:ignition…
Nov 22, 2021
d565cf1
Comment out sensors not supported
Nov 22, 2021
f24375d
Added segmentation camera
Nov 22, 2021
88db135
fix id
Nov 22, 2021
635a3ab
fix codecheck
Nov 22, 2021
d756acd
Merge branch 'nkoenig/model_editor_add_sensor' of github.com:ignition…
Nov 22, 2021
9634428
Fix submenue
Nov 22, 2021
a663abd
Remove lidar menu, and address comments
Nov 30, 2021
27f4eb4
merged
Dec 1, 2021
cac737a
fix codecheck
Dec 1, 2021
9dc3e64
Fx codecheck
Dec 1, 2021
08bd0c3
Merged
Dec 2, 2021
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
2 changes: 1 addition & 1 deletion include/ignition/gazebo/rendering/RenderUtil.hh
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
/// \param[in] _ecm Const reference to the entity component manager
/// \param[in] _entities Entities to create visuals for.
public: void CreateVisualsForEntities(const EntityComponentManager &_ecm,
const std::set<Entity> &_entities);
const std::set<Entity> &_entities);

/// \brief Set the rendering engine to use
/// \param[in] _engineName Name of the rendering engine.
Expand Down
4 changes: 2 additions & 2 deletions src/gui/plugins/component_inspector/AirPressure.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Q_INVOKABLE void AirPressure::OnAirPressureNoise(
[=](EntityComponentManager &_ecm)
{
auto comp = _ecm.Component<components::AirPressureSensor>(
this->inspector->Entity());
this->inspector->GetEntity());
if (comp)
{
sdf::AirPressure *airpressure = comp->Data().AirPressureSensor();
Expand Down Expand Up @@ -100,7 +100,7 @@ Q_INVOKABLE void AirPressure::OnAirPressureReferenceAltitude(
[=](EntityComponentManager &_ecm)
{
auto comp = _ecm.Component<components::AirPressureSensor>(
this->inspector->Entity());
this->inspector->GetEntity());
if (comp)
{
sdf::AirPressure *airpressure = comp->Data().AirPressureSensor();
Expand Down
4 changes: 2 additions & 2 deletions src/gui/plugins/component_inspector/Altimeter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Q_INVOKABLE void Altimeter::OnAltimeterPositionNoise(
[=](EntityComponentManager &_ecm)
{
auto comp = _ecm.Component<components::Altimeter>(
this->inspector->Entity());
this->inspector->GetEntity());
if (comp)
{
sdf::Altimeter *altimeter = comp->Data().AltimeterSensor();
Expand Down Expand Up @@ -106,7 +106,7 @@ Q_INVOKABLE void Altimeter::OnAltimeterVelocityNoise(
[=](EntityComponentManager &_ecm)
{
auto comp = _ecm.Component<components::Altimeter>(
this->inspector->Entity());
this->inspector->GetEntity());
if (comp)
{
sdf::Altimeter *altimeter = comp->Data().AltimeterSensor();
Expand Down
2 changes: 1 addition & 1 deletion src/gui/plugins/component_inspector/ComponentInspector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ Entity ComponentInspector::GetEntity() const
}

/////////////////////////////////////////////////
void ComponentInspector::SetEntity(const Entity &_entity)
void ComponentInspector::SetEntity(const gazebo::Entity &_entity)
{
// If nothing is selected, display world properties
if (_entity == kNullEntity)
Expand Down
2 changes: 1 addition & 1 deletion src/gui/plugins/component_inspector/ComponentInspector.hh
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ namespace gazebo

/// \brief Set the entity currently inspected.
/// \param[in] _entity Entity ID.
public: Q_INVOKABLE void SetEntity(const Entity &_entity);
public: Q_INVOKABLE void SetEntity(const gazebo::Entity &_entity);

/// \brief Notify that entity has changed.
signals: void EntityChanged();
Expand Down
188 changes: 177 additions & 11 deletions src/gui/plugins/component_inspector/ComponentInspector.qml
Original file line number Diff line number Diff line change
Expand Up @@ -306,34 +306,34 @@ Rectangle {
}

ToolButton {
id: addButton
id: addLinkButton
checkable: false
text: "Add entity"
visible: entityType == "model"
contentItem: Image {
fillMode: Image.Pad
horizontalAlignment: Image.AlignHCenter
verticalAlignment: Image.AlignVCenter
source: "qrc:/Gazebo/images/plus.png"
source: "qrc:/Gazebo/images/plus-link.png"
sourceSize.width: 18;
sourceSize.height: 18;
}
ToolTip.text: "Add an entity to a model"
ToolTip.text: "Add a link or light to a model"
ToolTip.visible: hovered
ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
onClicked: {
getSimPaused() ? addLinkMenu.open() : pausePopup.open()
getSimPaused() ? addLinkMenu.open() : linkAddPausePopup.open()
}
Popup {
id: pausePopup
id: linkAddPausePopup
modal: true
focus: true
x: parent.width - popupContentText.width
y: parent.height + popupContentText.height
x: parent.width - linkAdPopupContentText.width
y: parent.height + linkAdPopupContentText.height
contentItem: Text {
id: popupContentText
id: linkAdPopupContentText
padding: 10
text: "Pause simulation to add an entity"
text: "Pause simulation to add a link or light"
}
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
}
Expand All @@ -350,7 +350,6 @@ Rectangle {
}
}


Menu {
id: addLinkMenu

Expand Down Expand Up @@ -577,7 +576,175 @@ Rectangle {
addLinkMenu.close()
}
}
}
}

ToolButton {
id: addSensorButton
checkable: false
text: "Add sensor"
visible: entityType == "link"
contentItem: Image {
fillMode: Image.Pad
horizontalAlignment: Image.AlignHCenter
verticalAlignment: Image.AlignVCenter
source: "qrc:/Gazebo/images/plus-sensor.png"
sourceSize.width: 18;
sourceSize.height: 18;
}
ToolTip.text: "Add a sensor to a link"
ToolTip.visible: hovered
ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
onClicked: {
getSimPaused() ? addSensorMenu.open() : sensorAddPausePopup.open()
}
Popup {
id: sensorAddPausePopup
modal: true
focus: true
x: parent.width - sensorAddPopupContentText.width
y: parent.height + sensorAddPopupContentText.height
contentItem: Text {
id: sensorAddPopupContentText
padding: 10
text: "Pause simulation to add a sensor"
}
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
}

Menu {
id: addSensorMenu
MenuItem {
id: airPressure
text: "Air pressure"
onTriggered: {
ComponentInspector.OnAddEntity(airPressure.text, "sensor");
}
}

MenuItem {
id: altimeter
text: "Altimeter"
onTriggered: {
ComponentInspector.OnAddEntity(altimeter.text, "sensor");
}
}

MenuItem {
id: cameraSensorMenu
text: "Camera >"

MouseArea {
id: viewSubCameraArea
anchors.fill: parent
hoverEnabled: true
onEntered: cameraSubmenu.open()
}
}

MenuItem {
id: contact
text: "Contact"
onTriggered: {
ComponentInspector.OnAddEntity(contact.text, "sensor");
}
}

MenuItem {
id: forceTorque
text: "Force torque"
onTriggered: {
ComponentInspector.OnAddEntity(forceTorque.text, "sensor");
}
}

/*MenuItem {
id: gps
text: "GPS"
onTriggered: {
ComponentInspector.OnAddEntity(gps.text, "sensor");
}
}*/

MenuItem {
id: gpuLidar
text: "GPU Lidar"
onTriggered: {
ComponentInspector.OnAddEntity("gpu_lidar", "sensor");
}
}

MenuItem {
id: imu
text: "IMU"
onTriggered: {
ComponentInspector.OnAddEntity(imu.text, "sensor");
}
}

MenuItem {
id: magnetometer
text: "Magnetometer"
onTriggered: {
ComponentInspector.OnAddEntity(magnetometer.text, "sensor");
}
}
}

Menu {
id: cameraSubmenu
x: addSensorMenu.x - addSensorMenu.width
y: addSensorMenu.y + cameraSensorMenu.y

MenuItem {
id: depth
text: "Depth"
onTriggered: {
ComponentInspector.OnAddEntity("depth_camera", "sensor");
}
}
MenuItem {
id: logical
text: "Logical"
onTriggered: {
ComponentInspector.OnAddEntity("logical_camera", "sensor");
}
}
MenuItem {
id: monocular
text: "Monocular"
onTriggered: {
ComponentInspector.OnAddEntity("camera", "sensor");
}
}
/*MenuItem {
id: multicamera
text: "Multicamera"
onTriggered: {
ComponentInspector.OnAddEntity("multicamera", "sensor");
}
}*/
MenuItem {
id: rgbd
text: "RGBD"
onTriggered: {
ComponentInspector.OnAddEntity("rgbd_camera", "sensor");
}
}
MenuItem {
id: segmentation
text: "Segmentation"
onTriggered: {
ComponentInspector.OnAddEntity("segmentation_camera", "sensor");
}
}
nkoenig marked this conversation as resolved.
Show resolved Hide resolved
MenuItem {
id: thermal
text: "Thermal"
onTriggered: {
ComponentInspector.OnAddEntity("thermal_camera", "sensor");
}
}
}
}

Expand All @@ -592,7 +759,6 @@ Rectangle {
}
}


ListView {
anchors.top: header.bottom
anchors.bottom: parent.bottom
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Rectangle {
fillMode: Image.Pad
Layout.alignment : Qt.AlignVCenter
source: content.show ?
"qrc:/Gazebo/images/minus.png" : "qrc:/Gazebo/images/plus.png"
"qrc:/Gazebo/images/chevron-down.svg" : "qrc:/Gazebo/images/chevron-right.svg"
}
TypeHeader {
id: typeHeader
Expand Down
12 changes: 6 additions & 6 deletions src/gui/plugins/component_inspector/Imu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Q_INVOKABLE void Imu::OnLinearAccelerationXNoise(
[=](EntityComponentManager &_ecm)
{
auto comp = _ecm.Component<components::Imu>(
this->inspector->Entity());
this->inspector->GetEntity());
if (comp)
{
sdf::Imu *imu = comp->Data().ImuSensor();
Expand Down Expand Up @@ -137,7 +137,7 @@ Q_INVOKABLE void Imu::OnLinearAccelerationYNoise(
[=](EntityComponentManager &_ecm)
{
auto comp = _ecm.Component<components::Imu>(
this->inspector->Entity());
this->inspector->GetEntity());
if (comp)
{
sdf::Imu *imu = comp->Data().ImuSensor();
Expand Down Expand Up @@ -171,7 +171,7 @@ Q_INVOKABLE void Imu::OnLinearAccelerationZNoise(
[=](EntityComponentManager &_ecm)
{
auto comp = _ecm.Component<components::Imu>(
this->inspector->Entity());
this->inspector->GetEntity());
if (comp)
{
sdf::Imu *imu = comp->Data().ImuSensor();
Expand Down Expand Up @@ -205,7 +205,7 @@ Q_INVOKABLE void Imu::OnAngularVelocityXNoise(
[=](EntityComponentManager &_ecm)
{
auto comp = _ecm.Component<components::Imu>(
this->inspector->Entity());
this->inspector->GetEntity());
if (comp)
{
sdf::Imu *imu = comp->Data().ImuSensor();
Expand Down Expand Up @@ -239,7 +239,7 @@ Q_INVOKABLE void Imu::OnAngularVelocityYNoise(
[=](EntityComponentManager &_ecm)
{
auto comp = _ecm.Component<components::Imu>(
this->inspector->Entity());
this->inspector->GetEntity());
if (comp)
{
sdf::Imu *imu = comp->Data().ImuSensor();
Expand Down Expand Up @@ -273,7 +273,7 @@ Q_INVOKABLE void Imu::OnAngularVelocityZNoise(
[=](EntityComponentManager &_ecm)
{
auto comp = _ecm.Component<components::Imu>(
this->inspector->Entity());
this->inspector->GetEntity());
if (comp)
{
sdf::Imu *imu = comp->Data().ImuSensor();
Expand Down
4 changes: 2 additions & 2 deletions src/gui/plugins/component_inspector/JointType.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ Q_INVOKABLE void JointType::OnJointType(QString _jointType)
[=](EntityComponentManager &_ecm)
{
components::JointType *comp =
_ecm.Component<components::JointType>(this->inspector->Entity());
_ecm.Component<components::JointType>(this->inspector->GetEntity());

components::ParentEntity *parentComp =
_ecm.Component<components::ParentEntity>(this->inspector->Entity());
_ecm.Component<components::ParentEntity>(this->inspector->GetEntity());

if (comp && parentComp)
{
Expand Down
4 changes: 2 additions & 2 deletions src/gui/plugins/component_inspector/Lidar.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Q_INVOKABLE void Lidar::OnLidarNoise(
[=](EntityComponentManager &_ecm)
{
auto comp = _ecm.Component<components::GpuLidar>(
this->inspector->Entity());
this->inspector->GetEntity());
if (comp)
{
sdf::Lidar *lidar = comp->Data().LidarSensor();
Expand Down Expand Up @@ -120,7 +120,7 @@ Q_INVOKABLE void Lidar::OnLidarChange(
[=](EntityComponentManager &_ecm)
{
auto comp = _ecm.Component<components::GpuLidar>(
this->inspector->Entity());
this->inspector->GetEntity());
if (comp)
{
sdf::Lidar *lidar = comp->Data().LidarSensor();
Expand Down
Loading