At Least I’m Better Than The Robot.
March 1, 2010 No Comments
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
SUCK ON THAT, NEW STRATEGY!
March 1, 2010 No Comments
Bug Tracking
March 1, 2010 No Comments
Learning From Mistakes
It made it through Round 1 and got a score of 56 points. Time to take a step back and analyze what I’ve observed.
- The biggest problem is losing track of the bomb. It will be on track to catch the lowest bomb, when suddenly the detection will skip a beat and it’ll take off across the screen for something else and can’t get back fast enough to catch the bomb. I have to fix this first. I’m pretty sure I have outlier detection from the Pong game that I can reuse here.
- The segmented calibration that I described back on the first day seems to be working fairly well. That’s where the robot moves the paddle knob a known number of degrees, then the program sees how far that moved the buckets on screen, and calculates how many pixels a degree is. This lets the program know that to catch the bomb that’s 70 pixels away, it will have to rotate the paddle 30 degrees. I suspect that I will have to tweak the algorithm a bit, though. Mainly, I think it will need to do several calibration turns to refine the numbers.
- The response time is going to be a killer. I have little doubt that the motor itself can move the paddle into position fast enough. When it moves, it zips across the screen. The problem is that it doesn’t get moving as fast as it needs to and there’s an unacceptable lag between commands. I think I might still be seeing an echo of the waggle. It’s not as visible, due to the weight on the spinner assembly now, but I think that delay is still there. If I can fix some of the other issues, I suspect that the response time is going to prevent the robot from getting past around level 3.
- The NXT has an inactivity timer. The robot turned itself off in the middle of a game. Gotta take care of that…
- I don’t want to keep hitting the button to start a round. I’m going to have to implement the button press. Unfortunately, implementing the button press means I’ll have to change around how the PaddleController class works. It’s a dirty hack right now, I gotta clean that up.
- I like that Kaboom! is a much faster game cycle than Pong. With Pong, I couldn’t always tell what was wrong right away. Sometimes it took a minute or two to get the ball in a situation where something went wrong. I’d implement a fix and try again, and again, it would take a minute or two. Kaboom! doesn’t last that long. The games at this point are less than a minute long, sometimes much less. If the robot is going to lose, it’s going to lose fast. It’s not going to end up in a cycle where the ball keeps bouncing around between the same two points over and over and over for five minutes. If a game in Kaboom! lasts five minutes, then it’s an amazing success.
February 28, 2010 No Comments
56 Points!
February 28, 2010 No Comments
Round 1 Success!
February 28, 2010 No Comments
200% Improvement!
Doubled its score in just a few minutes. If I can keep on this rate of improvement, it’ll be awesome in no time!
February 28, 2010 No Comments
7 > 0
February 28, 2010 No Comments
Finite State Machine
I think I’m going to have to put together a finite state machine for the robot. The robot for Pong had essentially two states: “Playing” and “Totally Flipping Out”. I need to do a better job than that for this one.
Here’s the basic states for Kaboom!:
- Bombs on screen:Â Track the lowest bomb.
- No Bombs on Screen: Press button.
- No Buckets on Screen:Â Hit Game Reset switch.
At this time, it won’t be able to hit the Game Reset switch itself, so it should probably put a notice on the screen for human intervention. ((And I don’t want to give it the ability to hit the reset switch itself. You teach it how to do that and you never know what it’s capable of.)) For the “No Bombs on Screen” state, it’s going to have to hit the button, then wait before trying to hit the button again, otherwise it’ll hit the button a second time, before the bombs start to fall, and it’ll lose precious reaction time. When the bombs are on the screen, it’s going to have to be careful and make sure that it doesn’t get fooled by blips where the lowest bomb disappears for a frame. However, it can’t be too careful, since it’s going to have to move to the next spot as soon as it catches a bomb.
For now, I’ll get the “Bombs on Screen” state going, since that’s the one that’s important. I can hit the button myself for now, as long as I’m careful to keep my fingers clear of the spinning bricks.
February 28, 2010 No Comments