mouse_joystick_controller/.metadata/metadata.org

651 lines
18 KiB
Org Mode

#+EXPORT_FILE_NAME: ../README.md
#+OPTIONS: toc:1 |:t ^:nil tags:nil
# Place warning at the top of the exported file
#+BEGIN_EXAMPLE
<!-- This file is generated automatically from metadata -->
<!-- File edits may be overwritten! -->
#+END_EXAMPLE
* Project Specific Variables :noexport:
#+NAME: project-name
#+BEGIN_SRC text :exports none :noweb yes
mouse_joystick_controller
#+END_SRC
#+NAME: repository-name
#+BEGIN_SRC text :exports none :noweb yes
mouse_joystick_controller
#+END_SRC
#+NAME: version
#+BEGIN_SRC text :exports none :noweb yes
2.0
#+END_SRC
#+NAME: description
#+BEGIN_SRC text :exports none :noweb yes
Janelia mouse joystick controller for the Dudman lab experiments.
#+END_SRC
#+NAME: references
#+BEGIN_SRC text :exports none :noweb yes
https://www.kicad.org/
https://www.transducertechniques.com/rts-torque-sensor.aspx
https://placidindustries.com/products/brakes/magnetic-particle-brakes/magnetic-particle-brake-b5z/
https://www.newark.com/broadcom-limited/hedr-5421-ep111/encoder-incremental-2-ch/dp/58Y4773
https://www.linengineering.com/products/stepper-motors/hybrid-stepper-motors/208-series/208-13-01/WO-208-13-01D
https://www.pololu.com/product/2267
#+END_SRC
#+NAME: creation-date
#+BEGIN_SRC text :exports none :noweb yes
2017-08-14
#+END_SRC
#+NAME: kicad-version
#+BEGIN_SRC text :exports none :noweb yes
7.0.11
#+END_SRC
* General and Derived Variables :noexport:
#+NAME: release-month-day
#+BEGIN_SRC emacs-lisp :exports none :noweb yes
(format-time-string "%m-%d")
#+END_SRC
#+NAME: release-year
#+BEGIN_SRC emacs-lisp :exports none :noweb yes
(format-time-string "%Y")
#+END_SRC
#+NAME: release-date
#+BEGIN_SRC text :exports none :noweb yes
<<release-year()>>-<<release-month-day()>>
#+END_SRC
#+NAME: license
#+BEGIN_SRC text :exports none :noweb yes
BSD-3-Clause
#+END_SRC
#+NAME: guix-license
#+BEGIN_SRC text :exports none :noweb yes
license:bsd-3
#+END_SRC
#+NAME: license-files
#+BEGIN_SRC text :exports none :noweb yes
LICENSE
#+END_SRC
#+NAME: repository-organization
#+BEGIN_SRC text :exports none :noweb yes
janelia-kicad
#+END_SRC
#+NAME: forge
#+BEGIN_SRC text :exports none :noweb yes
github.com
#+END_SRC
#+NAME: repository-url
#+BEGIN_SRC text :exports none :noweb yes
https://<<forge>>/<<repository-organization>>/<<repository-name>>
#+END_SRC
#+NAME: git-clone-url-ssh
#+BEGIN_SRC text :exports none :noweb yes
git@<<forge>>:<<repository-organization>>/<<repository-name>>.git
#+END_SRC
#+NAME: author-given-name
#+BEGIN_SRC text :exports none :noweb yes
Peter
#+END_SRC
#+NAME: author-family-name
#+BEGIN_SRC text :exports none :noweb yes
Polidoro
#+END_SRC
#+NAME: author
#+BEGIN_SRC text :exports none :noweb yes
<<author-given-name>> <<author-family-name>>
#+END_SRC
#+NAME: email
#+BEGIN_SRC text :exports none :noweb yes
peter@polidoro.io
#+END_SRC
#+NAME: affiliation
#+BEGIN_SRC text :exports none :noweb yes
Howard Hughes Medical Institute
#+END_SRC
#+NAME: copyright
#+BEGIN_SRC text :exports none :noweb yes
<<release-year()>> <<affiliation>>
#+END_SRC
#+NAME: programming-language
#+BEGIN_SRC text :exports none :noweb yes
KiCad
#+END_SRC
#+NAME: image-width
#+BEGIN_SRC text :exports none :noweb yes
1280px
#+END_SRC
#+NAME: documentation-dir
#+BEGIN_SRC text :exports none :noweb yes
documentation
#+END_SRC
#+NAME: bom-dir
#+BEGIN_SRC text :exports none :noweb yes
<<documentation-dir>>/bom
#+END_SRC
#+NAME: fabrication-dir
#+BEGIN_SRC text :exports none :noweb yes
<<documentation-dir>>/fabrication
#+END_SRC
#+NAME: pcb-dir
#+BEGIN_SRC text :exports none :noweb yes
<<documentation-dir>>/pcb
#+END_SRC
#+NAME: reference-dir
#+BEGIN_SRC text :exports none :noweb yes
<<documentation-dir>>/reference
#+END_SRC
#+NAME: schematic-dir
#+BEGIN_SRC text :exports none :noweb yes
<<documentation-dir>>/schematic
#+END_SRC
* About
#+BEGIN_SRC markdown :noweb yes
- Project Name: <<project-name>>
- Description: <<description>>
- Version: <<version>>
- Kicad Version: <<kicad-version>>
- Release Date: <<release-date>>
- Creation Date: <<creation-date>>
- License: <<license>>
- URL: <<repository-url>>
- Author: <<author>>
- Email: <<email>>
- Copyright: <<copyright>>
- References:
- <<references>>
#+END_SRC
* Images
#+BEGIN_SRC python :noweb yes :exports results :results output raw
from pathlib import Path
file_path_strings = ['raytrace.png',
'top.png',
'bottom.png',
'front.png',
'back.png',
'left.png',
'right.png']
for file_path_string in file_path_strings:
path = Path('..') / Path('<<pcb-dir>>') / Path(file_path_string)
if path.is_file():
print(f'#+html: <img src="./<<pcb-dir>>/{path.name}" width="<<image-width>>">\n')
#+END_SRC
* Schematic
#+BEGIN_SRC python :noweb yes :exports results :results output raw
from pathlib import Path
path = Path('..') / Path('<<schematic-dir>>')
for child in path.iterdir():
if '.pdf' in str(child):
print(f'[[file:./<<schematic-dir>>/{child.name}][./<<schematic-dir>>/{child.name}]]\n')
#+END_SRC
#+BEGIN_SRC python :noweb yes :exports results :results output raw
from pathlib import Path
from re import search
from collections import OrderedDict
path = Path('..') / Path('<<schematic-dir>>')
svg_dict = {}
for child in path.iterdir():
if '.svg' in str(child):
text = child.read_text()
# sort by Id inside svg text
match_object = search('Id:\s*(\d*)', text)
number = int(match_object.groups()[0])
svg_dict[number] = f'#+html: <img src="./<<schematic-dir>>/{child.name}" width="<<image-width>>">'
sorted_svg_dict = OrderedDict(sorted(svg_dict.items()))
for svg_string in sorted_svg_dict.values():
print(f'{svg_string}\n')
#+END_SRC
* PCB
#+BEGIN_SRC python :noweb yes :exports results :results output raw
from pathlib import Path
file_path_strings = ['<<project-name>>-User_Drawings.svg',
'<<project-name>>-F_Silkscreen.svg',
'<<project-name>>-B_Silkscreen.svg',
'<<project-name>>-F_Fab.svg',
'<<project-name>>-B_Fab.svg']
for file_path_string in file_path_strings:
path = Path('..') / Path('<<pcb-dir>>') / Path(file_path_string)
if path.is_file():
print(f'#+html: <img src="./<<pcb-dir>>/{path.name}" width="<<image-width>>">\n')
#+END_SRC
* Bill of Materials
** Board
#+NAME: pcb-parts
#+BEGIN_SRC python :noweb yes :exports results :results value table
from kicad_bom import KicadBom
kb = KicadBom('../<<project-name>>/', '../<<bom-dir>>')
kb.save_all_csv_files()
column_names = ['Item',
'Reference(s)',
'Description',
'Manufacturer Part Number',
'Manufacturer',
'Quantity',
'Package']
format_for_org_table = True
bom = kb.get_bom(column_names, format_for_org_table)
return bom
#+END_SRC
** Supplemental
| Item | Description | Manufacturer Part Number | Manufacturer | Quantity |
|------+----------------------------------+---------------------------------+--------------------+----------|
* Notes
** Actuators
*** Stepper Motors
**** Big
SOYO SY42STH38-1684A
**** Little
Lin Engineering WO-208-13-01D-RO
*** Brake
Placid Industries B5Z-24-1R Magnetic Particle Brake
- Current control 0-0.049 A at 24 V
** Sensors
*** Torque Sensor
Transducer Techniques RTS-5
- wheatstone bridge
*** Encoder
Newark HEDR-5421-EP111
- Two channel quadrature
*** Limit Switches
MiSUMi D2F-01FL
- Normally open or normally closed
* Development
** Install Guix
[[https://guix.gnu.org/manual/en/html_node/Binary-Installation.html][Install Guix]]
** Edit metadata.org
#+BEGIN_EXAMPLE
make metadata-edits
#+END_EXAMPLE
** Tangle metadata.org
#+BEGIN_EXAMPLE
make metadata
#+END_EXAMPLE
** Edit project
#+BEGIN_EXAMPLE
make kicad-edits
exit
#+END_EXAMPLE
* Tangled Files :noexport:
#+BEGIN_SRC org :tangle ../README.org :exports none :noweb yes
# This file is generated automatically from metadata
# File edits may be overwritten!
<<repository-info>>
#+END_SRC
#+BEGIN_SRC scheme :tangle guix/channels.scm :exports none :noweb yes
;; This file is generated automatically from metadata
;; File edits may be overwritten!
(list (channel
(name 'guix-janelia)
(url "https://github.com/guix-janelia/guix-janelia.git")
(branch "main")
(commit
"6d2cb9cdd679f90c1a4fb02af02d2d1cfe2fcca6"))
(channel
(name 'guix)
(url "https://git.savannah.gnu.org/git/guix.git")
(branch "master")
(commit
"3b5533f9bdac4a929c3d93e628ee2ae279013685")
(introduction
(make-channel-introduction
"9edb3f66fd807b096b48283debdcddccfea34bad"
(openpgp-fingerprint
"BBB0 2DDF 2CEA F6A8 0D1D E643 A2A0 6DF2 A33A 54FA")))))
#+END_SRC
#+BEGIN_SRC scheme :tangle guix/manifest.scm :exports none :noweb yes
;; This file is generated automatically from .metadata.org
;; File edits may be overwritten!
(specifications->manifest
'("kicad"
"kicad-doc"
"kicad-symbols"
"kicad-footprints"
"kicad-packages3d"
"kicad-templates"
"make"
"bash"
"git"
"emacs"
"emacs-org"
"emacs-ox-gfm"
"imagemagick"
"inkscape"
"python"
"python-ipython"
"python-kicad-bom"
"dosbox"
"freecad"
"font-orbitron"
"zip"
"pandoc"
"texlive-scheme-basic"
"texlive-adjustbox"
"texlive-booktabs"
"texlive-siunitx"
"texlive-graphics"
"texlive-geometry"
"texlive-ulem"
"libxslt"))
#+END_SRC
#+BEGIN_SRC text :tangle ../Makefile :exports none :noweb yes
# This file is generated automatically from .metadata.org
# File edits may be overwritten!
include .metadata/Makefile
#+END_SRC
#+BEGIN_SRC text :tangle Makefile :exports none :noweb yes
# This file is generated automatically from .metadata.org
# File edits may be overwritten!
MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
MAKEFILE_DIR := $(notdir $(patsubst %/,%,$(dir $(MAKEFILE_PATH))))
MAKEFILE_DIR_ABS := $(dir $(MAKEFILE_PATH))
KICAD_CONFIG_HOME := $(MAKEFILE_DIR_ABS).config/kicad/
GUIX-TIME-MACHINE = guix time-machine -C $(MAKEFILE_DIR)/guix/channels.scm
GUIX-SHELL = $(GUIX-TIME-MACHINE) -- shell -m $(MAKEFILE_DIR)/guix/manifest.scm
CONTAINER = --container -F -E "^DISPLAY$$" -E "^XAUTHORITY$$" --expose="$$XAUTHORITY" --expose=/tmp/.X11-unix/ --expose=$$HOME/.Xauthority --expose=/etc/machine-id
GUIX-CONTAINER = $(GUIX-SHELL) $(CONTAINER)
.PHONY: metadata-edits
metadata-edits:
$(GUIX-CONTAINER) -- sh -c "emacs -q --no-site-file --no-site-lisp --no-splash -l $(MAKEFILE_DIR)/emacs/init.el --file $(MAKEFILE_DIR)/metadata.org"
.PHONY: metadata
metadata:
$(GUIX-CONTAINER) -- sh -c "emacs --batch -Q -l $(MAKEFILE_DIR)/emacs/init.el --eval '(process-org \"$(MAKEFILE_DIR)/metadata.org\")'"
.PHONY: guix-shell
guix-shell:
$(GUIX-SHELL)
.PHONY: guix-container
guix-container:
$(GUIX-CONTAINER)
.PHONY: ipython-shell
ipython-shell:
$(GUIX-CONTAINER) -- ipython
.PHONY: kicad-edits
kicad-edits:
# $(GUIX-CONTAINER) -S /home/$(USER)/.config/kicad/7.0=$(MAKEFILE_DIR)/.config/kicad/7.0 -- kicad
# $(GUIX-SHELL) -- kicad
KICAD_CONFIG_HOME=$(KICAD_CONFIG_HOME) $(GUIX-SHELL) -E "^KICAD_CONFIG_HOME" -- kicad
.PHONY: freecad-edits
freecad-edits:
$(GUIX-SHELL) -- FreeCAD
.PHONY: filter-edits
filter-edits:
$(GUIX-SHELL) -- sh -c "dosbox documentation/filter/FILTER42.exe"
.PHONY: skip-worktree-config
skip-worktree-config:
git ls-files -z .metadata/.config/ | xargs -0 git update-index --skip-worktree
.PHONY: no-skip-worktree-config
no-skip-worktree-config:
git ls-files -z .metadata/.config/ | xargs -0 git update-index --no-skip-worktree
.PHONY: ls-files-config
ls-files-config:
git ls-files .metadata/.config/ -v
.PHONY: cropped-svg
cropped-svg:
# $(GUIX-SHELL) -- inkscape -D --export-overwrite --export-plain-svg documentation/pcb/*.svg
inkscape -D --export-overwrite --export-plain-svg documentation/pcb/*.svg && inkscape -D --export-overwrite --export-plain-svg documentation/schematic/*.svg
.PHONY: trimmed-images
trimmed-images:
mogrify -trim documentation/pcb/*.png
.PHONY: zipped-gerbers
zipped-gerbers:
$(GUIX-SHELL) -- sh -c "rm -f documentation/gerbers/*.zip && zip -j -r documentation/gerbers/<<project-name>>-<<pcb-version>>.zip documentation/gerbers"
#+END_SRC
#+BEGIN_SRC scheme :tangle emacs/init.el :exports none :noweb yes
;; This file is generated automatically from metadata
;; File edits may be overwritten!
(require 'org)
(require 'ox-org)
(eval-after-load "org"
'(require 'ox-gfm nil t))
(setq make-backup-files nil)
(setq org-confirm-babel-evaluate nil)
(org-babel-do-load-languages
'org-babel-load-languages
'((org . t)
(emacs-lisp . t)
(lisp . t)
(shell . t)
(python . t)
(scheme . t)))
(setq org-babel-python-command "python3")
(setq python-indent-guess-indent-offset t)
(setq python-indent-guess-indent-offset-verbose nil)
(setq org-edit-src-content-indentation 0
org-src-tab-acts-natively t
org-src-preserve-indentation t)
(defun tangle-org (org-file)
"Tangle org file"
(unless (string= "org" (file-name-extension org-file))
(error "INFILE must be an org file."))
(org-babel-tangle-file org-file))
(defun export-org-to-markdown (org-file)
"Export org file to gfm file"
(unless (string= "org" (file-name-extension org-file))
(error "INFILE must be an org file."))
(let ((org-file-buffer (find-file-noselect org-file)))
(with-current-buffer org-file-buffer
(org-open-file (org-gfm-export-to-markdown)))))
(defun export-org-to-pdf (org-file)
"Export org file to pdf file"
(unless (string= "org" (file-name-extension org-file))
(error "INFILE must be an org file."))
(let ((org-file-buffer (find-file-noselect org-file)))
(with-current-buffer org-file-buffer
(org-open-file (org-latex-export-to-pdf)))))
;; (defun process-org (org-file)
;; "Tangle and export org file"
;; (progn (tangle-org org-file)
;; (export-org-to-markdown org-file)
;; (export-org-to-pdf org-file)))
(defun process-org (org-file)
"Tangle and export org file"
(progn (tangle-org org-file)
(export-org-to-markdown org-file)))
(make-variable-buffer-local 'org-export-filter-final-output-functions)
(defun my-double-blank-line-filter (output backend info)
(replace-regexp-in-string "^\n+" "\n" output))
(add-to-list 'org-export-filter-final-output-functions
'my-double-blank-line-filter)
(defun my-result-keyword-filter (output backend info)
(replace-regexp-in-string "^#[+]RESULTS:.*\n" "" output))
(add-to-list 'org-export-filter-final-output-functions
'my-result-keyword-filter)
(defun my-export-filename-filter (output backend info)
(replace-regexp-in-string "^#[+]EXPORT_FILE_NAME:.*\n" "" output))
(add-to-list 'org-export-filter-final-output-functions
'my-export-filename-filter)
(setq enable-local-variables nil)
(setq tangle-external-files t)
#+END_SRC
#+HEADER: :tangle (if tangle-external-files "../AUTHORS" "no")
#+BEGIN_SRC text :exports none :noweb yes
<<author>>
#+END_SRC
#+HEADER: :tangle (if tangle-external-files "../codemeta.json" "no")
#+BEGIN_SRC js :exports none :noweb yes
{
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
"@type": "SoftwareSourceCode",
"license": "https://spdx.org/licenses/<<license>>",
"codeRepository": "<<repository-url>>",
"dateCreated": "<<creation-date>>",
"dateModified": "<<release-date>>",
"name": "<<project-name>>",
"version": "<<version>>",
"description": "<<description>>",
"programmingLanguage": [
"<<programming-language>>"
],
"author": [
{
"@type": "Person",
"givenName": "<<author-given-name>>",
"familyName": "<<author-family-name>>",
"email": "<<email>>",
"affiliation": {
"@type": "Organization",
"name": "<<affiliation>>"
}
}
]
}
#+END_SRC
#+NAME: license-text
#+BEGIN_SRC text :exports none :noweb yes
Janelia Open-Source Software (3-clause BSD License)
Copyright <<copyright>>
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#+END_SRC
#+BEGIN_SRC text :tangle LICENSE :exports none :noweb yes
<<license-text>>
#+END_SRC
#+HEADER: :tangle (if tangle-external-files "../LICENSE" "no")
#+BEGIN_SRC text :exports none :noweb yes
<<license-text>>
#+END_SRC
;; Local Variables:
;; eval: (setq after-save-hook nil)
;; eval: (setq org-confirm-babel-evaluate nil)
;; eval: (setq tangle-external-files nil)
;; End: