Today, Chris and I humored the idea and checked out the possibility of coding an application for the Leap Motion. We share an idea for gesture control on computers for a more user-friendly control experience. The Leap Motion is a simple device that has an array of 3 infrared cameras. this allows it to see a large spectrum above the desk in front of the computer. It is small and compact, and is perfect for our needs on this project. Next Monday, I plan to begin setup and download the necessary sdk files, which they provide for free for developers online.
New month, new things brewing. Today I began the installation and setup of the Leap Motion and its sdk. The sdk gives helpful example codes and libraries that will help with the understanding of how to code and use the data that the leap motion collects in order to provide output. I have decided to use javascript to code what I want, since I would like to learn the language, and it is also very easy to display in a browser and manipulate in real time.
I plan to make some simple programs first in order to understand the ins and outs of the data and manipulations, and then go from there. After I have garnered an acceptable understanding, I want to start using the leap motion to recognize gestures and translate them to key emulations. This will allow me to start making gesture controls for the computer, which is the main end goal.
Today I went through the javascript tutorial for a simple leap motion app. It takes an image of a cat (how fitting) and moves it in respect to the hand in front of it. I learned that the leap service that is running creates a local websocket server that LeapJS connects to. This allows for real time data transfer to and from the browser, which is crucial to smooth performance of the Leap Motion. Using the websocket, the service sends a data frame roughly every 10ms. The deviceFrame object is not used directly by the browser, but instead creates an animation loop using the controller's animation frames.
You can access the movements of fingers and bones through their names, like thumb, pinky, carpal, proximal, medial and distal. Important Orientation Information
I was able to find a very useful file in the sdk named “sample.html”. This was very useful in showing just what The leap motion sees from a data standpoint, and depicts the output of a frame.
This is a sample frame collected by the leap:
Frame data:
Frame ID: 32565
Timestamp: 2003436343 µs
Hands: 1
Fingers: 5
Tools: 0
Gestures: 1
Translation: (8.7, 2.0, -0.2) mm
Rotation axis: (-0.36, 0.91, 0.20)
Rotation angle: 0.03 radians
Scale factor: 1.01
Hand data:
Hand ID: 13
Type: right hand
Direction: (-0.25, 0.43, -0.87)
Palm position: (70.7, 178.1, -6.3) mm
Grab strength: 0.0322437
Pinch strength: 0
Confidence: 0.892863
Arm direction: (-0.5, 0.3, -0.8)
Arm center: (157.6, 116.2, 147.2)
Arm up vector: (0.1, 0.9, 0.3)
Translation: (8.7, 2.0, -0.2) mm
Rotation axis: (-0.4, 0.9, 0.2)
Rotation angle: 0.03 radians
Scale factor: 1.01
Fingers IDs: 130, 131, 132, 133, 134
Finger and tool data:
Pointable ID: 130
Type: Thumb
Belongs to hand with ID: 13
Classified as a finger
Length: 51.4 mm
Width: 20.0 mm
Direction: (-0.76, 0.14, -0.63)
Extended?: true
Metacarpal bone
Center: (64.2, 148.2, 46.0)
Direction: (-0.6, 0.4, -0.7)
Up vector: (-0.6, 0.3, 0.8)
Proximal phalanx bone
Center: (42.3, 153.2, 35.9)
Direction: (-0.9, 0.2, -0.4)
Up vector: (-0.4, 0.2, 0.9)
Intermediate phalanx bone
Center: (7.6, 160.7, 15.2)
Direction: (-0.8, 0.1, -0.6)
Up vector: (-0.6, 0.2, 0.8)
Distal phalanx bone
Center: (-15.9, 165.7, 0.8)
Direction: (-0.9, 0.2, -0.3)
Up vector: (-0.3, 0.2, 0.9)
Tip position: (-20.4, 165.3, -2.4) mm
Pointable ID: 131
Type: Index finger
Belongs to hand with ID: 13
Classified as a finger
Length: 58.0 mm
Width: 19.1 mm
Direction: (-0.35, -0.26, -0.90)
Extended?: true
Gesture data:
Gesture ID: 1, type: swipe, state: start, hand IDs: 13, pointable IDs: 132, duration: 0 µs, start position: (-44.9, 154.0, -86.2) mm, current position: (35.9, 185.0, -107.1) mm, direction: (0.9, 0.3, -0.2), speed: 216.7 mm/s
There is a lot of data to interpret, and discerning what is going to be useful to my implementation and what isn't is going to be difficult.
Looking to take on another project to keep the work flow going. I'd love to get a hold of a raspberry pi zero and a controller board in order to make use of the the old Acer Aspire S7 screen for an external display. The display would show the lab 46 data page and could be mounted on a wall for quick access. I'd like to be able to use the touch screen also, but I'm not sure if I will be able to find a controller board that will allow me to utilize the touch screen.
Happy leap day!
Today I began researching different aspects of a raspberry pi in order to create a wifi enabled video feed that will be attached to a rc car in order to control it remotely. It will be controlled using standard WASD configuration.
Components Needed:
Resources to be Used:
Possible Issues to Ponder:
Today began the creation of the cluster for generating prime numbers. Four computers are going to be linked together over the network, sharing computing power in order to speed up the processing and intelligently assign tasks for efficiency.
In use are 4 Dell Optiplex 745's with Intel core duos. Each computer is equipped with 160GB hard drives and 4GB of DDR2 RAM each. Each machine will be running Debian's Jessie OS.
Today I selected the machines, installed the ram and hard drives, and am currently netbooting all 4 machines with the above OS. This is going to be a very time consuming part of the operation.
To begin with, Each computer is set up with the exact same configurations except for the host name, in order to differentiate.
The hostnames are Master (where the commands will be executed), Minion0, Minion1 and Minion2. Using the title of 'slave' seemed a little harsh.
The root password, username, user password and the like were kept the same, in order to make it easier to transfer information between the machines and make authentication easier.
All the computers had installed Debian properly except for minion0, which failed in its installation. When reinstalling the system, instead of installing the desktop environment like before on the other machines, a purely bare bones installation was used.
This was done in order to make the most optimized system possible. Once the system was installed, even the recommended files and installations were removed. Things like the dictionary library aren't needed for what we are doing, so they were taken out.
When all is said and done, the entire OS was reduced down to only 830MB, roughly. This small size enables us to fit the entire system on only a gigabyte of memory. And since speed is the goal, the intent is to put that entire system on a 1GB ram stick, or otherwise known as a ramdisk. This makes any performance blazingly fast. Memory in ram though is volatile though, which means that it would have to be netbooted every time the computer boots.
Today we tackled the issue of not having the IP addresses assigned properly for the cluster nodes. Every time they were booted, they took the addresses of 10.80.2.142, etc.
The static IP addresses that were supposed to be assigned are as follows:
This is what the DHCP was set for, but it never worked. It was confusing because there wasn't any clear reason for it to be holding on to the previous address. Eventually after a lot of trial and error, it was determined that in the DHCP log there was an old entry for the mac address of the machines that was listed before the new IP addresses we had created. This was because these machines were originally part of the old video wall project. After deleting these entries, the IP's were assigned properly.
Working on cosmetic details and trying to make each host display their name at the prompt, instead of just the ambiguous minion. This would make it easier to discern which machine you were hooked into and working on, making things easier.
Other than that, the machines are ready to go in order to start implementing the programs that will utilize the power of multiprocessing as opposed to multithreading.
Did some research on creating a cluster setup using the timeserver program in Systems Programming earlier. There is a cluster library, however it would probably be better to use the existing libraries in order to get a better understanding of the way sockets work.
Working on creating a program that will take advantage of the cluster. I was originally thinking about trying to send the program to the individual nodes, but I feel that it will be easier to give the server program the existing function to use, and simply use the client program to read the data that is outputted to the socket. This way, there is only reading that is going on.
Today I researched and learned about Beowulf clusters. Beowulf clusters are an open source community that is implementing a similar system comparable to what we have created in the lab.
There are multiple open source systems and programs that take advantage of cluster computing in c, with one of the top ones being MOSIX. These systems take multiple network connected machines and turns them into a “supercomputer” of sorts using parallel computing.
More information regarding Dragonfly BSD :Dragonfly Documentation
More information regarding MOSIX: MOSIX Wiki Page
Perks of using Dragonfly versus MOSIX is that MOSIX treats every single node on a cluster as part of a whole single machine. This means that performance decreases might be seen if there are differences in the physical hardware of the nodes. Dragonfly is different in the respect that you have more control over where specific parts of the program go if you so desire.
Day 2: implementing cat2.c, the updated version.
We are using the read function instead of read, open for fopen, and write instead of printf for more universality. These are system calls.
posix standard allows for universal system error codes, among other things. It defines system behaviors.
fopen returns FILE* (which is a struct), but open returns an int, which is known as a file descriptor.
fdopen takes a file descriptor and creates a file pointer in order to cross between the two.
For next time
Continuing the making of cat2.c
implementing getopt so that we can use:
Moving on from cat into the “who” command!
/var/log/wtmp* → shows login data into lab 46.
apropos utmp → u stands for user. See section 5 for configuration items. The header files are located within this file. (man 5 utmp)
Manual page utmp(5) line 26: shows the ut_type translations.
when logging in, ssh calls the login command, and login makes note of the login.
POSIX
Portable Operating System Interface, a set of formal descriptions that provide a standard for the design of operating systems, especially ones that are compatible with Unix.
Origin
1980s: from the initial letters of portable operating system + -ix suggested by Unix.
Life before POSIX = madness.
BSD - Berkeley Standard Distribution (from UC Berkeley)
man gettimeofday, man ctime
Adjusted the time output to include month, day hour and min using the tm struct.
Chmod (change mode) section 2 . we are using the chmod files in order to implement the + & - in our own implementation of who. (who2)
%o prints out in octal
stat man page
including sys/types.h & sys/stat.h
Today we created who2.c as a more functional and closer looking version to the actual who command.
Our first project is to create a version of chmod command.
Today, we are taking on the program of “ls”.
In order to do this, we use man pages such as closedir, opendir, readdir, scandir.
When printing out, we use the attributes of the directory which are name, inode, type, etc.
In scandir, we begin to see the insane (yet still understandable) use of double and even triple pointers. woot.
Alphasort helps us put our results in alphabetical order. :
we are using the extra libraries of <sys/types.h> and <dirent.h>
Section 2 stat man page.
displaying file permissions is tedious as all hell. At least in the way that we did it.
Chmod implementation due next class!!
We are continuing to work on our ls implementation.
The number that is displayed after the file permissions in the ls command means that there are a certain number of hard links within the directory. st_nlink is a struct that allows us to access this information.
Example to show what each data element means:
+-permissions that apply to the owner
| | +-permissions that apply to all other users | | | | +-number of hard links | | | | | | +-size +-last modification date and time _|_ _|_ | _|__ ________|_______ drwxr-xr-x 2 ataka root 4096 2008-11-04 16:58 ataka ___ _____ ____ _____ | | | | | | | +-name of file or directory | | | | | +-the group that the group permissions applies to | | | +-owner | +-permissions that apply to users who are members of the group
chdir stands for change directory, and is how the cd command works.
nscd: name searching caching daemon
Continuing work on ls implementation. Today's task is to display file sizes for individual files.
8-bits = 1 byte → char
16-bits = 2 bytes → short int
Inodes are units of file system buckets.
1.5KB is a rough average of file sizes.
FAT file systems fragment extremely easily and are inefficient compared to others.
Block storage vs fs storage.
In the year display, we were off by 100, so we had to add 1900 to it in order to get the current year, since it displays the number of years since 1900.
The month was also off by one because there are 12 months, but it goes from 0-11 when numbering them.
Concurency
man fork
A fork creates a child process. It requires unistd.h and duplicates a calling process. The parent is the one that created the process, and the child process is what was created.
pid = process ID
you can view processes using the top command, and under the 's' column a z will appear in front of a zombie process.
using forks, processes and process ids, we create a program that makes zombies. blarg.
PNC1 project will be looking at optimizing programs by utilizing the full potential of the cpu through multi-core processing.
adding a -O1 at the end of a gcc line allows for compiler optimization.
Beginning the immersion into threading. This is the third step after using forks.
We always have to deal with time vs space when writing a program, such as a prime number generator. You can have either one or the other, but not both. Either take up more time and save space, or allocate more space in favor of better time.
man page pthreads (7) man page readdir_r (3) line 19
vocab:
Voids These are basically devoid of type, allowing us to store things in memory, but avoid assigning it a type such as char, int, etc.
Still working on forks. Sort of a work on stuff day.
Different types of sort algorithms can drastically improve performance.
Bubble, insert and select are the easiest and simplest to implement.
Quicksort,heapsort and mergesort are a bit more complex.
PNC2 is open for business.
Talking about sockets today, and using them to create a time server.
Useful website: beej's guide to networking.
Protocols
sockaddr_in: internet socket address
Finished the timeserver.c program and demonstrated it working. Depending on what port it uses, that port cannot be accessed by anyone else after the server is running. This allows only one program to work at a time.
Happy St. Patrick's day!!
Today's adventure consists of creating a program that displays ip addresses on the network.
Resources
Writing the client side of the socket implementation.
We will use the write and read system calls. They are very low level.
dup2: duplicating. We made a modification using this at the end of our timeserver program.
getenv
Talking about terminal management (stty)and ioctl()
Resources
stty -echo: hides your typing within the terminal. Passwords use this.
Talking about pipes today.
Pipes: unidirectional data channel that can be used for interprocess communication.
man pipe
FIFO: fist in, first out. - queue
stty echo: resets the previous operation.
Time to explore signals!
newer way: sigaction - this is much more portable and is used for more broad instances. This still uses signal.h.
Resources needed:
Interacting with the program:
Shared Memory
The goal is to use this as a shared communication channel.
Continuation of shared memory exploration.
We are attempting to create a ghetto messaging (chat) program that utilizes shared memory.
Today's Adventure: Ncurses Pac-Man
Ncurses is a terminal management library. This means that it takes over the stdout, stdin, and such. Things like fprintf will not work properly while ncurses is engaged.
Resources:
Working with ncurses again today, with an immersion in the windows aspect of it.
da real Pac-Man implementation.
Over the years, there have been many different implementations that are similar to the original, and those with different styles.
In order to layout the board, we will use a variation of the bit-field called a bit-board.
In order to make things more manageable, separate files should be written and compiled in one.
Continuing the pac-man journey by implementing a cursor function.
user include ncurses.h