PDA

View Full Version : A BRAT based Mech, "Miss Alignment"



darrellt
09-16-2009, 09:41 PM
Hello All, I just wanted to start a thread to introduce our mech.

Name: Miss-Alignment

Frame: Lynx BRAT, mostly built from tutorials:
http://www.lynxmotion.com/images/html/build155.htm,
http://www.lynxmotion.com/images/html/build156.htm (http://www.lynxmotion.com/images/html/build155.htm)

Weapons: Airsoft, Cold Shoulders, The power to empty checking accounts

Power: 12 NiMh Cells in In the feet, Regulated to 6.5 v

Servos: HS-645mg, may upgrade to http://openservo.com/

Camera: None yet, plan to use android phone.

Control: Currently basic atom pro and wireless PS2 controller

Team: Two computer programers from colorado.

Goal: Walk and shoot for less then 1KiloDollar

Bigger Goal: Use Android phone as video camera and control via http over 802.11b

Ultimate Goal: Autonomous mode, running on android phone.

Pic: (this is right after we got it to walk and shoot, still far from complete)
http://forums.trossenrobotics.com/gallery/files/3/5/3/9/missalignment_birthday_thumb.jpg (http://forums.trossenrobotics.com/gallery/showimage.php?i=1776&c=3)

darrellt
09-16-2009, 11:43 PM
BUILD LOG:

So here is my research regarding using the android phone as the brains/camera.

I tested out an app called qik that allows streaming video from the phone to a youtube type site. It is usable video if the lighting is reasonably bright. There is about 10-20 seconds of lag, I assume this is because the video has to go to the site's datacenter, be stored and transcoded, and then sent back out through to the browser. Conclusion is that I will defiantly need to write my own app that can stream video directly to my laptop, but I now am confidant it is possible.

The next thing i did was to determine if there is a way to run a webserver on my phone. That turned out to be super easy with an app called i-jetty. I-jetty works pretty much as a standard servelet container, so if you have ever written any java webapps it will be familiar to you.

Next I installed the android sdk and got hello world running on my phone. This is crazy easy with eclipse. Seriously its great, just google it.

I am using a basic atom pro micro controller to control the servos. It can be sent commands through a serial port, so the next step was for me to get the serial port working on my phone. This is a bit of a trick. I found a how to (http://www.instructables.com/id/Android_G1_Serial_Cable/) on making the neccessary cable. My cable is quite not the same as the one in the instructable becasue mine goes from 2.8v TTL to 5V TTL. instead of from 2.8v TTL serial to USB.

After I built the serial cable, I rooted (http://www.ryebrye.com/blog/2009/08/16/android-rooting-in-1-click-in-progress/) the phone. This is a one click process that i highly recomend for every android phone user. The rooted phone is much prettier and faster and the multi-touch now works. I installed a custom kernel available here: http://spirit-plumber.com/ With this kernel I was able to get the phone to talk to the computer over serial. The only problem was that the phone did not work as a phone with that kernel so i eventually have to build my own kernel.

Building the BRAT kit and getting him walking took about a day, thanks to the tutorial linked above. We got the gun from k-mart because it had flat sides and a laser pointer built in. Its a bit too big so it will be replaced. It is actuated by a micro servo and microswitch because that is what we had on hand.

The 5 cell we were using did not last very long so we decided to build a custom pack. With the batteries in the feet the gait is a shuffle, but i wanted a shuffle anyway due to all the bb's on that will be on the floor. The pack seem to last a long time, 45-60 min. It is two six cell NiMh packs in parallel, Giving 7.2v, 5.3Ah nominal capacity. The 645MG servos stall at about 1.5 amps so I estimate the pack will last about half an hour once the bot is fully loaded.

The next task is to add the top turret and phone mount and see if the servos can take the weight. The plan is to get an extra phone backplate that i can glue to the robot so i can snap the phone in and out.

darrellt
09-21-2009, 10:59 PM
Status Update


We have added a turret and test mounted the phone. We changed to a tank gun because it is much smaller. The servos seem to handle the weight ok. The batteries in the feet are working well, the robot does not make it self fall over too easily. The 'head' is still bit heavy and it is possible to fall over by leaning too far backwards, so this is not an anti-aircraft bot.

Build Notes:

The tank-gun can be mounted directly to an L-bracket if it is disassembled. If the gun is shooting weakly, check that the barrel is inserted all the way. There is a rubber seal that will leak air if the barrel does not push it back far enough to seat properly against the plunger assembly. Also note that laser diodes will not tolerate much over-voltage. We burned one out run running it on five NiMh Cells instead of four.



http://forums.trossenrobotics.com/gallery/files/3/5/3/9/img_0262_thumb.jpg (http://forums.trossenrobotics.com/gallery/showimage.php?i=1807&c=3)

jes1510
09-21-2009, 11:08 PM
Looking great!

Adrenalynn
09-22-2009, 12:24 AM
>> here is a rubber seal that will leak air if it is not pushed back far enough by the barrel to seat properly against the plunger assembly

Yeah, or get pinched, deformed, and make the gun literally garbage. I have a couple garbage guns here with that failure...

mannyr7
09-22-2009, 04:01 PM
FYI, that seal is called 'bucking'. It comes in silicone and rubber, and most full service airgun shops carry it.

xx2747
09-22-2009, 07:30 PM
That robot looks awesome. Personally I don't know anything about mechs, but the software sounds interesting.

bigderhak
09-22-2009, 07:37 PM
looking good!! I like the first pic that was just a big gun walking around ;)

darrellt
11-06-2009, 12:35 AM
Status Update

http://forums.trossenrobotics.com/gallery/files/3/5/3/9/miss_alignment_v2_thumb.jpg (http://forums.trossenrobotics.com/gallery/showimage.php?i=1914&c=3)

We have two guns and one laser mounted now. There is a toggle switch on the turret that enables the guns. There is a red led next to the switch that glows to warn you that the guns are hot. I did get shot in the arm once before this was added.

We first experimented with using relays to fire the guns, but the relay boards I got from seeedstudios burned out very quickly. We were driving them at 6.5 volts, and they only lasted about an hour each.

Next we built something that works much better using the SN754410 Quad half-h bridge on a chip. This is a 16pin dip that can take logic level input from your micro-controller and control 4 1amp outputs. It is the same chip used on the MAKE micro-controller and it works very well. We use it to drive the two guns, the laser, and a 3w led we have for dark places. You can see the board we built in the right armpit, it is very compact for what it does. SAFETY NOTE: Make sure you use 10k pulldown resistors on the inputs to prevent them from floating high enough to cause the guns to start shooting on their own. (This was how I got shot in the arm.)

We made a lot of changes to the power supply system. In the back there is a Castle BEC, which is a very small programable switchmode power regulator. We use it to take the 7-9V from the batteries and regulate it down too 6.5V. This keeps the servos from getting too hot when the batteries are fresh, and ensures that the robot does not slow down as the batteries drain. We can also reprogram the BEC to a higher voltage if we ever need "full military power." One problem with using the BEC is that it cuts out if more then ~6A are drawn. It is possible for the HS-645mg to draw ~1.5A at full stall, so we would occasionally cut out when we had many servos moving at once. We tried to solve the problem using a big 4700uF cap off an old power supply. This helped, but we still sometimes had cutouts so we built an array of utra-capicators. We got some 2.5v, 4.7 Fared ultra caps off ebay and put three in series for 1.5F at up to 7.5V.
This utracap array alone is enough to power the robot for several seconds, such that we can even change batteries without rebooting. The ultra caps are smaller then a 4700uF, but hold 1000x the charge!

With the weight near the final load out, the robot can still walk and the battery-life is quite good. One advantage of having a voltage regulator is that we can now switch between double and quad battery holders as needed to optimize for speed or endurance. The extra weight up-top can cause some oscillations when training the gun up and down so we may upgrade to the aluminum servo horns for more stiffness.


From here on out the work is mostly software. We have experimented with the sonar ranger, it works well and will be useful as we try for autonomous mode. Plus it give the robot a more anthropomorphic look.

jes1510
11-06-2009, 10:01 AM
I love it! Are you using the cam on the HTC phone for driving? How are you connecting to the phone? Wifi?

sam
11-06-2009, 11:53 AM
I love it! Are you using the cam on the HTC phone for driving? How are you connecting to the phone? Wifi?

I noticed that too. Is the camera good? How does it compare to the camera everyone has? Is this going to be permanent?

The bot is coming along nicely! Compared to the first shots of it, it's really nice.

Sam

darrellt
11-06-2009, 12:15 PM
Jes-

We do plan on using camera on the phone for driving. We connect to the phone via wifi and can stream video from the phone. There are some apps that do this already but the latency is too high so we had to write our own. The HTC phone has a serial port in the USB connector that can be enabled by compiling a custom kernel. You can see the white serial cable in the second photo. So we send commands over wifi using netcat to the phone and the phone outputs them to the micro-controller via the serial cable.

We also want to use the phones accelerometer to help with our walking algorithm, but have not figured that out yet.

darrellt
11-06-2009, 12:27 PM
Sam-

The camera on the phone is workable if there is enough light. I will post an example video this weekend. We have a 3w led that provides plenty of light, but we may have to turn down the brightness if it causes problems blinding the other robots. As far as using the phone for actual competition, We have tested all the the functions necessary to use the phone as a brain individually, but we have yet to get them all working at the same time. If this system works well I will open-source it if there is any interest.

darrellt
12-08-2009, 11:27 PM
So here is a video of a test run


http://www.youtube.com/watch?v=omPGIrz5qdw

darkback2
12-08-2009, 11:45 PM
All that from a phone!?

Sweet work. Can't wait to see it at robogames.

DB

webgeek
12-09-2009, 11:47 AM
One day robots will kill us all. He already started to turn on you!

Nice work on that and great idea on the camera phone!

Mike

Adrenalynn
12-09-2009, 02:33 PM
It's looking great! Grats!

I did want to note in response to DB: Today's cell phones have ~3-4x the processing power of our desktops in 2005. And in the instance of video capture and processing - they have dedicated hardware acceleration with DSP, so it's equivalent to today's multi-core machines or potentially even better... My 16 channel/480fps cards still run hardware acceleration because even a quad-core i7 can't come close to doing 480fps D1 realtime with h.264 in on-core software. And my display and processing is done entirely in GPU because 400-900+ dedicated cores optimized for video are better than 4 unoptimized but higher clock cores.

So don't underestimate today's smart phones...

darrellt
12-10-2009, 03:41 PM
So if anyone has an HTC android phone and wants to use the serial port to control robots, my teammate has posted a custom kernel here: http://www.allthingsgeek.com/gcms/index.php?mod=article&id=22

With this kernel you can send serial commands to your micro controller from your phone. Note that you must have a rooted phone running cyanogen. You can use netcat to send these commands over the internet, which will allow you to remotely control your bot form anywhere in the world.

Also you may want to check out the android OpenCV port for your machine vision needs: http://github.com/billmccord/OpenCV-Android

Chench
12-22-2009, 09:10 AM
Hi there, I think your project is amazing and you guys obviously have a great deal of knowledge and experience to be able to modify the phone to such an extent. I'm attempting a somewhat similar project using a windows mobile phone, communicating to a microcontroller over a Bluesmirf serial link via its bluetooth. I'm just wondering if the Bluetooth approach was one that you considered as it might allow you to avoid the need for a custom kernal, at the cost of an extra link in the chain.

darrellt
01-08-2010, 02:36 PM
Status Update:

We have gotten control over the internet working fairly reliably. We wrote our own netcat program that runs on the phone.

On the video front, I have finally gotten the video streaming working! Someone on the sipdroid (http://sipdroid.org) project has heroically managed to fix the h263 headers and put the video stream into RTP packets. This uses the hardware h263 encoder so it is far superior to the software mjpeg method I was using. I will ether use sipdroid directly or if I have time i will rip out the RTP stuff and stream directly to VLC.

With netcat and sipdroid we can now drive our mech from anywhere on the internet, though with much lag it becomes quite difficult.

@Chench I have ordered a Bluesmirf as you suggested and will test it out. It would be nice to get rid of the custom kernel requirement, because the bluetooth would make it much easier to upgrade to the new 1ghz android phones that are becoming available. The only concern I have is with radio interference, but since the bluetooth only has to go a few inches it should hopefully still work.

darrellt
01-27-2010, 01:43 AM
Build Update:

Chench! You are a genius! I switched to using BlueSMiRF as the control method and it works great! No more custom kernel. It is also very convenient because I can now use the USB port for debugging while the phone talks to the robot over BT.

Also we have replaced the 12 NiMh AA cells with two Lithium Iron Phosphate cells. These work very well and keep a steady voltage of around 6.6v until they are almost drained. The voltage is so steady we removed the Castle BEC and supercaps.

With BlueTooth, Wifi, and Xbee all blasting away within a few inches of each other, I am somewhat concerned about the reliability... I guess if it does not work as a Mech, I can always use it as walking microwave oven. I will have to see if can modify the cannons to shoot taquitos.

http://forums.trossenrobotics.com/gallery/files/3/5/3/9/img_0271_thumb.jpg (http://forums.trossenrobotics.com/gallery/showimage.php?i=2126&c=3)

Chench
01-28-2010, 02:24 PM
Haha I have my moments. Credit goes to Wimo (http://www.wimobot.com/)'s creator though, he gave me the idea. I'm actually working on a somewhat similar project myself and I'm just trying to get the bluetooth working now. I can send commands via a terminal program running on the phone but I'm having problems doing this from inside my application. You don't have any Windows Mobile experience, by any chance? Hmm, that's the beauty of 2.4GHz! Great work on Miss Alignment btw. Do you have any plans to make her autonomous?

darrellt
02-10-2010, 02:38 AM
@Chench,

I want to go autonomous since the OpenCV lib has already been ported to android. I was all gung-ho to do that but i may not have time.

darrellt
02-10-2010, 03:04 AM
Got the video code and control code running at the same time in the same app. Currently sending H263 at 352x288px 20fps to VLC. Latency is highish, 1-2 seconds. Still some optimization to do, or I may just buy a faster phone. I tested the video on a friend's nexus one and it is quite good. Also switched from BotBoard2 to Arduino Duemilanove. The Arduno is much easier to program, because of the USB and also I am more accustomed to C syntax. The code for the phone and the Arduino will be open sourced as soon as I add some documentation.

darrellt
03-03-2010, 01:32 AM
Got the video lag down to an acceptable level by writing a custom C++ program that grabs the video frame buffer, encodes it to jpeg, and sends it over tcp; basically a home rolled mjpeg. Its a pretty wasteful codec in terms of bandwidth, but with the advantage that every frame is a keyfame, so no problems with fast camera movement. Still not quite as good as proper web cam, but is drivable now. Currently using software JPEG encoder, hardware encoder exists on the processor, but the documentation is nil, so it will take a lot of reverse engineering to make it work.

We have also made a client program that takes joystick input from xbox or ps3 controllers, and shows the video. We used Processing to write the client and WOW it is a really great language for prototyping graphics and interactivity stuff. Getting the joystick working was a matter of hours as was the mjpeg display.

Does anyone know how much bandwidth we should plan on using? Is it finalized that we will use one AP on the ceiling of the arena for the mechs and Cat-5 from there to the the laptops? Is anyone in charge of/bringing the networking equipment? a/b/g/n? Anyone bringing a spectrum analyzer?

gdubb2
03-03-2010, 11:28 AM
Darrrell,
Looks like things are shaping up nicely for you. Good job on Miss Alignment.

I don't think anything has been finalized on the common networking system. I plan on bringing enough stuff for a stand alone system, then if things change just change over to whatever will work the best. Last year we had a few problems, but nothing that couldn't be handled. (Except for my crappy Airlink camera)

Correction: There will be a common network for the video links. I stand corrected..

Look forward to meeting you.
Gary

DresnerRobotics
03-03-2010, 01:10 PM
One thing to note is that the common network there is not a requirement, you're still allowed to use your own networking equipment. Just be aware that there will be a professional WAP there available for use, and if you're using your own stuff you'll likely want to coordinate so you're not on overlapping channels.

darrellt
04-19-2010, 03:22 AM
Last status update before the games:

We have low lag video in BW at 800x480 working well. We are only sending BW for now to save bandwith and improve lag. Currently we fit each frame into a single UDP packet. It is difficult to judge your distance from objects using only the video so we have a couple solutions. First we have sonar in front and IR in back so that we can get a numeric range. We also have a laser mounted on one of the guns and it is possible to judge distance by parallax if the sonar is not working. We have lots of data coming back from the phone, so much that we are running low on room to display it all in the UI.

We have rebuilt the tank guns to make them hopefully more robust. We have already broken 3 so we are down to one spare.

Walking in a straight line is still a challenge. Our gait is not IK but hand coded so there is still some fine tuning needed there. Servos are starting to get worn and have some play which complicates matters.

We have a input box in the UI where you can type in something and have the robot say it. We may walk like a drunkard, but at least we can now utter robotic insults and talk smack like one also. Ex: "My apple 2 had more FLOPS then you!"

We do have color based auto targeting sorta working, but it still needs work in the reliability dept. It runs phone side so if it does lock on aiming is quite responsive. Hard to say if it will be useful in actual battle. One quirk is that the target blob data will sometimes show up before the video frame so in the UI it looks as if the robot can see half a second or so into the future! Its really spooky to see in person... Very Jedi.

Connor
04-19-2010, 11:23 AM
Last status update before the games:

We have low lag video in BW at 800x480 working well. We are only sending BW for now to save bandwith and improve lag. Currently we fit each frame into a single UDP packet. It is difficult to judge your distance from objects using only the video so we have a couple solutions. First we have sonar in front and IR in back so that we can get a numeric range. We also have a laser mounted on one of the guns and it is possible to judge distance by parallax if the sonar is not working. We have lots of data coming back from the phone, so much that we are running low on room to display it all in the UI.

We have rebuilt the tank guns to make them hopefully more robust. We have already broken 3 so we are down to one spare.

Walking in a straight line is still a challenge. Our gait is not IK but hand coded so there is still some fine tuning needed there. Servos are starting to get worn and have some play which complicates matters.

We have a input box in the UI where you can type in something and have the robot say it. We may walk like a drunkard, but at least we can now utter robotic insults and talk smack like one also. Ex: "My apple 2 had more FLOPS then you!"

We do have color based auto targeting sorta working, but it still needs work in the reliability dept. It runs phone side so if it does lock on aiming is quite responsive. Hard to say if it will be useful in actual battle. One quirk is that the target blob data will sometimes show up before the video frame so in the UI it looks as if the robot can see half a second or so into the future! Its really spooky to see in person... Very Jedi.

What sort of mods did you make to your tank guns?

darrellt
04-20-2010, 02:42 AM
The plastic collars that hold in the barrel kept breaking when the robot fell over so we did a couple things. First we sanded down the end of the barrel so it fits with very little force into the collar. Then we filled the void in the case halves underneath the collar with epoxy putty so that there is something for the collar to press down on other then the tiny plastic ears. Finaly we bent a stainless hose-clamp into a rectangle and clamped the very front plastic front of the gun closed. This holds the barrel much more securely then the tiny screw that is there originally.


Also 2/3 of the walking straight problem seemed to be related to left-right balance. Just a few grams seems to make a significant difference so if your brat is going in circles check the balance first.


http://forums.trossenrobotics.com/gallery/files/3/5/3/9/tankgunclamps_thumb.jpeg (http://forums.trossenrobotics.com/gallery/showimage.php?i=2315&c=3)

Connor
04-20-2010, 11:03 AM
The plastic collars that hold in the barrel kept breaking when the robot fell over so we did a couple things. First we sanded down the end of the barrel so it fits with very little force into the collar. Then we filled the void in the case halves underneath the collar with epoxy putty so that there is something for the collar to press down on other then the tiny plastic ears. Finaly we bent a stainless hose-clamp into a rectangle and clamped the very front plastic front of the gun closed. This holds the barrel much more securely then the tiny screw that is there originally.


Also 2/3 of the walking straight problem seemed to be related to left-right balance. Just a few grams seems to make a significant difference so if your brat is going in circles check the balance first.


http://forums.trossenrobotics.com/gallery/files/3/5/3/9/tankgunclamps_thumb.jpeg (http://forums.trossenrobotics.com/gallery/showimage.php?i=2315&c=3)

You mean the pink (or gray) insert that the barrel goes into? I don't think that was a holder.. I belive that's the chamber, not intended to support the barrel.. everyone who uses the tank gun uses a external clip that presses the barrel snuggly against the face of the gun. We uses tiny screws to hold the external clip on.

darrellt
04-20-2010, 12:13 PM
You mean the pink (or gray) insert that the barrel goes into? I don't think that was a holder.. I belive that's the chamber, not intended to support the barrel.. everyone who uses the tank gun uses a external clip that presses the barrel snuggly against the face of the gun. We uses tiny screws to hold the external clip on.


Now you tell me!

Connor
04-20-2010, 12:19 PM
You never asked.. and gdubb2 has some pictures from last year showing how his was done.

http://forums.trossenrobotics.com/gallery/showimage.php?i=1139&c=3&userid=2033
http://forums.trossenrobotics.com/gallery/showimage.php?i=1073&c=3&userid=2033

darrellt
04-28-2010, 05:39 PM
2010 RoboGames Wrapup

So miss alignment did not win any matches this year, match 1 lost due to WIFI interference and Match 2 lost due to Me accidentally clicking the close button in the GUI and the re connect not working.

This is a note to remind me of what worked and what needs fixing.

Worked:


Got her through airport security, twice! Remove guns,bag and tape batteries, ask for special inspection.
No mechanical breakdowns.
Plenty of battery life.
Adjustable cross-hairs were quite accurate, toe in on the guns helped with paralax.
Never fell over
Talking IP address was useful for setup
Gun disable switch prevented any negligent discharges.
Frame-rate and lag was good when their was not too much noise.
Rear sonar sensor was useful for backing up, front less useful but kept her off buildings.

Did not work:


Walking in a straight line extremely sensitive to floor friction and slope, balance of head, very small rocks, phase of moon.
Too dam slow!
WiFi and TCP was a bad combo when their is lots of noise, need a backup, at minimum UDP.
Reconnection was un-reliable.
Auto aim was acting up on white surfaces
Turning was crap
Need to be able to pivot head 360
Laser was flaky
Close button on gui to easy to accidentally click
Setup time is too long.
GUI needs indicators for wifi str, bt str, and gun enable status.
Hoppers sometimes jammed.
Had trouble stepping on bbs.
PS3 controller runs out of battery without warning.


HS-645MG servo's brass gears develop slop quickly, and are ALMOST strong enough for a reliable mech, but i would not mess with them if I were starting over. Just pay the cash and go digital.

Need to bring a shooting range for next year, perhaps a collapsible laundry basket? Also need to build a custom roomba that will not destroy delicate scenery. Also need a much easier way to program gaits.

I have open sourced all the code for my robot at http://code.google.com/p/destroyallhumans/ hopefully it will be helpful for someone.