wall following

10 hours till presentation

Well needless to say I'm not getting any sleep tonight. Needed a little break, so i figured it was a good time for a blog post. Took me longer than I expected to get mplabs going on windows 7 64bit. Had to do a bit of "searching" to find the C30 compiler, and then I had to figure out how to install the 64 bit emulator drivers. So now we're good to go. I'm playing around with alternative mounting solutions for the ir rangefinders. I want them to be at a greater angle to the wall because slight rotation of the robot changes the readings drastically. This means rewriting a lot of the wall following algorithm. Time to get more coffee.
 
Well this is the result of no sleep for two nights in a row. It reads the serial port and is able to parse out messages even if there is a lot of noise coming through. It also has error checking in case the messages get corrupted. I successfully got the real robot sending it's location wirelessly which was updating the virtual one's location in real time. It's pretty cool.

No Time!

I need to have something to present in 2 days so I'm just throwing something together quickly. Last night I wrote a program using the XNA game engine and embedded it into a winforms application. Basically it's a blue screen with a black box with 4 usable functions: MoveUp() MoveDown() MoveLeft() MoveRight(). Today I added my serial code to it and I am able to move the box around the screen through serial commands. Tomorrow I'll have to program some simple obstacle avoidance algorithm into one of the robots and get it to pass info every time it runs into something so that the program will be able to update the box's position. Luckily the science fair isn't for another month.

Transmitter

The problem was the I wasn't reinitializing the buffer after I started filling it again. Some of the characters received were NULL and that was messing it up the second time around. Anyway, it's working now and the messages are coming through very well. Now I'm starting to work on the transmitter. Since the pic on the transmitter board has no way to communicate with my C# program, I am using my arduino board with an AND gate to turn the transmitter on and off (tom's idea). Hopefully the transmitter won't be as much trouble as the receiver was.   

Null Reference Errors -.-

Ok, the serial is now working! So now I have my program storing the incoming wireless data into a buffer and once the end of message (">>>") pattern is detected, the buffer is passed to a parsing function and then cleared. But for some strange reason, when i initialize the buffer to nothing, the serial doesn't want to work. When I don't initialize, I get a Null Reference Error when passing in the data...ugh

Serial

I'm having issues with the serial com in my C# program. It's giving me parity errors even though I have set no parity checking on either end. However, it works fine in python and hyperterminal. I looked at the data through realterm and I was seeing some weird stuff. Hopefully we'll get it figured out on monday.

Encoder's Done

I finished all our functions for the encoders. We can now easily have the robot record how far it has traveled, and we I wrote a function that moves the robot forward and stops it once the desired distance is achieved. I'm pretty happy with it's accuracy and consistency.

More About Encoders

Dave's taking today off, so I'm not sure about how much is really going to get done. Yesterday before we left I finally got the interrupt working and counting the number of tape marks. The reason it was messing up was because I wasn't clearing the interrupt flag and it just kept looping. I'll have to see how consistent it is, but I have a feeling that we're going to have to space the markers out a bit and make them bigger so there is less of a chance of the encoder missing it. The code is also starting to get messy again. There are at least 200 lines of compass code in the main source file sharing variables with functions it shouldn't. I'm not looking forward to cleaning it up. I finally got some pictures the other day. I'll probably upload them tonight.  

Encoders

We're only in for a few hours today. Dave needs to change the pin that he soldered the encoders to because they're on digital pins instead of input capture bits. Dave's not impressed... But the sensors themselves are working great though.