3D Robotics

Bug fixes in the Basic Stamp Autopilot code

Now that I'm doing hardware-in-the-loop testing with the GPS simulator, the bugs in my code are showing up quickly, just as they should. Here's one small-but-deadly one I found this eve: all the code using the FT639 servo controller chip should have a special serial port configuration line that's different from the one we use for the GPS module. Turns out that the GPS module runs at 4800 baud and the FT639 runs at 2400 baud. Sigh. That'll teach me to read the spec sheets.

For the BS2p chip that we use, you need to insert the line "FTBaud CON 17405" and switch all the "Baud"s in the SEROUT commands to that chip to "FTBaud". I've updated both of the autopilot programs here that use the FT639 chip appropriately, so they should both work fine now. If you've been having trouble with the code, download the latest versions from that post, and see if this doesn't fix the problem.

Here's what's been tested so far:

1) Channel 5 turns the autopilot on and off
2) When in RC mode, the Basic Stamp passes through the rudder and elevator commands from the receiver to the servos. Jerkyness is minimal.
3) When in autonomous mode, GPS data is recorded, correctly parsed, and commands are send to the rudder and elevator servos.

Next to test: whether the waypoint navigation routines are working right.

The picture above shows the test setup with two servos, a RC receiver, and a GPS module. For GPS simulation, you just replace the GPS module with a USB-to-serial board, and then use GPS simulation software to generated the GPS data as described in this post. Here's what the setup above looks like with the USB-to-serial board replacing the GPS module:

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • ok thanks for clearing that up
  • It's to catch bugs in the code in a safe testing environment, or else you would have to test it in the air, where you risk crashing.
  • what is so important about gps simulation?
This reply was deleted.