update bill of materials with latest info
[challenge-bot] / bill-of-materials.rkt
index 55e6c5e24c264eae87f32b16a03f618de1031fa7..2d087c611d5bef458806bc3ef0e9e3ed5c4b50f3 100755 (executable)
 (module+ main
   (displayln total-cost))
 
-;; TODO: describe in detail what each field is
+;; the robot is made of a bunch of items, like a screw or a motor.
+
+;; this is a description of items in general.
 (struct item
-  (description quantity unit-cost max-lead-days where-to-get note))
+  (;; each item has a natural language description what the part is.
+   description
+
+   ;; how many units of this item are on a single robot
+   quantity
+
+   ;; how much does a single unit of these items cost
+   unit-cost
+
+   ;; how many days will it take to get the item
+   max-lead-days
+
+   ;; how to obtain the item
+   where-to-get
+
+   ;; any special notes about the item
+   note))
+
+;; usually, the above code would be enough for describing a bunch of
+;;  items.  unfortunately, the last argument, for the parameter 'note',
+;;  must be supplied in the default item constructor created above.
+;; this constructor below, called 'make-item', allows creating
+;;  items without supplying the argument for the parameter 'note'.  if
+;;  the 'note' argument is not supplied, it will be replaced by the
+;;  empty string, "".
 (define (make-item
          description quantity unit-cost max-lead-days where-to-get
          [note ""])
   (item description quantity unit-cost max-lead-days where-to-get note))
+
+;; TODO: add deck
+;; TODO: add actual cost for screws, nuts, and other estimated parts
+;; TODO: add male-female jump wires for connecting sonar sensors
+;; TODO: add 3d printer filament cost for wheel, sonar sensor holders,
+;;       caster standoff
+;; TODO: add ball caster
+;; TODO: add 9v battery holder and 9v battery
+;; TODO: checkout the following, if it's not a fraud, buy for next class
+;;; (string-append
+;;;  "http://www.ebay.com/itm/UNO-R3-Development-Board-MEGA328P-"
+;;;  "ATMEGA16U2-For-Arduino-Compatible-USB-Cable/201090526898")
+;;; only $9.99 for arduino uno r3 + usb!!
 (define bill-of-materials
   (list
-   ;; TODO: add solid core wires
-   ;; TODO: add male-female jump wires for connecting sonar sensors
-   ;; TODO: add 4x AA batteries
-   ;; TODO: add 4x AA battery holder
-   ;; TODO: add 3d printer filament cost for wheel, sonar sensor holders,
-   ;;       caster standoff
-   ;; TODO: add ball caster
-   ;; TODO: add angle bracket from evil mad science
+   ;; the construction of the first item is heavily commented.
+   ;; the higher amount of commenting is intended to make it clear
+   ;;  how the code works to new readers
+   (make-item (string-append
+               ;; this is the argument for the parameter 'description'.
+               ;; it's a description of the orange wire.  this is for
+               ;;  documentation.
+               "solid core orange 22 awg wire, male-male jump wire."
+               "  units in mm.  makes electrical connection between"
+               " arduino and motor controller, used for backwards"
+               " enabling.")
+
+              ;; this is the argument for the parameter 'quantity'.
+              ;; this is the number of millimeters of orange wire
+              ;;  in a single robot kit.
+              ;; there are 2 orange wires, one for each wire.
+              ;; the 120 mm wire reaches to the far side of the
+              ;;  motor controller
+              (+ 120 90)
+
+              ;; this is the argument for the parameter 'unit-cost'.
+              ;; the cost on jameco is 7.95 for 100 feet.
+              ;; this calculation converts from dollars per foot to
+              ;;  dollars per millimeter.
+              ;; there are 100 feet, 12 inches per foot, 2.54 cm / inch,
+              ;;  and 10 mm / cm.
+              ;; the product of all these numbers is the number of
+              ;;  millimeters purchased with $7.95
+              (/ 7.95 (* 100 12 2.54 10))
+
+              ;; this is the argument for the parameter 'max-lead-days'.
+              ;; since the part is at jameco, i can pick it up same day.
+              1
+
+              ;; this is the argument for the parameter 'where-to-get'.
+              ;; it is a url where the part can be purchased.
+              (string-append
+               "http://www.jameco.com/webapp/wcs/stores/servlet/Product"
+               "_10001_10001_2154871_-1"))
+
+   (make-item (string-append
+               "solid core blue 22 awg wire, male-male jump wire."
+               "  units in mm.  connects motor controller and arduino,"
+               " used for forwards enabling.")
+              (+ 120 90)
+              (/ 7.95 (* 100 12 25.4))
+              1
+              (string-append
+               "http://www.jameco.com/webapp/wcs/stores/servlet/Product"
+               "_10001_10001_36768_-1"))
+   (make-item (string-append
+               "solid core white 22 awg wire, male-male jump wire."
+               "  units in mm.  connects motor controller and arduino,"
+               " used for speed signal.")
+              (+ 120 90)
+              ;; cost of 1 mm
+              (/ 7.95 (* 100 12 25.4))
+              1
+              (string-append
+               "http://www.jameco.com/webapp/wcs/stores/servlet/Product"
+               "_10001_10001_36881_-1")
+              (string-append "unit cost goes down for large orders,"
+                             " see page for specifics"))
+   (make-item (string-append
+               "solid core green 22 awg wire, male-male jump wire."
+               "  units in mm.  connects motor to breadboard.")
+              (* 2 175)
+              (/ 7.95 (* 100 12 25.4))
+              1
+              (string-append
+               "http://www.jameco.com/webapp/wcs/stores/servlet/Product"
+               "_10001_10001_36822_-1"))
+   (make-item (string-append
+               "solid core yellow 22 awg wire, male-male jump wire."
+               "  units in mm.  connects motor to breadboard.")
+              (* 2 175)
+              (/ 7.95 (* 100 12 25.4))
+              1
+              (string-append
+               "http://www.jameco.com/webapp/wcs/stores/servlet/Product"
+               "_10001_10001_36920_-1"))
+   (make-item (string-append
+               "solid core red 22 awg wire, male-male jump wire."
+               "  units in mm.  connects power for all components.")
+              (+ (* 2 30) 25 25)
+              (/ 7.95 (* 100 12 25.4))
+              1
+              (string-append
+               "http://www.jameco.com/webapp/wcs/stores/servlet/Product"
+               "_10001_10001_36856_-1"))
+   (make-item (string-append
+               "solid core black 22 awg wire, male-male jump wire."
+               "  units in mm.  connects ground for all components.")
+              (+ (* 30 2) (* 4 25) 25 55)
+              (/ 7.95 (* 100 12 25.4))
+              1
+              (string-append
+               "http://www.jameco.com/webapp/wcs/stores/servlet/Product"
+               "_10001_10001_36792_-1"))
+   (make-item "4xAA battery"
+              4 (/ 17.99 100) 1
+              "http://www.frys.com/product/6292850"
+              "can get in store")
+   (make-item "4xAA battery holder"
+              1 2.25 1
+              (string-append
+               "http://shop.evilmadscientist.com/"
+               "productsmenu/partsmenu/422")
+              (string-append
+               "can get in store.  unit cost goes down for large orders"
+               ", see page for specifics."))
+   (make-item "angle bracket, 1/2 inch sides with #6-32 threaded hole"
+              4 0.75 1
+              (string-append
+               "http://shop.evilmadscientist.com/productsmenu/partsmenu"
+               "/465-bracket")
+              (string-append
+               "can get in store.  unit cost goes down for large orders"
+               ", see page for specifics."))
    (make-item "Arduino(tm) board"
               1 16.98 8
               (string-append
-               "http://www.colorapples.com/2012-new-arduino-uno-r3-board"
-               "-atmega328-with-usb-cable-p-89818.html#.U3Lz5nJKyzA")
-              "comes with USB A to B cable")
+               "http://www.colorapples.com/2012-new-arduino-uno-r3-boar"
+               "d-atmega328-with-usb-cable-p-89818.html#.U3Lz5nJKyzA")
+              (string-append
+               "comes with USB A to B cable.  unit cost goes down for"
+               " large orders, see page for specifics."))
    (make-item "motor" 2 6 7 "https://solarbotics.com/product/gm3/")
    (make-item "transparent 400 point (half) BreadBoard"
               1 5.95 1
                "http://www.jameco.com/webapp/wcs/stores/servlet/"
                "Product_10001_10001_2123830_-1"))
    (make-item "jumper wire female/male" 1/5 6 2
-              (string-append "http://www.nexuscyber.com/"
-                             "7-premium-40-pin-male-to-female-jumper-wires"))
+              (string-append "http://www.nexuscyber.com/7-premium-40-"
+                             "pin-male-to-female-jumper-wires"))
    (make-item "small squares of double sided tape"
               1/30 12 1
               (string-append
-               "http://www.officedepot.com/"
-               "a/products/495242/Scotch-Permanent-Double-Sided-Foam-Tape/"))
+               "http://www.officedepot.com/a/products/495242/"
+               "Scotch-Permanent-Double-Sided-Foam-Tape/"))
    ;; TODO: get actual cost of #4-40 phillips 1&1/4" screws
    (make-item "#4-40 Phillips 1 1/4 inch screws"
               3 .1 1