Christophe-Foyer / Motor-Test-Stand-GUI

GUI for the Washington University in Saint Louis Design/Build/Fly competition team
Other
0 stars 1 forks source link

Data Not Logging in CSV #7

Open austinstover opened 6 years ago

austinstover commented 6 years ago

Okay; so this one is an actual problem: We got a preliminary test stand built today and tested a motor, but the data we gathered doesn't get logged in the CSV. When I open the file afterwards, I only get 1 line of data.

Christophe-Foyer commented 6 years ago

That's probably because of the new looping architecture. Just make sure it appends to the dict rather than just changing the values. If not you can run it with console enabled and have it print the dict before it saves to the csv to see if that's the issue

Christophe-Foyer commented 6 years ago

Also stop assigning problems to me D:

Christophe-Foyer commented 6 years ago

Also, I just realized how hard this is going to be for me to debug. While coding the GUI was pretty easy to do independently of the test stand, I don't have any of the hardware so I'd have to spoof data in software which is more work than I want. I'm assigning this back to you and your team Austin, you can add collaborators if you want.

This is likely where the issue is happening, though I don't see anything wrong myself: https://github.com/Christophe-Foyer/Motor-Test-Stand-GUI/blob/7b660a878ae43761c05b95dd7440024bf62991da/source/Control%20Panel.py#L126-L137

Tell me if I can help, though this is a weird issue indeed.

austinstover commented 6 years ago

@Christophe-Foyer Could it be self.loggedData = []? Isn't that where we are storing the data?

def logData(self):
        if self.logstate.get():
            self.logButton.configure(text = 'Start Data Logging')
            self.logButton.configure(bg = 'blue')
            self.logstate.set(False)
        else:
            self.logButton.configure(text = 'Stop Data Logging')
            self.logButton.configure(bg = 'orange')
            self.logstate.set(True)
            self.loggedData = []

Does pressing the "Stop Data Logging" button delete all of the data right now?

Christophe-Foyer commented 6 years ago

ah yes, probably want to remove that last line, not sure why we would need it since it autodeclares it in runlog(). Let me edit that and you can test it. EDIT: done.

Christophe-Foyer commented 6 years ago

ok, now that I'm back into Python and I know what I'm doing, debugging was actually really easy, I had the logfile overwrite every time I believe so now it should just append after cleaning up the logfile:

https://github.com/Christophe-Foyer/Motor-Test-Stand-GUI/blob/355a7b5f0f28f9b378deb3dd69b85c51c5354b38/source/Control%20Panel.py#L445-L449

hopefully this fixes the issue since I have no way to test it. I'll look into making a more robust interface in the future which will uses pandas dataframes and dropdown menus and such.

EDIT: This was more likely the real issue,

l.append(data)
self.loggedData = l 

changed to self.loggedData.append(data) with an initialized empty self.loggedData list