4wd1 rover with botboarduino

Hi. I am a newcomer to robotics. I have a 4wd1 chassis with standard motors, and a sabre tooth 2x12 controller and botboarduino on order. I plan to experiment with both running it on RC mode , and autonomous using sensors.

Does lynxmotion have the autonomous botboarduino software posted anywhere? I could only find it for the older processor. There are other arduino projects posted elsewhere, but I am curious if lynxmotion has a good starting point coded for their autonomous setup as sold with botboarduino.

Does anyone make a recommended web interface, GUI style that is worth acquiring? One of my goals is to monitor and control the rover via the internet using wifi (by means of an onboard router), where such signal capability exists and a GUI that run on a laptop or iPad would be ideal when using the wifi interface. I plan to separately stream video over wifi.

Thanks!

A very simple wifi bot setup that might be of interest.

viewtopic.php?f=20&t=6343

Very good information there. Just what I will be getting into. Thanks!

Anyone know if Lynxmotion has code posted anywhere for their autonomous rover kit? I would like to start with their code if they have tested it with their hardware. All I can find is the old code for the previously supported processor.

The current sample code is for PS2 control. No sample autonomous code was created as it’s unknown what people will use as sensors and what they would like it to do. We welcome your thoughts.

In ranking order of complexity:

  1. IR or sonic sensors that guide an obstacle avoiding autonomous mode;
  2. Above plus network wireless network connection to permit feedback of data, and interrupt autonomous mode to allow manual control. Possibly incorporating control of the lynxmotion arm.
  3. Above plus GPS waypoint following.

Those are my project goals in ranking order of ambition.

I think a beginner would like a plug and play version of number 1 for botboarduino assuming you use all the lynxmotion components.

My ideas, at least for where I think interest lies.

North

The feedback is certainly appreciated.

Yep I am sort-of surprised the no one converted James Frye’s autonomous code to run on the botboarduino… It is only something like 90 lines of Basic.
Use analogRead to get the input from the sensors and maybe use Servo library to generate the pulses to the Sabertooth… I used my own Servo library
earlier, but it should not take much time at all to get it up and running using three IR sensors, like the old code mentioned in the tutorial…

At HBRobotics we do a tabletop competition, the object is to find a target and push it into a goal without falling off the tabletop. I’ve used IR rangers to accomplish this. One pair of sensors detects the edge of the table, another set finds the target, and a third set find the goal.

Alan KM6VV

Here’s a quick translation of the 4wd1auto.bas Autonomous code for Bot Board II by James Frye. It compiles properly, but hasn’t been tested yet on the robot.

#include <Servo.h>

const int l_motor_pin  = 3;  // digital pin 3
const int r_motor_pin  = 4;  // digital pin 4

const int ir_left_pin  = A2; // analog pin 2
const int ir_right_pin = A3; // analog pin 3
const int ir_rear_pin  = A4; // analog pin 4

const int minspeed = 1750;
const int maxspeed = 1250;

Servo l_motor;
Servo r_motor;

int ir_left = 0;
int ir_right = 0;
int ir_rear = 0;

int LSpeed = 1500;
int RSpeed = 1500;

void setup() {
  Serial.begin(115200);
  
  l_motor.attach(l_motor_pin);
  r_motor.attach(r_motor_pin);
  
  Serial.println("Done setup().");
}

void loop() {
  sensor_check();
  debug_output();
  
  // Numbers lower than 1500 result in forward direction.
  // Numbers higher than 1500 result in reverse direction.
  
  LSpeed = (LSpeed + ir_left);  // when something is detected, this decelerates the opposite side
  RSpeed = (RSpeed + ir_right);
  
  if (ir_rear > 15) {
    LSpeed = (LSpeed - ir_rear); // if something is detected behind the robot, accelerates both sides
    RSpeed = (RSpeed - ir_rear);
  }
  
  LSpeed = constrain(LSpeed, minspeed, maxspeed);
  RSpeed = constrain(RSpeed, minspeed, maxspeed);
  
  l_motor.writeMicroseconds(LSpeed);
  r_motor.writeMicroseconds(RSpeed);
}


void sensor_check() {
  
  ir_left = 0;
  for (int i = 0; i < 9; i++) {
    ir_left = ir_left + analogRead(ir_left_pin);
  }
  ir_left = ir_left / 85;
  
  ir_right = 0;
  for (int i = 0; i < 9; i++) {
    ir_right = ir_right + analogRead(ir_right_pin);
  }
  ir_right = ir_right / 85;

  ir_rear = 0;
  for (int i = 0; i < 9; i++) {
    ir_rear = ir_rear + analogRead(ir_rear_pin);
  }
  ir_rear = ir_rear / 85;
}

void debug_output() {
  Serial.print("ir_left: ");
  Serial.print(ir_left);
  Serial.print("; ir_right: ");
  Serial.print(ir_right);
  Serial.print("; ir_rear: ");
  Serial.print(ir_rear);
  Serial.print("; LSpeed: ");
  Serial.print(LSpeed);
  Serial.print("; RSpeed: ");
  Serial.print(RSpeed);
  Serial.println();
}

Awesome, thanks!

Let us know how it works or if there are any changes to be made!

I am very close to having W.A.L.T.E.R. 2.0 mobile now, so I will be able to help get some autonomous code posted. My code uses Sharp IR and Parallax PING ultrasonic sensors for distance measurement. I don’t see why Lynxmotion couldn’t post some pretty simple autonomous code using these sensors, since they are used by so many people. My code is very modular and reusable. :slight_smile:

8-Dale

What is your thought on sensor layout? Can you have too many, and slow down the execution of code? I would like to not only navigate around obstacles, but to be able to track along a wall, where the opposite wall is further than the width of a typical hall. I am thinking an it sensor or two along the sides would permit parallel tracking along a wall or curb.

In my experience, the general rule for sensors like these is that you’ll run out of pins before your program becomes too big/slow. Even if you start using I/O multiplexers to add inputs, you can still get away with a lot of sensors using smart code before the program becomes too slow.

How do you use the debug serial output? Do you run the robot on a stand with the usb cable attached and read the output through the IDE?

That’s one way. If you have a long USB-extension cable, you can put the robot on the floor and have it move around without disconnecting it.

You can also use an Xbee Shield with a Bluetooth Bee to do it wirelessly.

You can use the Serial Monitor in the Arduino IDE, or any other serial terminal program like LynxTerm, Putty, Hyperterm, etc.