masa-umich / Ground-Support-Software

GUI for the engine controller
1 stars 0 forks source link

Entering campaign mode breaks everything #107

Closed jtalier closed 2 years ago

jtalier commented 2 years ago

In GitLab by @nkalan on Feb 20, 2022, 15:20

Bug with starting campaign: Cannot start a campaign under certain conditions.

Recreating the bug:

  1. Open GUI/server
  2. Connect to board, take command
  3. Open configuration file
  4. Click start campaign, give name and click "Start Campaign" button. Command window gives following error:
Traceback (most recent call last):
  File "C:\Users\MASA-Avionics\Desktop\gui\Python\controlsWindow.py", line 545, in <lambda>
    start_button.clicked.connect(lambda: self.startRun(dialog, textbox.text()))
  File "C:\Users\MASA-Avionics\Desktop\gui\Python\controlsWindow.py", line 588, in startRun
    self.gui.campaign.startRun(run_name)
  File "C:\Users\MASA-Avionics\Desktop\gui\Python\run.py", line 97, in startRun
    self.client.command(6, [str(self.saveName), self.gui.controlsWindow.centralWidget.controlsWidget.generateConfigurationSaveData(), self.gui.controlsWindow.centralWidget.controlsWidget.generateSensorMappingsToSend()])
  File "C:\Users\MASA-Avionics\Desktop\gui\Python\controlsWidget.py", line 426, in generateSensorMappingsToSend
    mapDict[counter] = [object_.long_name, self.window.interface.getPrefix(object_.avionics_board) + object_.channel]
  File "C:\Users\MASA-Avionics\Desktop\gui\Python\s2Interface.py", line 400, in getPrefix
    return mapping[name]
KeyError: 'Undefined'

Using the following configuration file, which was made earlier in the day on the same GUI version

{
    "Solenoid 7": {
        "id": 7,
        "pos": {
            "x": 756.25,
            "y": 478.75
        },
        "fluid": 0,
        "width": 40.0,
        "height": 28.0,
        "name": "Solenoid",
        "scale": 1,
        "serial number": "",
        "long name": "Fill",
        "is vertical": false,
        "is locked": false,
        "is pos locked": false,
        "serial number label": {
            "pos string": "Bottom",
            "local pos": {
                "x": 16.666666666666668,
                "y": 36.25
            },
            "rows": 1,
            "font size": 10.0,
            "is visible": true
        },
        "long name label": {
            "pos string": "Top",
            "local pos": {
                "x": 9.375,
                "y": -20.0
            },
            "rows": 1,
            "font size": 12.0,
            "is visible": true
        },
        "channel": "6",
        "board": "Undefined",
        "normally open": false
    },
    "Generic Sensor 8": {
        "id": 8,
        "pos": {
            "x": 798.9583333333334,
            "y": 396.25
        },
        "fluid": 1,
        "width": 66.0,
        "height": 24.0,
        "name": "PT",
        "scale": 1,
        "serial number": "",
        "long name": "TANK PT",
        "is vertical": false,
        "is locked": false,
        "is pos locked": false,
        "serial number label": {
            "pos string": "Bottom",
            "local pos": {
                "x": 30.208333333333336,
                "y": 32.5
            },
            "rows": 1,
            "font size": 10.0,
            "is visible": true
        },
        "long name label": {
            "pos string": "Top",
            "local pos": {
                "x": 5.208333333333334,
                "y": -20.0
            },
            "rows": 1,
            "font size": 12.0,
            "is visible": true
        },
        "channel": "gse.pressure[16]",
        "board": "GSE Controller"
    },
    "Generic Sensor 10": {
        "id": 10,
        "pos": {
            "x": 783.3333333333334,
            "y": 822.5
        },
        "fluid": 0,
        "width": 66.0,
        "height": 24.0,
        "name": "PT",
        "scale": 1,
        "serial number": "",
        "long name": "MPV OUTLET",
        "is vertical": false,
        "is locked": false,
        "is pos locked": false,
        "serial number label": {
            "pos string": "Bottom",
            "local pos": {
                "x": 30.208333333333336,
                "y": 32.5
            },
            "rows": 1,
            "font size": 10.0,
            "is visible": true
        },
        "long name label": {
            "pos string": "Custom",
            "local pos": {
                "x": -8.333333333333334,
                "y": -22.5
            },
            "rows": 1,
            "font size": 12.0,
            "is visible": true
        },
        "channel": "gse.pressure[17]",
        "board": "GSE Controller"
    },
    "Generic Sensor 11": {
        "id": 11,
        "pos": {
            "x": 501.0416666666667,
            "y": 811.25
        },
        "fluid": 0,
        "width": 66.0,
        "height": 24.0,
        "name": "PT",
        "scale": 1,
        "serial number": "",
        "long name": "MPV INLET",
        "is vertical": false,
        "is locked": false,
        "is pos locked": false,
        "serial number label": {
            "pos string": "Bottom",
            "local pos": {
                "x": 30.208333333333336,
                "y": 32.5
            },
            "rows": 1,
            "font size": 10.0,
            "is visible": true
        },
        "long name label": {
            "pos string": "Custom",
            "local pos": {
                "x": 1.0416666666666667,
                "y": -26.25
            },
            "rows": 1,
            "font size": 12.0,
            "is visible": true
        },
        "channel": "gse.pressure[14]",
        "board": "GSE Controller"
    },
    "Tank 12": {
        "id": 12,
        "pos": {
            "x": 787.5,
            "y": 503.75
        },
        "fluid": 1,
        "width": 87.99999999999999,
        "height": 170.0,
        "name": "Tank",
        "scale": 1,
        "serial number": "",
        "long name": "RP1 Tank",
        "is vertical": true,
        "is locked": false,
        "is pos locked": false,
        "serial number label": {
            "pos string": "Bottom",
            "local pos": {
                "x": 40.625,
                "y": 207.5
            },
            "rows": 1,
            "font size": 10.0,
            "is visible": true
        },
        "long name label": {
            "pos string": "Top",
            "local pos": {
                "x": 14.583333333333334,
                "y": -20.0
            },
            "rows": 1,
            "font size": 12.0,
            "is visible": true
        },
        "channel": "Undefined",
        "board": "Undefined"
    },
    "Solenoid 13": {
        "id": 13,
        "pos": {
            "x": 872.9166666666667,
            "y": 473.75
        },
        "fluid": 0,
        "width": 40.0,
        "height": 28.0,
        "name": "Solenoid",
        "scale": 1,
        "serial number": "",
        "long name": "Vent",
        "is vertical": false,
        "is locked": false,
        "is pos locked": false,
        "serial number label": {
            "pos string": "Bottom",
            "local pos": {
                "x": 16.666666666666668,
                "y": 36.25
            },
            "rows": 1,
            "font size": 10.0,
            "is visible": true
        },
        "long name label": {
            "pos string": "Top",
            "local pos": {
                "x": 3.125,
                "y": -20.0
            },
            "rows": 1,
            "font size": 12.0,
            "is visible": true
        },
        "channel": "9",
        "board": "Undefined",
        "normally open": false
    },
    "Solenoid 14": {
        "id": 14,
        "pos": {
            "x": 863.5416666666667,
            "y": 712.5
        },
        "fluid": 0,
        "width": 40.0,
        "height": 28.0,
        "name": "Solenoid",
        "scale": 1,
        "serial number": "",
        "long name": "PILOT",
        "is vertical": false,
        "is locked": false,
        "is pos locked": false,
        "serial number label": {
            "pos string": "Bottom",
            "local pos": {
                "x": 16.666666666666668,
                "y": 36.25
            },
            "rows": 1,
            "font size": 10.0,
            "is visible": true
        },
        "long name label": {
            "pos string": "Top",
            "local pos": {
                "x": 0.0,
                "y": -20.0
            },
            "rows": 1,
            "font size": 12.0,
            "is visible": true
        },
        "channel": "10",
        "board": "GSE Controller",
        "normally open": false
    },
    "Tube 7": {
        "tube id": 7,
        "fluid": 0,
        "bend positions": {
            "0": {
                "x": 831.25,
                "y": 425.0
            },
            "1": {
                "x": 831.25,
                "y": 505.0
            }
        },
        "line width": 1.0
    },
    "Tube 8": {
        "tube id": 8,
        "fluid": 1,
        "bend positions": {
            "0": {
                "x": 831.25,
                "y": 707.5
            }
        },
        "line width": 1.0
    }
}
jtalier commented 2 years ago

Bug was fixed in f387d536a89b1913d53d51d7c5b75d719696679b. Issue arose while attempting to send avionics mappings to the server for logging when starting a campaign. This issue would only arise in the specific case that an object had no avionics_board attached but did have a channel. In that case a check for channel would pass but would then crash when trying to get the board prefix of 'Undefined'. Added in an extra check to make sure the board was defined to solve the issue. Commit f102c310c8e09c5ae0f91e5f48ea185e91d3a142 should now prevent an object having a channel with no board. Since this issue only exists on JackDoingSomeWork, it will be closed.