Maker Faire NYC

My first Maker Faire. Saw some neat stuff. Good energy. Declan made a write up.

Things to investigate:

CircuitStudio / circuitmaker – circuit design software a la Fusion 360 business model from altium. Windows only? Don’t like that

OctoPart – electronic components footprints and BOM

Mesh – Little IoT buttons and sensors

Sam Zeloof – Smart ass kid making his own IC sam.zeloof.xyz

Tindie – Can I buy useful boards from here?

www.photogrammetry.today – Maybe some photogrammetry tips? Hmm. Not anything there yet

plantum.ai another really smart kid doing machine learning

Makerlogic – www.makerlogic.com A guy pushing FPGA education. Max10 based board. Not much there yet

https://shop.openh.io/collections/all – 4G enabled rapsberry pi shields

www.up-board.org – small form factor intel computers and accessories. Keep an eye out for update in realsense in October.

makerscad.com – an interesting combo scratch and openscad javascript kind of thing. Also has physics engines?

 

 

Cellular Automata in Haskell

Ben recently tried this and I wanted to see if I could do it my way

I’ve seen this done (Bartosz?) before but I tried to do it without looking anything up.

The comonad is an interesting pattern to use. It automates the translation invariant nature off the cellular automata. This would also be useful for translationally invariant PDEs like the simple wave equation or others.

I used the laziness of Haskell to start with an infinite plane of zeros. Of course if you ever want to look at it, you need to pick a finite slice at the end using dtake

{-# LANGUAGE DeriveFunctor, DeriveFoldable, DeriveTraversable #-}
import Control.Comonad
import Data.Bits

{-
example usage
This pushes forward the initial state forward by 1 time step according to rule 30
let s1 = extend (cellRule 30) initState

Comments:
My rule is coming out right-left swapped compared to Wolfram?
I should probably custom implement Show, since the left list is printed out of order
-}


 -- a two sided list with focus
 --alternatively may be preferable to not use those inner lists and instead make more recursive.
 --I have implicitly assume that these lists are infinite, which is bad practice. Sorry.
data DoubleList a = DList [a] a [a] deriving (Functor, Show)

data CellValue = Alive | Dead deriving Show

lshift (DList (l:ls) x rs) = DList ls l (x:rs) 
rshift (DList ls x (r:rs)) = DList (x:ls) r rs

toList (DList ls x rs) = ls ++ [x] ++ rs
lList (DList ls _ _) = ls
rList (DList _ _ rs) = rs

-- truncates the Dlist to 2n + 1
dtake n (DList ls x rs) = DList (take n ls) x (take n rs)

--kind of ugly
--f is a function that uses the context
-- patches together the result out of doing it on shifted Dlists
instance Comonad DoubleList where
  extract (DList _ x _) = x
  extend f z = DList (l:ls) (f z) (r:rs) where
    lDList = extend f (lshift z)
    ls = lList lDList
    l = extract lDList
    rDList = extend f (rshift z)
    rs = rList rDList
    r = extract rDList

cellToNum Alive = 1
cellToNum Dead  = 0
cellNeighborToNum x y z = x' + 2 * y' + 4 * z' where
  x' = cellToNum x
  y' = cellToNum y
  z' = cellToNum z

cellRule :: Int -> (DoubleList CellValue -> CellValue )
cellRule rulenum (DList (l:ls) x (r:rs)) = if testBit rulenum y then Alive else Dead where
  y = cellNeighborToNum l x r :: Int
   


initState = DList deads Alive deads where deads = repeat Dead



 

 

Ordered pairs in Idris

I implemented an ordered pair type in Idris. Took me a while.

https://github.com/idris-lang/Idris-dev/blob/master/libs/prelude/Prelude/Nat.idr

Already has an inequality type. That may have been better to use.

Exploration and guesswork was necessary. How the heck do I get a hotkey for holes in atom?

The first couple Opairs are ordinary pairs. Just exploring the syntax.

I switched out of InEq which explicitly stores the number it is talking about to better match the equality type.

The Inequality type acts something like a mix of Nat and Equality.

My head hurts and I’m dehydrated.

 

data OPair1 a = SimplePair1 a a

data OPair2 : Type -> Type where
  SimplePair2 : a -> a -> OPair2 a

data OPair3 : Type -> Type where
  SimplePair3 : (Ord a) => a -> a -> OPair3 a

data InEq : Nat -> Nat -> Type where
  Refly : (t:Nat) -> InEq t t
  Succy : InEq a b -> InEq a (S b)

data InEq' : Nat -> Nat -> Type where
  Refly' : InEq' t t
  Succy' : InEq' a b -> InEq' a (S b)

data InEq'' : Nat -> Nat -> Type where
  Refly'' : InEq'' Z t
  Succy'' : InEq'' a b -> InEq'' (S a) (S b)


data OPair4 : Type where
  SPair : (t : Nat) -> (s : Nat) -> (InEq t s) -> OPair4

data OPair5 : Type where
  SPair5 : (t : Nat) -> (s : Nat) -> (InEq' t s) -> OPair5

-- a useful lemma
convert4 : InEq' s t -> InEq' (S s) (S t)
convert4 Refly' = Refly'
convert4 (Succy' x) = Succy' (convert4 x)

addpair : OPair5 -> OPair5 -> OPair5
addpair (SPair5 s s Refly') (SPair5 k k Refly') = SPair5 (s+k) (s+k) Refly'
addpair (SPair5 Z Z Refly') (SPair5 t b p) = (SPair5 t b p)
addpair (SPair5 (S x) (S x) Refly') (SPair5 t b p) = addpair (SPair5 x x Refly') (SPair5 (S t) (S b) (convert4 p))
addpair (SPair5 x (S y) (Succy' z)) (SPair5 t b p) = addpair (SPair5 x y z) (SPair5 t (S b) (Succy' p))
--addpair (SPair5 t (S b) (Succy' x)) (SPair5 k s y) = addpair (SPair5 t b x) (SPair5 k (S s) (Succy' y))




convert : (t : Nat) -> (s : Nat) -> InEq' t (s + t)
convert t Z = Refly'
convert t (S k) = Succy' (convert t k)

convert2 : (s : Nat) -> InEq' 0 (plus s 0)
convert2 s = convert Z s

--convert3 : InEq' 0 (plus s 0) -> InEq' 0 s
--convert3 p = replace ?sda ?sdf

convert3 : (s : Nat) -> InEq' 0 s
convert3 s = replace (plusZeroRightNeutral s) (convert2 s)


incrementpair : OPair5 -> OPair5
incrementpair (SPair5 x y z) = SPair5 (S x) (S y) (convert4 z)

sortpair : (Nat,Nat) -> OPair5
sortpair (Z, Z) = SPair5 Z Z Refly'
sortpair (Z, y) = SPair5 Z y (convert3 y)
sortpair (y, Z) = sortpair (Z, y)
sortpair (S x, S y) = incrementpair (sortpair (x,y))
--sortpair (S x, S y) = addpair (SPair5 1 1 Refly') (sortpair (x,y))



--addpair (SPair5 x x Refly') (SPair5 x2 y2 p) = (SPair5 (x2+x) (y2+x) p)
--addpair (SPair5 x (S y) (Succy' p1)) (SPair5 x2 y2 p) = addpair (SPair5 x y p1) (SPair5 x2 (S y2) (Succy' p1))

{-
natToInEq : Nat -> InEq' Z t
natToInEq Z = Refly'
notToIneq (S x) = Succy' (natToInEq x)

maybeOPair : Nat -> Nat -> Maybe OPair5
maybeOPair a b = if (a <= b) then Just (SPair5 a b (natToInEq (b-a)))else Nothing
-- sortpair is a better maybepair. maybepair could be implemented

-}

 

Position Tracking using Wifi

http://web.stanford.edu/~mkotaru/wicapture

I have been aware of machine learning projects that use RSSI (signal strength) (for example, try typing iwconfig in a linux terminal. You can grep that for signal strength.)

CSI (channel state information) is more though. Uses alternative firmware. Gets you phase sensitivity.

https://dhalperi.github.io/linux-80211n-csitool/index.html#external

mini PCIe is a pain. Many laptops support it and mini pcs. But still, that is a ~100$ investment or so.

plausible but unconfirmed alternative for atheros cards

http://pdcc.ntu.edu.sg/wands/Atheros/#PLT

Another paper describing localization

Click to access 110_report.pdf

Click to access nsdi16-paper-vasisht.pdf

LimeSDR, gettin going

 

I had trouble installing the ppa the first time I tried about a month ago. It seemed to go through the second time around

Install LimeSuite using the ppa instructions for ubuntu. I have 16.04

https://wiki.myriadrf.org/Lime_Suite

lsusb shows OpenMoko as the device. Odd.

https://wiki.myriadrf.org/LimeSDR_Quick_Start

 

Ok. A capitalized command LimeSuiteGUI is insane. No commands are capitalized.

It brings up some spaceship of cryptic options.

Some of the stuff in the top menu bar seems good. Connecting, Programming, FFT, etc.

The commands

LimeUtil –info

LimeUtil –find

Lists a device. So that’s good. Also does updating?

 

Added a myriad RF ppa for gnuradio

https://wiki.myriadrf.org/Packaging

sudo apt-get install gnuradio gnuradio-dev

Also installed gqrx. This is very useful for determining if the goddamn thing is working at all

Install Gqrx SDR on Ubuntu Linux

 

 

Ok. GQRX was crashing on boot.

So was gnuradio when I tried playing with the osmocom source

GNU C++ version 5.4.0 20160609; Boost_105800; UHD_003.010.001.001-release

ImportError: /usr/lib/python2.7/dist-packages/gnuradio/uhd/_uhd_swig.x86_64-linux-gnu.so: undefined symbol: _ZN3uhd4usrp10multi_usrp7ALL_LOSB5cxx11E

so did python

from gnuradio import uhd

Eventually I apt get installed libuhd-dev which makes gqrx run now with an rtl-sdr

gqrx with line

soapy=0,driver=lime

should work but didn’t

 

Hmm another twist

Limesdr is power hungry

I may not have a usb3 port on my 2012 desktop insane as that sounds

so i need external power? I wonder if that is what the blinking led signifies

 

Trying to install in windows now. Maybe that will work better

Install PothosSDR

After running zadig can recognize an rtl-sdr in gqrx

https://wiki.myriadrf.org/Lime_Suite#USB_driver

Install the drivers as specified for limesdr.

I accidentally installed the x86 instead of the x64 drivers and needed to uninstall with deletion and then reinstall properly. Got error code 48

It appears to be working.

https://wiki.myriadrf.org/LimeSDR-USB_Quick_Test

GQRX opens.

 

 

It has been months since I tried in ubuntu 16.04. Maybe things have gotten better.

ok. At first gqrx wouldn’t load but after fiddling with the sampling and bandwidth it does. I don’t get any FM signals with nothing attached to the Lime. That is either good or bad. It does appear to be receiving data at least though.

 

So I have not gotten gqrx to actually receive signals with limesdr, but gnuradio appears to be working to some degree. This graph plays audio on 101.5 although very crappily. I hope it just needs filtering (I think I should be low passing those resamplers. Also I probably shouldn’t be receiving on the middle of the band where the DC spike is). I doubled the resampler because a single resampler through an error for too much decimation. Is this standard procedure?

simple_lime_fm-grc

Useful gnuradio tutorials

Click to access Lab_1-5.pdf

Possibly useful blog series

https://myriadrf.org/blog/limesdr-made-simple-part-4-pothos-beyond/

 

ok. Next step is simple transmit and receive

 

 

 

3d printing Linkages

http://courses.csail.mit.edu/6.S080/lectures/

I’m starting by trying to make a simple scissor linkage. The challenge is the rotating joint

https://cad.onshape.com/documents/3059e980b4da0ff99d88ea44/w/4c2b782c058966f3b9c1536a/e/aa1873edd5c2e8f11c7c89a3

I decrease the radius of the peg by 0.5mm compared to the hole. This gave me a nice fit. Slides smoothly, doesn’t pop out.

Hmm Only for the center hole though. The other’s are much too loose.

took about 1:10 to print 8

took about 12 mins to print 1

0.3 is definitely too big

0.4 is nice and tight. But it isn’t good enough. The thing still wants to get out of the hinge.

Back to the drawing board. A three piece design? Or just make the pegs and holes longer?

 

Update: I extended the holes so the diameter equals the length. It works GORGEOUS.

 

http://www.cs.columbia.edu/cg/deployable/deployable.pdf

I printed a circular version. You just need to angle the bars of the scissor by 2 *pi/N where N is the number of sides of the polygon you want.

 

 

Notes on ROS and ORB SLAM 2

https://github.com/raulmur/ORB_SLAM2

This seems like the most recent openly available slam package I could find. So let’s try it out

whenever using ros always

source /opt/ros/kinetic/setup.bash

run

roscore

 

when using ros

rosnode info or rosnode list to inspect running nodes

rostopic gets the avaiable messages

Something like this. However, should edit the yaml config file

sudo apt-get install ros-kinetic-usb-cam

rosrun usb_cam usb_cam_node

To inspect the image

rosrun image_view image_view imag=/usb_cam/image_raw

rosrun usb_cam usb_cam_node __name:=camera

changes the topic name to camera

 

rosrun ORB_SLAM2 Mono Vocabulary/ORBvoc.txt Examples/Monocular/TUM1.yaml

Dang. I’m pretty impressed. With a bad calibration file and no tuning, it works ok in short term. Blur clearly seems like an issue.

The contents of the example yaml config

%YAML:1.0

#--------------------------------------------------------------------------------------------
# Camera Parameters. Adjust them!
#--------------------------------------------------------------------------------------------

# Camera calibration and distortion parameters (OpenCV) 
Camera.fx: 517.306408
Camera.fy: 516.469215
Camera.cx: 318.643040
Camera.cy: 255.313989

Camera.k1: 0.262383
Camera.k2: -0.953104
Camera.p1: -0.005358
Camera.p2: 0.002628
Camera.k3: 1.163314

# Camera frames per second 
Camera.fps: 30.0

# Color order of the images (0: BGR, 1: RGB. It is ignored if images are grayscale)
Camera.RGB: 1

#--------------------------------------------------------------------------------------------
# ORB Parameters
#--------------------------------------------------------------------------------------------

# ORB Extractor: Number of features per image
ORBextractor.nFeatures: 1000

# ORB Extractor: Scale factor between levels in the scale pyramid 	
ORBextractor.scaleFactor: 1.2

# ORB Extractor: Number of levels in the scale pyramid	
ORBextractor.nLevels: 8

# ORB Extractor: Fast threshold
# Image is divided in a grid. At each cell FAST are extracted imposing a minimum response.
# Firstly we impose iniThFAST. If no corners are detected we impose a lower value minThFAST
# You can lower these values if your images have low contrast			
ORBextractor.iniThFAST: 20
ORBextractor.minThFAST: 7

#--------------------------------------------------------------------------------------------
# Viewer Parameters
#--------------------------------------------------------------------------------------------
Viewer.KeyFrameSize: 0.05
Viewer.KeyFrameLineWidth: 1
Viewer.GraphLineWidth: 0.9
Viewer.PointSize:2
Viewer.CameraSize: 0.08
Viewer.CameraLineWidth: 3
Viewer.ViewpointX: 0
Viewer.ViewpointY: -0.7
Viewer.ViewpointZ: -1.8
Viewer.ViewpointF: 500

 

Other things to consider LSD-SLAM

SVO

DSO

Actually, many people are recommending svo and dso saying orb_slam while the better behaving one, works poorly on the pi

https://github.com/uzh-rpg/rpg_open_remode

OpenSfm

http://theia-sfm.org/

Click to access 1701.08493.pdf

https://github.com/uoip/monoVO-python

http://avisingh599.github.io/vision/monocular-vo/

https://gist.github.com/nickoala/8d7e0bc24be3cec459e63bc1eb8cc858

Also a perhaps useful ROS short course

Old 6/16:

So I downloaded a cool looking package

https://github.com/uzh-rpg/rpg_svo

roslaunch svo_ros live.launch

You need to have a camera running

sudo apt-get install ros-jade-usb-cam

run with

rosrun usb_cam usb_cam_node

You can see it using image_viewer

rosrun image_viewer image_viewer image:=/cam_usb/image_raw

Change the param file in svo_ros so that the camera has the same resolution and stuff