Rover/Tri-track running on BotBoarduino and other Arduinos

I Thought I would also share that I also have also converted the rover code to run on the Arduino and I have specifically tested it with a Beta version of the Botboarduino.

Currently I am using a Roboclaw on my Tri-track with a PS2. This code was based on a stripped down version of the Rover with Arm code that was done earlier by Xan, which I hacked up. I am not using Arm on this Rover but I do have the code working with a Pan and Tilt.

The code can be configured to run in PWM mode or in Packet Serial mode. Both of these modes should also be compatible with the Sabertooth 2x15 and the PWM mode should work on the Sabertooth 2x15 RC. Have not tried it, but I do have an old 2x10 which I could try if need be…

Right now I think the PWM/RC mode runs smoother on the Botboarduino as the Packet Serial mode uses SoftwareSerial to talk to the controller board, which works fine at 19200, but the SoftwareSerial class disables interrupts while it is outputting (or inputting) a byte, which makes sure that the data gets out there properly, but this causes the servo code to not be able to process interrupts, so you may get delays in the servo pulses… Always a trade off.

But the Packet Serial mode has advantages on the Roboclaw in that you can then use the encoders…

Like the other Sketches I have uploaded, this one also depends on several external libraries. These include:

0)My servoEx library: You can download from the Brat thread: viewtopic.php?f=48&t=7590

  1. PS2X_LIB: which you can get more information including pointers for download at: billporter.info/?p=240

  2. Streaming: Because I am lazy: arduiniana.org/libraries/streaming : I find it easier to do:
    Serial << "Blah: " << _DEC(myBlah) << endl;
    Than have to do this with separate commands:
    Serial.print("Blah: ");
    Serial.println(myBlah, DEC);

  3. SoftwareSerial: Note: I am using the NewSoftSerial 11 beta, which I believe will become the new official software serial (arduiniana.org/2011/01/newsoftserial-11-beta/). Why? This is needed on the non-mega boards like Botboarduino as it adds support for things like Streaming (Based on stream class). Also it uses the PinChange interrupt for input, such that it can buffer input…

Again this is a Work In Progress, so …

The code is currently configured to run the motor controller using PWM mode and is set up to have a Pan and Tilt servo. I should warn that I was a bit lazy and did not retest the code in the other configurations, after I converted the code to use my Servo library… Sorry…

Kurt
Arduino_Rover-111202a.zip (8.66 KB)

Wow Kurt very cool. These will come in handy very soon. What kind of encoder support / behavior does the program exhibit? Can you go into more detail?

Hi Jim,

I thought it would be nice to have the beginnings of Arduino software for each class of robot, so I began this version a little while ago. I am doing my testing of the code using the Tri-track that I purchased awhile ago to try out the Robo-claw. More details in the thread: viewtopic.php?f=20&t=6205

My tri-track has 2 motors with encoders connected to the Robo-claw. My earlier BAP28 code had tests in it that did things like print out encoder counters, Try to make the robot go in a square and end up where it started. I found some of these commands tricky to use as you can tell the roboclaw that you want it to go at speed X for a Distance Y, which is great, however what it did was to go for that distance and then start to slow down, so it always went farther than what you specified. So with my go in a square test you tried to play games like say go the distance Y - a guess on how long it will take to do stop or for the next commands differences to take effect. Lots of fun, but I never got it completely accurate.

However I did not port this part of my code over to this program (yet) as I have so far found that the code when run on the BotBoarduino runs better in PWM mode. Also I thought it would first get up a version that can run on either the Roboclaw or the Sabertooth. But maybe later.

Kurt

Well Arduino 1.0 came out within the last few days :smiley:, so I thought I should update all of my stuff to run with it. They changed several things like what file to include in a .CPP file, The extension of the sketch (was .pde now is .ino) …

I now have the Rover running with it. Needed to make a few changes, to my libraries and the like. The bright side is that Software Serial is now updated to the version I was using.

There are updated PS2X_lib and Streaming that are included or linked to by my Phoenix thread: viewtopic.php?f=20&p=77517#p77517

I have included here an updated servoEx library as well as the sketch.
Arduino_Rover-111203a.zip (8.66 KB)
ServoEx.zip (18.6 KB)