Random header image... Refresh for more!

Achievement Unlocked: Big Truck Of Fail

That’s it.  I’m calling it.  This Crazy Project Weekend is over.

And it’s a big truck of fail.

The biggest problems are the motors.  They just don’t do what I tell them to do.  If they did, this would be a different story.  But I’ve spent over three days tweaking the motors and the robotics and I just can’t get it working.  Maybe I can get a Stelladaptor and try tweaking it with direct feedback.  Maybe I’d be able to do continuous smooth motion if I could have tracked all the bombs properly.  Maybe I just don’t know what I’m doing.

At least I was able to identify the playfield elements and get the computer to tell what the next move should be, even if I couldn’t actually get it to make that move.  The basic recognition and logic was a lot easier than it was for Pong, mainly because trajectories didn’t really matter.  However, I wasn’t quite able to get the bomb tracking/prediction logic working, which would have reduced the tendency for the robot to get distracted temporarily and miss a bomb.  The full tracking also would have made it possible to detect patterns and move smarter.  I also get the feeling that there’s something already in OpenCV that would have taken care of the object detection and motion tracking for me.  That library is so big and I’m not a computer vision expert, so I don’t really know what’s there or how to use it all.  The book and the documentation aren’t always enough.

And then that virus.  Stupid virus.  Make me waste half a day because the bloody computer stops working.  THAT WAS AWESOME.

The segmented auto-calibration thing did work.  I was able to adjust the robot power and swap out gears and the calibration generally figured out the new pixel/degree ratio.  If the motors were more consistent, then it probably would have worked better.  At any rate, that’s a decent technique that I’ll have to remember for the future.  And I’ll have to clean up the code for it, right now it’s kinda messy.

In the end, I did not accomplish what I set out to do.  The best score the robot ever got was 63, and that was a fluke.  And I didn’t even get close to trying to get it to play on a real TV.

March 1, 2010   No Comments

Achievement Unlocked: Welcome to Raccoon City

So, I’ve lost half the day to a stupid virus.  WONDERFUL.  After repairing my Master Boot Record from the XP Recovery Console, I’m hoping that it’s gone now.  Of course, I can’t tell because all of the Anti-Virus/Anti-Spyware tools I’ve used are COMPLETELY WORTHLESS and didn’t catch it or any of the previous outbreaks there’ve been.  I wonder if it’s been with me for months and can explain these randomly recurring virus hits that come out of nowhere and never seem to die, too.

I’d really like for someone to explain where it came from originally, too.  There has to be something I did wrong, somewhere that I let my guard down, and I’d like to plug that hole.  If I’m going to get randomly hit with no explanation while being safely behind a firewall and anti-virus program, then to hell with it, I’m going to start going to porn sites and start torrenting WaReZ.

February 28, 2010   No Comments

Achievement Unlocked: Ghost in the Machine

It’s awesome when your comuter reboots WITHOUT WARNING, then won’t restart properly, then freezes when you try to complain about how weird it’s acting.

February 28, 2010   No Comments

Guidance Systems Online

The computer can now tell you where to go.

Bombs that will be caught by the buckets in their current position turn green, bombs that will be missed turn red.  If the buckets will catch the lowest bomb, they turn green, otherwise they’re pink and give you a pointer as to how far you need to move and in which direction.  If there are no bombs detected, the buckets turn white.

February 28, 2010   No Comments

I HAZ A BUKKIT

lol0rZ.

February 27, 2010   No Comments

Achievement Unlocked: RTFM

“Any controller that uses the Atari digital joystick standard will work with these products. Included are the Atari 130/400/800/2600, Commodore 64, Sega Master System, and others. Analog controllers like the paddles are not supported.

http://www.retrousb.com/product_info.php?cPath=25&products_id=46

Well…  So much for that idea.  Unless I can get a Stelladaptor in the next hour somehow, I think that plan is out.

February 26, 2010   No Comments

“Takes Directions”: Needs Improvement

So, I hacked the new movement logic into the old Pong processing code.

After an initial lack of movement due to a flipped bit in the Busy property, the robot started turning when it was told to turn.

When it needed to move the paddle down, it rotated counter clockwise.

When it needed to move the paddle up, it rotated counter clockwise.

I think you can get a sense of the problem.

It was a bit frightening to experience, actually.  It would turn the paddle a little to the left.  Then a little more.  Eventually, it would turn so far that the paddle dropped off the bottom of the screen, causing it to launch into recovery mode.  Recovery mode is where it does a fast clockwise turn to get the paddle back into the visible playfield.  Unfortunately, when the command “Fast Clockwise Turn” gets translated into “Fast Counter-Clockwise Turn”, things can go very bad, very fast.  After the first command did not recover the paddle, it issued another command.  Then another.  Then another.  It quickly hit the counterclockwise extreme of the paddle’s rotational range, where it was again told to continue in the same direction.  Then again.  Then again.

Immovable Object (Paddle Potentiometer) + Irresistable Force (Insane Mindstorms Motor) == Flying Lego Parts.

Even when it wasn’t attempting to self destruct, the force it exerted and the noise it made while spinning seems a bit excessive.

I think it might be perfect…

At any rate, I think it tried to calibrate the movement, based on the segment calibration technique I described earlier, but I can’t tell if it worked because of its slight homicidal streak.  Gotta get working on that.

February 26, 2010   No Comments

Achievement Unlocked: Hey STELLAAAAA!!

FINALLY!  I’ve been waiting for this one all day.

February 26, 2010   No Comments

Achievement Unlocked: Wild Goose Chase

So, I found out why it wasn’t waiting…

It was waiting and I’m just a moron.

I had my program set up to send a Bluetooth message to the NXT to retrieve the contents of Mailbox 10.  One the NXT, I was writing true to Mailbox 10 when I started an action and false when the action completed, so that Mailbox 10 could be used as a “Busy” signal.  My program would poll until Mailbox 10 reported false, then continue.

Thing is, I was sending the “Clear Mailbox” flag to the NXT.  So the NXT gave me the contents of Mailbox 10, then cleared Mailbox 10.  The first read returned true, because the motor was busy.  The second read returned false, not because the action had completed, but beacuse the “Clear Mailbox” flag caused Mailbox 10 to be filled with a bunch of zeroes.

February 25, 2010   No Comments

Achievement Unlocked: The Situation Is Under Control

The first bit of code for Crazy Weekend Project III has been checked in.  It’s a rework of the OpenCV Video Capture code from CWP I that makes it a little bit more friendly and reusable.  (And probably introduces some fun bugs…)

For those wishing to play along at home:

The new solution is located here:  http://www.mathpirate.net/svn/Projects/AtariRobot/AtariRobot2/

You may be required to pull projects from other places in the repository, including /external and /Projects/AtariRobot.

Here’s the current interface of the VideoCapture class:

public class VideoCapture
{
    public List<IplImage> HistoricalFrames { get; protected set; }
    public IplImage CurrentFrame { get; protected set; }
    public CvCapture Capture { get; protected set; }
    public int FrameTimeMS { get; protected set; }
    public Options Options { get; protected set; }
    public int FrameNumber { get; protected set; }

    public void Start();
    public void Start(Options options);
    public void Stop();
}

Argh, I’ve forgotten how to successfully paste code into WordPress so that the indention isn’t mangled (Good thing I’m not writing Python!) and so greater thans and less thans and ampersands aren’t destroyed.

Anyway, you just new up one of these VideoCapture classes, then call Start().  If you’ve already configured the video options (What camera ID to use or what video file to read), you can pass that in, otherwise it will ask when you call Start().  Start() will start a new thread that constantly reads frames at the given video’s frame rate1 and sticks them into the HistoricalFrames List.  Current Frame is always the latest frame, and operations will generally use this frame.  When you’re done, call Stop() and it’ll dispose everything for you and kill the thread.  Three lines to get frames from a video.  Much nicer than the 30 or so that were there before.

  1. Or at least close to it.  I’m using Thread.Sleep() here, which is not the best for timing this sort of thing… []

February 25, 2010   No Comments