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

Move AirPressure functions out of ComponentInspector (suggestion to #1171) #1179

Merged
Merged
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
2 changes: 1 addition & 1 deletion src/gui/plugins/component_inspector/AirPressure.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ using namespace gazebo;
/////////////////////////////////////////////////
AirPressure::AirPressure(ComponentInspector *_inspector)
{
_inspector->Context()->setContextProperty("AirPressure", this);
_inspector->Context()->setContextProperty("AirPressureImpl", this);
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the name collision come from the fact that we are adding property (typically object instances) using CamelCase which is what we normally use for class names?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My guess is that it's a collision between this context property, and the AirPressure.qml item itself

this->inspector = _inspector;

ComponentCreator creator =
Expand Down
31 changes: 24 additions & 7 deletions src/gui/plugins/component_inspector/AirPressure.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,23 @@ Rectangle {
width: componentInspector.width
color: index % 2 == 0 ? lightGrey : darkGrey

/**
* Forward air pressure noise changes to C++
*/
function onAirPressureNoise(_mean, _meanBias, _stdDev, _stdDevBias,
_dynamicBiasStdDev, _dynamicBiasCorrelationTime) {
AirPressureImpl.OnAirPressureNoise(
_mean, _meanBias, _stdDev, _stdDevBias,
_dynamicBiasStdDev, _dynamicBiasCorrelationTime);
}

/**
* Forward air pressure reference altitude changes to C++
*/
function onAirPressureReferenceAltitude(_referenceAltitude) {
AirPressureImpl.OnAirPressureReferenceAltitude(_referenceAltitude);
}

Column {
anchors.fill: parent

Expand All @@ -41,7 +58,7 @@ Rectangle {
// Set the 'expandingHeaderText' value to override the default header
// values, which is based on the model.
expandingHeaderText: "Air pressure"
expandingHeaderToolTip: "Air pressure properties"
expandingHeaderToolTip: "Air pressure properties"
}

// This is the content that will be expanded/contracted using the
Expand Down Expand Up @@ -82,15 +99,15 @@ Rectangle {
Layout.fillWidth: true
height: 40
property double refAltitude: model.data[0]
value: referenceAltitudeSpin.activeFocus ? referenceAltitudeSpin.value : refAltitude
value: referenceAltitudeSpin.activeFocus ? referenceAltitudeSpin.value : refAltitude

minimumValue: 0
maximumValue: 100000
decimals:4
minimumValue: 0
maximumValue: 100000
decimals:4
stepSize: 0.1
onEditingFinished: {
refAltitude = referenceAltitudeSpin.value
componentInspector.onAirPressureReferenceAltitude(refAltitude);
onAirPressureReferenceAltitude(refAltitude);
}
}
}
Expand Down Expand Up @@ -127,7 +144,7 @@ Rectangle {
// Connect to the onNoiseUpdate signal in Noise.qml
Component.onCompleted: {
pressureNoise.onNoiseUpdate.connect(
componentInspector.onAirPressureNoise)
onAirPressureNoise)
}
}
}
Expand Down
17 changes: 0 additions & 17 deletions src/gui/plugins/component_inspector/ComponentInspector.qml
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,6 @@ Rectangle {
return 6;
}

/**
* Forward air pressure noise changes to C++
*/
function onAirPressureNoise(_mean, _meanBias, _stdDev, _stdDevBias,
_dynamicBiasStdDev, _dynamicBiasCorrelationTime) {
AirPressure.OnAirPressureNoise(
_mean, _meanBias, _stdDev, _stdDevBias,
_dynamicBiasStdDev, _dynamicBiasCorrelationTime);
}

/**
* Forward air pressure reference altitude changes to C++
*/
function onAirPressureReferenceAltitude(_referenceAltitude) {
AirPressure.OnAirPressureReferenceAltitude(_referenceAltitude);
}

/**
* Forward pose changes to C++
*/
Expand Down