Beach Cleaning Robot Blog

Photo commit/discard and logs.

Date: 2021-02-06
Author: Andrew

Started work on the photo save. In the previous version it would take a photo of whatever you were pointing at no matter whether it was in focus or not, had the item in shot or not, etc... Now through the UI you can see if the camera is pointing at litter and anything else you want in shot. However, there is always the potential to take a dud shot when you hit the button.

That is why we introduced the OK and cancel buttons. That also means that we need to introduce some persistence to the photo and any associated information such as the time it was taken and in future the prediction on what type of rubbish it holds.

I created a new class object that can be used to temporarily store all the information required and then if you hit the OK button it will commit to the image folder and update the logs. If you hit cancel it will discard the image and close the window.

The CapturedImage class was programmed up. However, you still need to actually have a image stored on the server to serve up for the confirm dialog on the UI. To solve this when the object is created then it also saves the image to a temp directory which can be served to the UI. I could have saved the image in the final image location but something didn't feel right about doing that.

If the user hits cancel the temp image is discarded. If the user hits OK then the temp image is committed to the image folder and the .csv log is updated with filename, date and time.

Today managed to set up the UI OK/Cancel route triggers, new object code, the temp image creation and the .csv updated on commit working before I ran out of energy.