Skip to content

Commit

Permalink
gimbal: split relative/absolute yaw angle, cleanup
Browse files Browse the repository at this point in the history
This is my attempt at getting gimbal relative and absolute control
working, using a joystick and by point and click.

It cleans up a couple of methods that I believe were not actually used.

Signed-off-by: Julian Oes <[email protected]>
  • Loading branch information
julianoes committed Jan 15, 2024
1 parent 4228b3f commit d3d6d8e
Show file tree
Hide file tree
Showing 10 changed files with 232 additions and 248 deletions.
2 changes: 1 addition & 1 deletion src/FlightDisplay/FlyViewVideoToolStrip.qml
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ Item {
iconSource: "/HA_Icons/CAMERA_90.png"
onTriggered: {
if (_activeVehicle) {
_activeVehicle.gimbalController.sendGimbalManagerPitchYaw(-90, 0) // point gimbal down
_activeVehicle.gimbalController.sendPitchBodyYaw(-90, 0) // point gimbal down
}
}
},
Expand Down
12 changes: 6 additions & 6 deletions src/FlightDisplay/FlyViewVideoWidgetLayer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ Item {
property var screenXrateInitCoocked
property var screenYrateInitCoocked

property var _gimbalController: _activeVehicle ? _activeVehicle.gimbalController : undefined
property var _gimbalController: _activeVehicle ? _activeVehicle.gimbalController : undefined
property var _activeGimbal: _gimbalController ? _gimbalController.activeGimbal : undefined
property bool _gimbalAvailable: _activeGimbal != undefined
property var _gimbalControllerSettings: QGroundControl.settingsManager.gimbalControllerSettings
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle

property bool shouldProcessClicks: QGroundControl.videoManager.fullScreen || flyViewVideoWidgetLayer._gimbalControllerSettings.EnableOnScreenControl.value ||
_activeVehicle

Expand Down Expand Up @@ -70,7 +70,7 @@ Item {
}
sendRateTimer.stop()
screenXrateInitCoocked = null
screenYrateInitCoocked = null
screenYrateInitCoocked = null
// _activeVehicle.gimbalController.gimbalOnScreenControl(0, 0, false, true, true)
}

Expand All @@ -94,7 +94,7 @@ Item {
// Pitch/Roll indicators
Rectangle {
id: pitchRollRectangle
width: gimbalPitchLabel.width + gimbalPanLabel.width + ScreenTools.defaultFontPixelWidth * 5
width: gimbalPitchLabel.width + gimbalPanLabel.width + ScreenTools.defaultFontPixelWidth * 20
height: gimbalPitchLabel.height + ScreenTools.defaultFontPixelWidth * 2
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
Expand All @@ -103,7 +103,7 @@ Item {

QGCLabel {
id: gimbalPitchLabel
text: rootItem._gimbalAvailable ? "Tilt: " + rootItem._gimbalController.activeGimbal.curPitch.toFixed(2) : ""
text: rootItem._gimbalAvailable ? "Tilt: " + rootItem._gimbalController.activeGimbal.absolutePitch.toFixed(1) : ""
visible: rootItem._gimbalAvailable
anchors.top: parent.top
anchors.left: parent.horizontalCenter
Expand All @@ -112,7 +112,7 @@ Item {

QGCLabel {
id: gimbalPanLabel
text: rootItem._gimbalAvailable ? "Pan: " + rootItem._gimbalController.activeGimbal.curYaw.toFixed(2) : ""
text: rootItem._gimbalAvailable ? "Pan: " + rootItem._gimbalController.activeGimbal.bodyYaw.toFixed(1) + ", from North: " + rootItem._gimbalController.activeGimbal.absoluteYaw.toFixed(1): ""
visible: rootItem._gimbalAvailable
anchors.top: parent.top
anchors.right: parent.horizontalCenter
Expand Down
10 changes: 5 additions & 5 deletions src/FlightDisplay/FlyViewWidgetLayer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ Item {
GripperMenu {
id: gripperOptions
}

// need to manage full screen here
FlyViewVideoToolStrip {
id: videoToolStrip
Expand Down Expand Up @@ -327,20 +327,20 @@ Item {
// Pitch/Roll indicators
Rectangle {
id: pitchRollRectangle
width: gimbalPitchLabel.width + gimbalPanLabel.width + ScreenTools.defaultFontPixelWidth * 5
width: gimbalPitchLabel.width + gimbalPanLabel.width + ScreenTools.defaultFontPixelWidth * 20
height: gimbalPitchLabel.height + ScreenTools.defaultFontPixelWidth * 2
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
color: qgcPal.window
opacity: 0.8

property var _gimbalController: _activeVehicle ? _activeVehicle.gimbalController : undefined
property var _gimbalController: _activeVehicle ? _activeVehicle.gimbalController : undefined
property var _activeGimbal: _gimbalController ? _gimbalController.activeGimbal : undefined
property bool _gimbalAvailable: _activeGimbal != undefined

QGCLabel {
id: gimbalPitchLabel
text: pitchRollRectangle._gimbalAvailable ? "Tilt: " + pitchRollRectangle._activeGimbal.curPitch.toFixed(2) : ""
text: pitchRollRectangle._gimbalAvailable ? "Tilt: " + pitchRollRectangle._activeGimbal.absolutePitch.toFixed(1) : ""
visible: pitchRollRectangle._gimbalAvailable
anchors.top: parent.top
anchors.left: parent.horizontalCenter
Expand All @@ -349,7 +349,7 @@ Item {

QGCLabel {
id: gimbalPanLabel
text: pitchRollRectangle._gimbalAvailable ? "Pan: " + pitchRollRectangle._activeGimbal.curYaw.toFixed(2) : ""
text: pitchRollRectangle._gimbalAvailable ? "Pan: " + pitchRollRectangle._activeGimbal.bodyYaw.toFixed(1) + ", from North: " + pitchRollRectangle._activeGimbal.absoluteYaw.toFixed(1) : ""
visible: pitchRollRectangle._gimbalAvailable
anchors.top: parent.top
anchors.right: parent.horizontalCenter
Expand Down
2 changes: 1 addition & 1 deletion src/FlightMap/MapItems/VehicleMapItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ MapQuickItem {
anchors.centerIn: vehicleItem
width: vehicleItem.width * 2
height: vehicleItem.height * 2
property var gimbalYaw: vehicle && vehicle.gimbalController.activeGimbal ? vehicle.gimbalController.activeGimbal.curYaw : NaN
property var gimbalYaw: vehicle && vehicle.gimbalController.activeGimbal ? vehicle.gimbalController.activeGimbal.bodyYaw : NaN
rotation: gimbalYaw + 180
onGimbalYawChanged: canvas.requestPaint()
visible: vehicle && !isNaN(gimbalYaw)
Expand Down
Loading

0 comments on commit d3d6d8e

Please sign in to comment.