Skip to content

Commit

Permalink
Adds interface for coex-duocam camera properties changing
Browse files Browse the repository at this point in the history
  • Loading branch information
kpetrykin committed Aug 14, 2019
1 parent 6bfbf8e commit 290d124
Show file tree
Hide file tree
Showing 2 changed files with 225 additions and 85 deletions.
238 changes: 201 additions & 37 deletions src/FlightMap/Widgets/CameraPageWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -61,88 +61,252 @@ Column {
enabled: _activeVehicle
}

Row{
Row {
QGCLabel {
text: qsTr("Picture mode: ")
text: "Thermal frame: "
}

ComboBox {
currentIndex: -1
model: ListModel {
id: cbPictureMode
ListElement { text: "IR"; value: 0.0 }
ListElement { text: "VIS"; value: 1.0 }
ListElement { text: "PIP"; value: 2.0 }
CheckBox{
id: showThermalFrame
onClicked: {
if (checkedState == Qt.Checked)
{
console.debug("Thermal frame, 1")
_activeVehicle.setCameraProperty("showThermalFrame", 1)
}
else
{
console.debug("Thermal frame, 0")
_activeVehicle.setCameraProperty("showThermalFrame", 0)
}
}
width: parent.width/2
onCurrentIndexChanged: {
console.debug(cbPictureMode.get(currentIndex).text + ", " + cbPictureMode.get(currentIndex).value)
_activeVehicle.setCameraProperty("pictureMode", cbPictureMode.get(currentIndex).value)
}
}

Row {
QGCLabel {
text: "Visual frame: "
}

CheckBox{
id: showVisualFrame
onClicked: {
if (checkedState == Qt.Checked)
{
console.debug("Visual frame, 1")
_activeVehicle.setCameraProperty("showVisualFrame", 1)
}
else
{
console.debug("Visual frame, 0")
_activeVehicle.setCameraProperty("showVisualFrame", 0)
}
}
}
}

Row {
QGCLabel {
text: "Apply Sobel ED: "
}

CheckBox{
id: applySobel
onClicked: {
if (checkedState == Qt.Checked)
{
console.debug("Apply sobel, 1")
_activeVehicle.setCameraProperty("applySobel", 1)
}
else
{
console.debug("Apply sobel, 0")
_activeVehicle.setCameraProperty("applySobel", 0)
}
}
}
}

Row {
QGCLabel {
text: "Apply Canny ED: "
}

CheckBox{
id: applyCanny
onClicked: {
if (checkedState == Qt.Checked)
{
console.debug("Apply Canny, 1")
_activeVehicle.setCameraProperty("applyCanny", 1)
}
else
{
console.debug("Apply Canny, 0")
_activeVehicle.setCameraProperty("applyCanny", 0)
}
}
}
}

Row {
QGCLabel {
text: "Apply colormap: "
}

CheckBox{
id: applyColormap
onClicked: {
if (checkedState == Qt.Checked)
{
console.debug("Apply Colormap, 1")
_activeVehicle.setCameraProperty("applyColormap", 1)
}
else
{
console.debug("Apply Colormap, 0")
_activeVehicle.setCameraProperty("applyColormap", 0)
}
}
}
}

Row{
visible: applyColormap.checked
QGCLabel {
text: "Color palette: "
text: qsTr("Colormap: ")
}

ComboBox {
currentIndex: -1
model: ListModel {
id: cbColorPalette
ListElement { text: "Hot metal"; value: 0 }
ListElement { text: "White hot"; value: 1 }
ListElement { text: "Rainbow"; value: 2 }
id: cbColormap
ListElement { text: "AUTUMN"; value: 0.0 }
ListElement { text: "BONE"; value: 1.0 }
ListElement { text: "JET"; value: 2.0 }
ListElement { text: "WINTER"; value: 3.0 }
ListElement { text: "RAINBOW"; value: 4.0 }
ListElement { text: "OCEAN"; value: 5.0 }
ListElement { text: "SUMMER"; value: 6.0 }
ListElement { text: "SPRING"; value: 7.0 }
ListElement { text: "COOL"; value: 8.0 }
ListElement { text: "HSV"; value: 9.0 }
ListElement { text: "PINK"; value: 10.0 }
ListElement { text: "HOT"; value: 11.0 }
}
width: parent.width/2
onCurrentIndexChanged: {
console.debug(cbColorPalette.get(currentIndex).text + ", " + cbColorPalette.get(currentIndex).value)
_activeVehicle.setCameraProperty("colorPalette", cbColorPalette.get(currentIndex).value)
console.debug(cbColormap.get(currentIndex).text + ", " + cbColormap.get(currentIndex).value)
_activeVehicle.setCameraProperty("colormap", cbColormap.get(currentIndex).value)
}
}
}

Row {
QGCLabel {
text: "Enable MSX: "
text: "Show FPS: "
}

CheckBox{
id: enableMSX
id: showFPS
onClicked: {
if (checkedState == Qt.Checked)
{
console.debug("enableMSX, 1")
_activeVehicle.setCameraProperty("enableMSX", 1)
console.debug("show FPS, 1")
_activeVehicle.setCameraProperty("showFPS", 1)
}
else
{
console.debug("enableMSX, 0")
_activeVehicle.setCameraProperty("enableMSX", 0)
console.debug("show FPS, 0")
_activeVehicle.setCameraProperty("showFPS", 0)
}
}
}
}

Row{
visible: enableMSX.checked
Row {
QGCLabel {
text: "MSX Strngth: "
text: "Show temperature: "
}

Slider {
value: 50
stepSize: 1
maximumValue: 100
width: parent.width/2
onValueChanged: {
console.debug("MSX Strngth: " + value)
_activeVehicle.setCameraProperty("strengthMSX", value)
CheckBox{
id: showTemperature
onClicked: {
if (checkedState == Qt.Checked)
{
console.debug("show Temperature, 1")
_activeVehicle.setCameraProperty("showTemperature", 1)
}
else
{
console.debug("show Temperature, 0")
_activeVehicle.setCameraProperty("showTemperature", 0)
}
}
}
}

// Row{
// QGCLabel {
// text: "Color palette: "
// }

// ComboBox {
// currentIndex: -1
// model: ListModel {
// id: cbColorPalette
// ListElement { text: "Hot metal"; value: 0 }
// ListElement { text: "White hot"; value: 1 }
// ListElement { text: "Rainbow"; value: 2 }
// }
// width: parent.width/2
// onCurrentIndexChanged: {
// console.debug(cbColorPalette.get(currentIndex).text + ", " + cbColorPalette.get(currentIndex).value)
// _activeVehicle.setCameraProperty("colorPalette", cbColorPalette.get(currentIndex).value)
// }
// }
// }

// Row {
// QGCLabel {
// text: "Enable MSX: "
// }

// CheckBox{
// id: enableMSX
// onClicked: {
// if (checkedState == Qt.Checked)
// {
// console.debug("enableMSX, 1")
// _activeVehicle.setCameraProperty("enableMSX", 1)
// }
// else
// {
// console.debug("enableMSX, 0")
// _activeVehicle.setCameraProperty("enableMSX", 0)
// }
// }
// }
// }

// Row{
// visible: enableMSX.checked
// QGCLabel {
// text: "MSX Strngth: "
// }

// Slider {
// value: 50
// stepSize: 1
// maximumValue: 100
// width: parent.width/2
// onValueChanged: {
// console.debug("MSX Strngth: " + value)
// _activeVehicle.setCameraProperty("strengthMSX", value)
// }
// }
// }

Item { width: 1; height: ScreenTools.defaultFontPixelHeight; visible: _isCamera; }
//-- Actual controller
QGCLabel {
Expand Down
72 changes: 24 additions & 48 deletions src/Vehicle/Vehicle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3268,61 +3268,37 @@ void Vehicle::stopVideoCapture(void)

void Vehicle::setCameraProperty(QString propertyName, float value)
{
if (propertyName=="pictureMode")
{
sendMavCommand(_defaultComponentId,
MAV_CMD_DO_CONTROL_VIDEO,
true, // show errors
100.0, // camera id
value, // mode for HDMI
0.0,
value, // mode for recording do disk
0.0,
0.0,
0.0);

}
if (propertyName=="colorPalette")
{
sendMavCommand(_defaultComponentId,
MAV_CMD_DO_DIGICAM_CONFIGURE,
true, // show errors
0.0,
value, // color palette
0.0,
0.0,
_flirduoRotateImage, // rotate image 0 or 180 deg
_flirduoMSXEnabled, // enable-disable MSX
_flirduoMSXStrength); // MSX strength
_flirduoColorPalette = value;
}
if (propertyName=="enableMSX")
float propertyId = -1;

if (propertyName=="showThermalFrame")
propertyId = 1;
else if (propertyName=="showVisualFrame")
propertyId = 2;
else if (propertyName=="applySobel")
propertyId = 3;
else if (propertyName=="applyCanny")
propertyId = 4;
else if (propertyName=="applyColormap")
propertyId = 5;
else if (propertyName=="colormap")
propertyId = 6;
else if (propertyName=="showFPS")
propertyId = 7;
else if (propertyName=="showTemperature")
propertyId = 8;

if (propertyId > -1)
{
sendMavCommand(_defaultComponentId,
MAV_CMD_DO_DIGICAM_CONFIGURE,
true, // show errors
0.0, // camera id
propertyId, // property ID
value, // value of it
0.0,
_flirduoColorPalette, // color palette
0.0,
0.0,
_flirduoRotateImage, // rotate image 0 or 180 deg
value, // enable-disable MSX
_flirduoMSXStrength); // MSX strength
_flirduoMSXEnabled = value;
}
if (propertyName=="strengthMSX")
{
sendMavCommand(_defaultComponentId,
MAV_CMD_DO_DIGICAM_CONFIGURE,
true, // show errors
0.0,
_flirduoColorPalette, // color palette
0.0,
0.0,
_flirduoRotateImage, // rotate image 0 or 180 deg
_flirduoMSXEnabled, // enable-disable MSX
value); // MSX strength
_flirduoMSXStrength = value;
0.0);
}
}

Expand Down

0 comments on commit 290d124

Please sign in to comment.