Friday, March 29

Nand2Tetris

 ==>


A while back, I had a conversation with an old roommate on the topic of computer science. He mentioned that one of the better ways to become familiar with the application of computer science was to actually build one from scratch. At the time, I thought that sounded like a fun, but daunting and time-consuming task; time that might be better spent on some specialization. I realized that there was a hierarchy of unique and challenging topics between hardware and software in a modern personal computer and that a lifetime could be spent mastering any particular aspect of those. At the same time, if some resource existed that could help an individual navigate through that hierarchy, the practical knowledge could be acquired without the expensive and painstaking mastery necessary for the corporeal implementation of a computer.

Last December, I was lucky enough to come across Nand2Tetris - the very resource that I idly dreamt of. The Nand2Tetris coursework does exactly as the name describes: the student is given materials that allow them to build and simulate logic circuits and, starting with a simple NAND gate, the student implements all of the components necessary to perform the operations involved in a game of Tetris. The organization of the class is impressively clean. There are multiple simulators spanning a variety of stages in the process which represent checkpoints in the course: Hardware Simulator, CPU Emulator, VM Emulator, Assembler, Compiler, Operating system; each of these are first implemented by the student and then utilized (for the sake of speed) as the succeeding topic is breached. In that way, the student never utilizes components that weren't  (in spirit) originally constructed by them - everything ties back to the original NAND gate. What follows is a user-friendly, intuitive, and educational series of tasks that simulate the main points of implementing a computer achitecture from scratch while retaining the continuity of the experience and filtering out any potential headaches due to inefficiency of the hardware simulation (at the scale necessary for building a working computer).


Whats more, the materials are open to the public: the simulation software, assignments, and half of the book. I was able to work through the first 6 chapters without paying a cent and learned a great deal about the practical and necessary constraints on machine language, assembly code, and virtual machine. Working through these exercises has given me a more detailed perspective of the landscape of computer science and its application. For a mechanical engineer who is interested in mechatronics systems or computer architectures, this course is an absolute blessing. I've purchased the book and plan on finishing the last 6 chapters in the coming weeks.



Even if a person was constrained by time and unable to perform the exercises, the book itself is worth reading. Topics are presented with little assumptions of prerequisite knowledge. In fact, this material could be (and I believe is) taught in highschools and middle schools to great effect. Overall, I am very pleased with this course and greatly appreciate the work of Noam Nisan, Shimon Schocken, and the rest of the Nand2Tetris team for preparing it.

Underactuated Robotics

I recently came across materials from a class on MIT's Open Courseware (OCW) that has me pretty excited: Underactuated Robotics. I ran into one of the lecture notes during my investigation into inverted pendulum control schemes (a project which sort of branched out of my review of the calculus of variations). I was originally interested in modeling the dynamics of a pendulum in a variety of force fields and decided it would be more interesting to investigate controlling that system in ordinary conditions. I'm planning on implementing this system physically once I have a sense of what I would like to accomplish with it.

 The first lecture opened my ears to a fundamental bifurcation in the application of mechanical and control system design. Primarily, fully actuated systems which possess the same number of actuators as they do degrees of freedom and underactuated systems which have no direct influence over the unactuated degrees of freedom. More succinctly, fully actuated systems are capable of producing accelerations along arbitrary directions in the state space. For systems where the dynamics may have a linear relationship with the actuation vector:

$\ddot{q} = f_1(q,\dot{q},t) + f_2(q,\dot{q},t)u $

Where $q$ is a vector in the state space, $u$ is a vector of all actuators, and $f_2$ maps the actuators to some dimension in the state space. A fully actuated system will possess the following property:

$rank[f_2(q,\dot{q},t)] = dim[q]$

Whereas underactuated systems will not map the actuation space to all dimensions of the state space.

$rank[f_2(q,\dot{q},t)] < dim[q]$


In order to reach a particular position in the state space, an underactuated system must make use of the indirect and dynamic characteristics of the system that relate the actuated features of the state vector to the desired unactuated feature. For instance, a cart and pole inverted pendulum is underactuated. It may be modeled as an actuated prismatic joint coupled with an unactuated revolute joint with some mass at the end of the free member. This is apparent because there are two degrees of freedom in the system and only one actuator. It is generally possible to reach any point in the state space, but not necessarily possible to describe any path through the space. The available paths that may be taken through the state space are defined by the dynamics of the system.