17 January 2013


Here's a quick teaser of what I've been up to all IAP:

Moar coming soon. Also, why the hell does HobbyKing take so freaking long to ship my quadrotor parts :,(

13 January 2013

A rant about the importance of STEM

The following is a collection of my responses to some folks arguing against the plan detailed in the following video: 

If SpaceX had a serious plan for going to the moon, they should Kickstarter that shit. I'd SOOOO pay for that! Hell I'd even leave the East Coast and go work for them to help make it happen. 

I miss the days where inspiration to pursue STEM was more readily available. Battlebots, Junkyard Wars, Gundams... My father watched the lunar landing as a kid, had GI-Joe toys of Buzz and Neil and the Apollo lander. He became an airliner technician as a result, and fathered and inspired a son who would go to MIT. But we don't have as much emphasis on technology today, it's more taken for granted. 

My younger cousins are growing up with the internet and powerful computing. We grew up with basic knowledge of a computer. Our parents didn't have that experience, that integration of our mind with our cell phone. Having Google at your fingertips. Maybe the home 3D printing revolution will create a whole new generation, our children maybe, where most kids grow up with CAD and design experience. It's not a mechanical engineering thing, no need to perform FEA or cost analysis or any of that. It's more... turning your red wagon into a go kart. Fixing your bike. Building a treehouse. 3D printing a toothbrush holder, or a toy. It breaks, make a new one with more material where it broke to make it stronger. Common sense, no engineering degree required. Imagine what amazing inventions this generation of designers will come up with when they do grow up? When they do get those engineering degrees?

They will be amateur engineers. More like artisans, really. True Makers. Like Deviantart.com contains thousands of amateur artists, Youtube contains thousands of amateur film directors, all those indie game developers and web designers. 

Here's how a differential gear works!

It's in everyone's car, and it's an AMAZING INVENTION! Thank you, 1937 instructional videos!

I approve of government/military funding of technological advancement. Like the DARPA autonomous vehicle challenges. The amount of knowledge attained in the past decade as a result of those challenges has been like cocaine injected into the vein of autonomous robotics. Yes, our cars drive themselves. Welcome to the future.

But DARPA is evil! Military funding! 

Yup, we know how you feel. So did the winners from CMU and Stanford, who went on to work for Google instead of the DOD. http://www.ted.com/talks/sebastian_thrun_google_s_driverless_car.html YAY TECHNOLOGY!

Sure, the latest DARPA autonomy challenge involves humanoid bots picking chainsaws up and operating machinery for "disaster relief", but the peaceful uses of this technology's development will be more numerous and adopted than the military uses. We're still decades from allowing a strictly autonomous being to fire a weapon without a human at the trigger, if it will ever be safe and feasible. Teleoperated Surrogate droids on the battlefield A La Predator Drones is far more likely. 

And iRobot's glorified RC car with a gun is hardly a "robot", in that it is not autonomous. Therefore we are not placing any decision to take a life upon an artificial intelligence. Plus, the videos of the iRobot Warrior 710 with an M4 on board are simply tests in teleoperation and aiming, not how the robots are ever actually used. The iRobot defense line are used almost exclusively for in/outdoor recon and bomb disposal. 

Meet Baxter, an inexpensive manufacturing robot for small business:

The inspiration for research in object recognition and ability to be "taught" no doubt came from NASA's spacewalking robot, which occasionally performs "outdoor" repairs of the ISS.

Rant over -_-

03 January 2013

Gamepad Input in Python

I want to be able to command my upcoming Quadrotor with a game controller, so I purchased a Gigaware PC Wired Controller for $17 from Radioshack:

Quadrotors are usually controlled with two thumbsticks (4 axes): 

  • Left Thumbstick Up/Down: Throttle
  • Left Thumbstick Left/Right: Yaw
  • Right Thumbstick Up/Down: Pitch
  • Left Thumbstick Left/Right: Roll

This inexpensive controller seems perfect for what I need it for, and there are some buttons I can use for initialization and other things. I could also use this gamepad to command, say, a certain mobile robot or a certain robot arm of mine. Or both. Simultaneously. 

Oh, and I can also use the controller to play games on my computer. Which is, you know, its intended purpose. N64 Emulator, Anyone?

I looked online for some Python example code, and the easiest came from this site. 

I modified it to make it more simple and global for my, and hopefully your, purposes:

Gamepad Module
Daniel J. Gonzalez

Based off code from: http://robots.dacloughb.com/project-1/logitech-game-pad/


import pygame


j = pygame.joystick.Joystick(0)
print 'Initialized Joystick : %s' % j.get_name()


Returns a vector of the following form:
[LThumbstickX, LThumbstickY, Unknown Coupled Axis???, 
RThumbstickX, RThumbstickY, 
Button 1/X, Button 2/A, Button 3/B, Button 4/Y, 
Left Bumper, Right Bumper, Left Trigger, Right Triller,
Select, Start, Left Thumb Press, Right Thumb Press]


No D-Pad.
Triggers are switches, not variable. 
Your controller may be different

def get():

    out = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
    it = 0 #iterator
    #Read input from the two joysticks       
    for i in range(0, j.get_numaxes()):
        out[it] = j.get_axis(i)
    #Read input from buttons
    for i in range(0, j.get_numbuttons()):
        out[it] = j.get_button(i)
    return out

def test():

    while True:
        print get()

To test the code with your gamepad, simply plug it in, open a python shell, make sure the file is saved as gamepad.py, import gamepad and run gamepad.test(). Works for me in Ubuntu 12.04. To use this in your own application, simply place gamepad.py in your working directory, import gamepad, and call gamepad.get() every time you want to view the current state vector. 

 Button 4 is not pressed

 Button 4 is pressed. Note the "1" in the vector output on screen. 

Left Thumbstick not touched, all at 0

Going kinda right on the Right Stick gives a value of -.0567, and the value is linear relative to how far I push the stick. 

Going full right on the left stick brings the value up to -1.

Groovy. I don't know what's up with the third axis the joystick is giving me. The first two values in the vector make sense: Left Thumbstick up/down and left/right. But the third value changes when I move the Left Thumbstick left/right and when I move the Right Thumbstick up/down and when i hit the Start button (Button 10). It sure as hell isn't an accelerometer or anything fun like that, so I'm just going to ignore it for now. 

Hope the code proves useful!

01 January 2013

13 Plans for a New Year

We're all making New Year's resolutions. I have a few personal ones of my own, but they have nothing to do with this blog. This being Yet Another Mechanical Engineering Blog, I will focus on my engi-nerd-hack-robot-ing goals for this year, or at least the coming IAP (January semester) and Spring semester. 

0. Tune Up Cruscooter

It's a dirty hot mess. Needs major rewiring. And a working brake. 

1. Build a semi-autonomous Quadrotor
WAY more details about this coming soon. This will be one of my first projects of IAP.

2. Build a Bi-copter/Tiltrotor. A la V22 Osprey. 

Something I've been wanting to do since I saw the attack choppers in James Cameron's Avatar. And something I tried to do last year when I knew nothing. Now I know a little something, and building a quadrotor will help give me an intuition for flying things. 

3. Win MASLAB.

It's a ballsy goal. But hey, I'm a freakin' engineering diva.

4. Finish MelonChopper

Cannot wait til I can drift this thing in the snow :p

5. Learn to weld steel.
So I can build Certified Legit vehicles. For cheap. 

6. DeltaBot.

I'm going to have the coolest thesis ever ^_^.

7. Write an Instructable on manipulator robotics.
I've learned a lot in the past few years, time to spread the love. But first...

8. Design and build a ~7-DOF robotic manipulator. A la KUKA arm.
I've been controlling these bad boys, now it's time to be a Mechanical engineer for once. 

9. Pay attention to TurtleBot.

Of my children, I've been giving a lot of attention to TinyArm and none to TurtleBot, and I don't think TurtleBot can handle neglect much longer :c. Time to turn that around. I owe Shane a SLAM map of the IDC before he goes off into the Real World (c). 

10. Get TurtleBot+TinyArm playing together.
I still hold myself to the dynamic duo, TurtleBot and TinyArm, getting me a soda. Maybe now that TinyArm has learned how to talk, and with the release of ROS Groovy Galapagos I'll finally make it happen. 

11. Learn ROS. Like really learn ROS.
Willow Garage released its sixth distribution of ROS today, Groovy Galapagos. It's cleaned up a lot, and is apparently easier than ever to use. It'll happen when I try and get TurtleBot+TinyArm to get me soda. 

12. Learn C++. Like really learn C++.
See above.

13. Get a summer internship.
I cannot spend another summer at MIT UROPing. I need to see the world. See what industry is like. I need experience. I need to make a difference. I'll probably apply in the next few days...