go away spammer

Author Topic: RV-1 A.E.R. is finished...for now!  (Read 2780 times)

0 Members and 1 Guest are viewing this topic.

Offline blackheartTopic starter

  • Full Member
  • ***
  • Posts: 111
  • Helpful? 1
RV-1 A.E.R. is finished...for now!
« on: May 09, 2009, 06:14:32 AM »
There is an older thread about my rover, but I decided to start a clean one.  In this thread, you will find details, source code and useful information if you want to make a quad-rover.

Here is a video of RV1 working: RV-1 Autonomous Rover Robot using an Arduino

I will start with the chassis. It's constructed from 4 plates of Etalbond. In case you never heard of it, it's made out of 1 sheet of plastic covered on the sides by 2 sheets of aluminium. Here is more information on the material: http://en.wikipedia.org/wiki/Etalbond

I have a bottom piece with front and rear walls, 2 side panels onto which the 4 servos are attached, and a top panel to cover up the wiring.

The brain's role is taken by an arduino Diecimila, soon to be replaced with a "$50 robot board "

I have 2 separate sources for the arduino and the servos. A 9V is powering the arduino and a 6V gel-cell battery pack supplying 4A is powering the motors.

4 Hitec HSR-1422CR Continuous Rotation servos(They are not controlled individually. I have 2 pairs of 2...left and right) move the robot towards a clear place, which takes me to the next part...Sensors:

1 sharp IR rangefiner(20cm-80cm) is placed on 2 micro heli servos that allow it to "scan" 360 degrees. I am going to place 2 more sensors in the front of the wheels(It needs them).

Programming:
The code is written for the Arduino IDE, for AVR MicroControllers(ATMega8, 48, 168, 328, etc).
Code: [Select]
#include <SoftwareServo.h>
SoftwareServo sp1, sp2, sa, sb;
int pin_sp1, pin_sp2, pin_sa, pin_sb;
byte pin_ir1, pin_ir2, pin_ir3;
float read_cm(byte pin) {
int tmp;

tmp = analogRead(pin);
if (tmp < 3)
return -1; // invalid value

return (6787.0 /((float)tmp - 3.0)) - 4.0;
}

void fwd(void) {
  if(!(sp1.attached()))
      sp1.attach(pin_sp1);
  if(!(sp2.attached()))
      sp2.attach(pin_sp2);
  sp1.write(180);
  sp2.write(0);
  for(int i = 0; i < 50; i++) {
  SoftwareServo::refresh();
  delay(15);
  }
}

void back(void) {
  if(!(sp1.attached()))
      sp1.attach(pin_sp1);
  if(!(sp2.attached()))
      sp2.attach(pin_sp2); 
  sp1.write(0);
  sp2.write(180);
  for(int i = 0; i < 50; i++) {
  SoftwareServo::refresh();
  delay(15);
  }
}
 
void left(void) {
  sp2.detach();
  if(!(sp1.attached()))
      sp1.attach(pin_sp1);
  sp1.write(180);
  for(int i = 0; i < 50; i++) {
  SoftwareServo::refresh();
  delay(15);
  }
}

void right(void) {
  sp1.detach();
  if(!(sp2.attached()))
      sp2.attach(pin_sp2);
  sp2.write(0);
  for(int i = 0; i < 50; i++) {
  SoftwareServo::refresh();
  delay(15);
  }
}

void servo_delay() {
  int t;
  for(t = 0; t < 10; t++) {
    SoftwareServo::refresh();
    delay(50);   
  }
}

void center() {
  sa.write(95);
  sb.write(65);
  SoftwareServo::refresh();
}

int scan() {
  float val_s, val_r, val_l, val_d;
  val_s = val_r = val_l = val_d = 0;
  sa.write(95);
      servo_delay();
      val_s = read_cm(pin_ir1);
  sa.write(145);
      servo_delay();
      val_l = read_cm(pin_ir1);
  sa.write(45);
      servo_delay();
      val_r = read_cm(pin_ir1);
  center();
  if(val_s < 20 || val_l < 20 || val_r < 20)  back();
  if(val_l > val_r)  left();
  else  right();
}
void setup() {
  pin_sp1 = 3;
  pin_sp2 = 6;
  pin_sa = 2;
  pin_sb = 4;
  pin_ir1 = 0;
  pin_ir2 = 2;
  pin_ir3 = 4;
  sp1.attach(pin_sp1);
  sp2.attach(pin_sp2);
  sa.attach(pin_sa);
  sb.attach(pin_sb);
  digitalWrite(13, HIGH);
  Serial.begin(9600);
}
void loop() {
scan();
}


I'm out of ideas!

Offline Jaryd107

  • Jr. Member
  • **
  • Posts: 19
  • Helpful? 0
  • Building my first $50 robot
Re: RV-1 A.E.R. is finished...for now!
« Reply #1 on: May 09, 2009, 01:42:13 PM »
Awesome. Looks cool. :)

Offline blackheartTopic starter

  • Full Member
  • ***
  • Posts: 111
  • Helpful? 1
Re: RV-1 A.E.R. is finished...for now!
« Reply #2 on: May 11, 2009, 01:57:03 AM »
I am glad you like it. Thank You everyone!
I'm out of ideas!

Offline SmAsH

  • Supreme Robot
  • *****
  • Posts: 3,959
  • Helpful? 75
  • SoR's Locale Electronics Nut.
Re: RV-1 A.E.R. is finished...for now!
« Reply #3 on: May 11, 2009, 02:25:47 AM »
hehe, looks like a great robot! nice work man...
Howdy

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
    • Ro-Bot-X Designs
Re: RV-1 A.E.R. is finished...for now!
« Reply #4 on: May 11, 2009, 05:25:26 AM »
Very nice, congrats!

I see you didn't average the sensor readings, how come? You don't need the precision or it didn't give you good results?
Check out the uBotino robot controller!

Offline jakx12

  • Robot Overlord
  • ****
  • Posts: 183
  • Helpful? 2
Re: RV-1 A.E.R. is finished...for now!
« Reply #5 on: June 02, 2009, 02:41:50 PM »
very cool, good work  ;D
Need help with an algorithm or a maths related problem? Ill be glad to help :)

 


Get Your Ad Here

data_list