Week 10: Mechanical, Machine Design
Prior Experience: 1/5
I have never made a machine or anything mechanical before. I do have experience coding up interfaces.
The Machine: Barduino
Our group made a machine that makes cocktails! It consists of a turntable mechanism and has 6 pumps, each with a cup holder under it. A user first loads the cups onto the machine. Then they can specify what drinks they want (specific ratios of liquids or preset drinks) and the quantity on the UI. The machine then makes the drinks by rotating the cups and pumping the appropriate amounts of each liquid into each cup. At the end, a magnetic stirrir attached to a string mixes the cocktail.
Group documentation can be found here.
My Contribution
I mostly worked on the user interface and integration.
User Interface
The user interface was written using PyQt5. I've never used it before, so it took some time to get familiar with. I feel like a website might have been easier (since HTML/CSS/JavaScript are pretty easy to work with).
I added a feature that allows you to check a "Same Drink" box in the drink settings page, allowing you to use the same settings for the remaining drinks. Before this feature was added, you had to select drink options (quantities for each liquid) for every drink you ordered.
Integration
I wrote a function that parses input from the user interface into a form that Robin's pump function takes in. It takes in a drink orders array with dimension (# drinks, # pumps), where each row corresponds to the liquid amounts for each pump for the corresponding drink. My function then returns an array, where each column corresponds to a timestep and consists of tuples (pump, amount), sorted by the amount. This allows for Robin's function to then schedule each pump to dispense the given amounts.
The key to this function was left rotating each row of the input array by the index of the row, which ensures that the array is shifted, and every column corresponds to a timestep (then transpose it).