Saturday, December 20, 2014

Robie Jr: Progress Continues

Speakers, Servos and Motors Oh MY. Progress continues. I have the arduino board making noises, moving motors or sweeping servos based on serial commands coming from the raspberry pi.

Of course... I found out a few things along the way. First, I really need to be more careful plugging up servos when they pull off usb power. Apparently my motor shield does not supply GPIO power to the arduino in a way that it protects the USB bus. Apparently it doesn't take to much to pull the bus so low the raspberry resets. The second is that the Arduino IDE does not auto save your code when you compile it... DOUGHT. Quicker than you an say compile, upload, sweep I found myself with a reset Pi and my code all sitting in flash on the arduino with a default template set of code in my project. Yay.

Well at least what I had done will not be to difficult to replicate. I also learned that the standard Tone.h and Servo.h files are incompatible on Arduino projects due to some overloading in the timers on the Arduino. Considering it was going to take some more work to run wav files through an arduino connected speaker even if I used an alternative sound library it looks like I am just going to use the jack on the raspberry pi and run sounds from there. I ordered a small cheap bluetooth speaker from amazon for less than 20 bucks that will handle amplification etc... all on its on and work from the sound jack. Has its own battery as well so I won't have to worry to much about powering it/shielding it.

Along those lines I finally pulled up the capture of all the sounds from Robie I captured a year or so ago and broke them all out into individual wav files. So I am not that far from figuring out how to house all these bits and pieces up in Robie and work on building the laptop <->  pi control scheme via wifi. 

The big piece missing at this point is the camera as I have not hooked that up to the Pi yet. The library examples look pretty easy and I have found some examples of folks streaming the camera to remote VLC sessions so hoping the bigger deal will be establishing the serial link for the motion control and receipt of telemetry.

Telemetry:

  • 3 axis accelerometer - serial report back to pi, web serve page with info? 
  • Camera - stream video over wifi to watch on VLC 
  • Planned - RF spectrum analyzer (cheap one on Adafruit) 
  • Planned - Temp (contactless)/Humidity/Pressure
Control:
  • Method:
    • Initial of WiFi VNC connection to Pi driving serial commands to arduino either through ariduino serial session or Python program.
      • Have successfully been shipping commands from the Pi command line to the serial device. Bit awkward if I wanted to control things that way but it works. 
    • Long term goal of establishing a two way link using an as yet undetermined protocol for commands and telemetry to a program running on my laptop and or iPad/iPhone. 
      • Should let me kill the VNC server/session on the Pi and free up some CPU cycles for stuff like image recognition routines
      • setup joystick? 
  • Things to Control:
    • Camera pan and tilt servos
      • up, down, left, right
    • Two DC motors
      • forward, back, left, right
    • Led lights
      • Eyes
        • Haven't decided on whether or not I am trying to drive the old eyes or performing surgery to add new ones. 
      • Connection status? 
    • Planned - Moving arms? Looking like there is no way to do this without surgery or some fabrication... shame I do not have a 3d printer...
Power:
  • Looking like the power will be a bit convoluted to start. 
    • Lipo 7.4v volt 1320mah for the motors going through the arduino shield
    • arduino will also be usb connected to pi due to not having a logic level shifter yet to shift between 3.3v and 5v logic. May shift to adafruit trinket pro 3.3v in the future instead of using a shifter as the price isn't that much different and it would shrink the arduino size and let me use a smaller usb micro instead of the stupid usb a connector on the uno...
    • Speaker will have its own battery but may have it connected to USB battery
    • Raspberry pi running from Anker usb battery
      • May have to put a usb led light on this to keep it from turning off... or making a keep alive circuit as it has an auto shutoff if not enough juice is being pulled. 
  • Actually think all that will weigh about the same, maybe less than the orgininal 4 D cell setup for Robie. May need to perform some surgery to make it fit as the lipo is tiny in the 4 D cell section. 
Future:

Robie is pretty much a nostalgia project at this point but the basis of what I am building has always been intended to go into something a bit more serious. In order to keep me moving I finally did buy a more capable bot chassis . Caught it on sale on Cyber Monday for ~$175 which I consider a real steal. I had already been eying the Dagu Thumper chassis options (4 and 6 wheel bases) but was not really thrilled about what looked to be a fairly cramped area to build up components in. I had always wanted a tank. However until I ran across this one the Lynx motion base was the only one I could find that wasn't very expensive ($$$$) or way to small/cheap. It also had no suspension and didn't look to be easily modifiable to have some. By comparison the T'Rex is simply in another world. It has something like 7cm clearance with nothing to drag on the underside. The spring torsion suspension isn't super beefy (built for load of about 1kg) but it works in pretty rough terrain. Seeing this thing in motion looks like the Howe and Howe Ripsaw tank (youtube it, or you may remember it from Gi Joe). The tank treads are METAL. The Wheels are METAL. Gears are... Metal and everything else is... wait for it... METAL. And it is"        cc            not super cheap flexible thin crap. This bad boy is really stout.

Anyway, I am looking forward to building up some components on the T'Rex. Also looking to add a fossil style skull label, or perhaps a full skull onto this in someway and use that speaker to play some appropriate roars as it roams around exploring :-).  Obviously this beast can't be powered by the arduino motor shield I have so I also have ordered an Orion Robotics Roboclaw 15a dual H bridge controller. On paper it seems to be a better choice than the ubiquitous Sabertooth controllers out there for medium sized bots like this. And the 15a was appealing over the sabertooth 12a as the stall current on the T'Rex is 11a and I wanted a bit more safety margin. For those familiar with this chassis wondering why I did not go with the T'Rex controller which can handle these motors and provides an Arduino in the same package? Well frankly the SparkFun comments on that controller left me a bit concerned it was pretty fragile.

Well since I started this post I have received all the bits in the mail. If I have any complaints thus far it would be about the suspension. It works really well but it is apparently designed for very light loads. It basically uses a torque bar on each of the arms the bogey's are on as opposed to a damper like on higher end RC vehicles. May need to see if I can figure out a modification so that it can carry a bit more weight than just a battery and controller solution. The issue seems to be that if you run in more rugged terrain with heavier than about 1-2kg it can separate drop a track. Anyway... still a really cool design. 


Not sure if I am going to be able to get Robie up and going or not. I have apparently lost some screws for putting him back together. Room is a bit more cramped with the shell on than I thought it would be so I am not sure how to cram the pi and battery in there. I did get him moving around with just the arduino. Will have to do that and film it again. Need to get the eyes lighting up as well. Perhaps next time.... But in this guise there was no interface, just some canned movement code loaded on the arduino. 

Thursday, November 20, 2014

Robie Jr. Update: If I Only Had a Brain....

So months have gone by... oh ok, more than 18 at this point... since my initial post about my work resurrecting Robie. However, soon after that post I quickly realized the limitations of the Arduino setup in terms of doing anything I would find interesting and so Robie went back on the shelf. 


Now I have Pi.... a Raspberry Pi B+ in fact. 700mhz arm computer with 512MB of RAM running raspian linux. Amazon had a kit for sale that included all the essentials to get rolling and quite a bit more for farting around with it for $80.



In the last few nights have have:

  • Successfully setup the Pi (pretty much comes ready to roll)
  • Setup VNC access from my mac
  • Built a couple of perl scripts on the Pi to make noise on an attached speaker
  • Loaded Arduino dev on the Pi from my Mac
  • attached the Arduino from my earlier tinkering to the Pi and tested out an accelerometer
  • rooted and installed Cyanogen mod to my old Nexus 7 tablet... no I do not know exactly what I intend to do... Animated face? Additional Source of data/storage/processing power? Alternative main brain to the Pi? 
My to do List:
  • Attach Camera Module to Pi
    • Take picture and access from Macbook (not via VNC)
    • Stream Video to VLC on Mac
  • Connect Arduino back up to Robie Motors
    • Have Arduino Motor control originate from Pi program (Python?)
    • Have Pi stream motor status to Mac (start of telemetry...)
    • Have Pi accept motor control inputs from Mac 
  • Stream accelerometer data back to Mac via Pi
  • Connect Ping sensor up to Arduino
    • Ship data to Pi
    • Ship data to Mac
  • Connect Servo up to Arduino
    • Control from Pi
    • Control from Mac Via Pi
    • Build Pan/Tilt solution for ping sensor(s)
  • Connect Nexus 7 (or more likely 4... think the 7 is just an expendable test bed) to Pi
    • Access nexus 7 accelerometer status? Stream via App? 
    • Use Nexus 7 camera ? 
    • Animate face for Robie ? 
    • Play Robie sounds through Nexus 7
  • Connect Robie speaker up to Pi or Arduino
    • Play Robie sounds 
    • Rig Robie Contact points for original sound effects
    • Design new Robie sounds... can Pi OCR and Pi Cam combine to let Robie do Text to speech? 
      • Pi OCR from Pi Camera to generate Text sent to Nexus 7 Google powered Text to speech routine?
  • Design and implement all above into Robie chassis or alt base solution? 
    • Scavenge Roomba Drive system? (probably need beefier motor control solution....)
    • Design new arms\Gripers in sketchup with micro servo's and linear actuators in mind... 
  • Start working on integrated wifi based tele robotics interface for running Robbie via WiFi from Mac
  • Develop Autonomous Routines for navigating\mapping the house
    • Add sensors for routine mapping of House status
      • Temp
      • Humidity
      • ??
  • Build charging base
    • Wirelss? 
    • Solar? 
Kind of a rough layout of components I ultimately want to integrate inside Robie:

Yes, I know it is quite possible to run all the stuff hanging off the Arduino directly from the Pi via the GPIO pins. But then I'd have an arduino gathering dust :-) I have a parrallax propeller board sitting around as well and it may get incorporated at some point. On a more serious note, I am rather interested in the complexities of interfacing multiple compnents like this. 

Given my general pace of progress on Robie through the years I imagine I should have this done by the time I am 50... which means I am more than half way their already :-) Though in all seriousness I actually may keep fairly steady progress on this for a while as I think I have answers for how to get through most of the above list with bits and bobs I have in hand. The Raspberry Pi really is a marvel in terms of what it makes possible for such a low cost. As such it represents something of a "missing link" for my long term crazy thoughts with regards to animating my old buddy. If I actually do manage most of this the end goal is not a cheesy toy upgrade... I do have a notion to put together a bit more serious rover. Robie Jr. just makes for a fun test bed that lets me make good on some ideas I have had bouncing around in my head for a loooooooong time. 

Saturday, September 20, 2014

Space Warriors vs Space Camp

So I recently watched... well suffered through... Space Warriors. And it got me thinking. Was it really so bad? I mean I loved Space Camp but that was before I grew up, moved to Huntsville and actually started working in the Space Program. Perhaps I loved Space Camp because I saw it when I was a kid and couldn't pick it apart on 1000 technical details and now I am just to grown up to enjoy a movie like this. Though I don't think so. I can pick apart Space Camp a good bit... but I still like it. I suppose the thing that gets me about this movie is there is no key critical 'swallow the blue pill' moment that gets you on board. I mean I will set aside the atrocious acting. I liked the original Highlander for gods sake, I can overlook some cheesy lines/delivery and awful special effects. But the setup here just doesn't jibe. Space Camp had two real moments you had to swallow. First was that they would ever let kids sit in an STS during a static test fire (heck not even sure a full up static fire like is depicted is even real...). Second, was that given such an event was some odd confluence of events could lead to the control team deciding launching was the only option to save the kids. The first is pretty easy movie fare... the second took some divine intervention courtesy of the AI robot in the original film trying to fulfill his friends wish. Swallow those two moments and the rest of the movie makes some sense and has some logic to it even in its absurdities. The initial bit was actual Space Camp, the post bits were 'how do we get out of this mess now that it happened'.  Space Warriors??? Not so much.

I suppose the other thing that bothers me with Space Warriors vs Space Camp is the actual regression in movie magic thinking. Somehow in 27 years we go from a robot with intelligence and kids actually in space to a really expensive puppet in Robonaut (product placement for GM???) and kids running remote avatars from the ground. The kids taking the place of the adults in this film just does not work as well as the earlier Space Camps decision to generate an 'accident' that pushes the kids into an extreme situation where the only path is 'through to the end'. This is one case where I think Hollywood would really have been better off just remaking a movie instead of coming up with this steaming pile of dog poo. I'll hand some credit to Josh Lucas for trying to make something out of nothing, but as a coach of mine used to say, "You can't make chicken salad out of chicken S#!T".

It was fun to see stuff from Huntsville on the screen, including the ISS payload control room that I have spent so many hours in. And I will hand it to them for using a relatively realistic idea for putting station in danger (space debris hit).

Can't resist a few callouts on the sillyness:

BCC (back up control center) does use a control room in Huntsville. It does not use the one shown in the movie though that was an easy choice to make for movie making (the backup room is much less interesting looking). When activated it is staffed by the same people that operate the main MCC (Mission Control Center) FCR (Flight Control Room) in Houston. Communications with Station run through White Sands... so if BCC is activated it doesn't matter what happens in Houston with regards to station communications. Thats the whole point of having the BCC in the first place.

One of the key plot elements in the movie is the idea that the main character "Crunches the numbers" and comes up with information the adults don't have. My question isn't how he could be that smart, but what data was he crunching? Even if I suspend my disbelief for a moment on the issue of the kids taking over for the adults I am scratching my head as to how they would access station environmental data in the first place... or become so familiar back to front with station procedures? Where Space Camp used the massive ground support team and  'NASA' as a reason to believe how kids could be supported in an emergency (not to mention they had an astronaut with them) Space Warriors uses the "All adults are idiots and kids have to save everything" method of movie magic. Or put another way... The ground team role in Space Camp was in many ways less amazing than the real life Apollo 13 mission support effort. Space Warriors path is just complete and utter nonsense.

The random robotic EVA suits. I mean if the suits were there why wasn't the crew (or ground controllers) using them? Even if they where not using them to do their own repairs they could have been using them (or the crew EVA suits) as a source of life support... which brings me to the last thing I will bring up (though far far faaaaaarrrr from the last issue with this turd of a flick)...

What the hell was with having the crew be so damn passive in this? They damn near didn't even have them speak. Astronauts. In. Mortal. Peril. are apparently doing nothing to try and alter their own fate. For most of the rest of the stuff they gave reasons (bad and horrible ones... but reasons) for why the kids were taking over. They never really give a reason for the crew being on the sidelines in this story.

I mean really that is just scratching the surface with this one. If you are looking for fun space movies to watch with or for your kids (or the kid in you) then I'd highly recommend the '86 Space Camp, Space Cowboys, or even Mission to Mars over Space Warriors.

I normally hate chewing apart issues in movies without suggesting alternative solutions. Perhaps one day I will take a stab at this one, but right now all I can come up with is pretty much going back to the drawing board.