Tuesday, December 9, 2014

Officially official (codebits and pulsewidths)

This post will be a bit dry, as it is just the nuts and bolts of the project and how it went together. There are two links here. These are Github pages with all of our code. The first one shows control of all the motors, while the second one deals with sensing all the pretty colors

Underwhelming, right? 

If you must know, we had a bit of help with coding from one of our associates at NASA. Before Josh's assistance, the servos on the arm would follow exactly what the joysticks did, like a marionette. He suggested introducing a static variable and then comparing the joystick input to that. Movement now occurred when the value was greater than or less than the value to be compared to. 

An issue with the Xbox 360 controller is that some of the buttons are not analog. This is quite troublesome when trying to get a constant output, because the input isn't constant. For this reason, the chassis reverse control simply makes both motors spin backwards for one second only. However, this function works really well if you already know the position you want all the servos to go to, like the "cobra strike" position we have mapped to the 'A' button.

The coding for the color sensor is a combination of two Sparkfun sketches (the LCD and the buzzer), and the original color sensing code from fjordcarver. All of the 12 colors plus black and while had to be determined using a color wheel and then coded into the sketch. It works, I promise.


No comments:

Post a Comment