RMOAR - On construction

Hello to everyone this is my first robot here in LMR but i haven't finished it yet .

I call RMOAR because its letter is one of its functions it means : Remote Monitored Obstacle Avoidance Robot

Its basic function was to avoid every obstacle in his way  but then i decided to remake in order to follow objects with a certain

color and in his way to the object he will also avoid any obstacle.

 

And i have some photos of it in its current state and some from the first states of it.

 

I wrote some code but i dont think that its goin to work and i need some help in order to improve it.

 

 

(UPDATE: 21/2/11)Here is the new code I made:

#include <Servo.h>

Servo servo1;
Servo servo2;
Servo servo3;
int V1,V2,D1,D2;
int sensorPin1 = 5;
int sensorPin2 = 4;
int servoL = 9;
int servoR = 10;
int servoScn = 11;
int ledPin = 13;    
int sensorValue1 = 0; 
int sensorValue2 = 0;
void setup() {
  pinMode(ledPin, OUTPUT);
  pinMode(sensorPin1,INPUT);
  pinMode(sensorPin2,INPUT);
  pinMode(servoL,OUTPUT);
  pinMode(servoR,OUTPUT);
  pinMode(servoScn,OUTPUT);
  servo1.attach(servoL);
  servo2.attach(servoR);
  servo3.attach(servoScn);
  Serial.begin(9600);
 
}

void loop() {
  Schfobj();
  while(Schfobj() == 0){
    moveForward(100);
    if(Schfobj() != 0){
      continue;
    }
  }
  if(Schfobj() == 1){
     moveRight(170,2500);
  }
  if(Schfobj() == 2){
     moveLeft(170,2500);
  }
  if(Schfobj() == 3){
   moveBackward(170,2500);
  }
  

}

int Schfobj() {
   for(int i = 0; i < 180; i = i + 1){
      V1 = analogRead(sensorPin1);   
      V2 = analogRead(sensorPin2);   
      D1 = (6787 / (V1 - 3)) - 4;
      D2 = (6787 / (V2 - 3)) - 4;
      servo3.write(i);
      delay(50);
      Serial.print("Distance 1 : " + D1);
      Serial.println(" Distance 2 : " + D2);
      if(i <= 90 && (D1 < 15 || D2 < 15)){
         return 1;
      }
      else if(i >= 180 && (D1 < 15 || D2 < 15)){
         return 2;
      }
      else if( i == 90 && (D1  < 15 || D2 < 15)){
         return 3;
      }
      else {
         return 0;
      }
   }
}
void moveLeft(int Speed , int Delay){
      servo1.write(Speed - 91);
      delay(Delay);
      servo2.write(Speed);
      delay(Delay);
}
void moveRight(int Speed,int Delay){
      servo1.write(Speed);
      delay(Delay);
      servo2.write(Speed - 91);
      delay(Delay);
}
void moveForwardd(int Speed,int Delay){
      servo1.write(Speed);
      delay(Delay);
      servo2.write(Speed);
      delay(Delay);
}
void moveBackward(int Speed,int Delay){
      servo1.write(Speed - 91);
      delay(Delay);
      servo2.write(Speed - 91);
      delay(Delay);
}
void moveForward(int Speed){
      servo1.write(Speed);
      servo2.write(Speed);
     
}

It passes the Compile but if anyone can test it for logical mistakes it could be helpfull.

 

It will follow objects with certain colors and in its way to the object it will avoid any obstacle and it is also remote monitored by a pc (it will have and rc mode)

  • Actuators / output devices: 2 x Parallax (Futaba) Continuous Rotation Servo and one standard 180 degrees servo.
  • Control method: autonomously controlled by onboard microcontroller and digital wireless connection from Windows System with xbee modules(900mhz)
  • CPU: It uses an atmega 328 on an arduino duemilanove.
  • Operating system: windows XP
  • Power source: 7.2 volt 1800 mAh Ni-cd
  • Programming language: Wiring(some kind of c and c++ for microcontrollers)
  • Sensors / input devices: It uses 2 x Sharp GP2Y0A02YK0F and one ColorPal from Parallax .
  • Target environment: indoor flat surfaces

This is a companion discussion topic for the original entry at https://community.robotshop.com/robots/show/rmoar-on-construction

Color Pal

I just want to try to save you some time here. I just read the data sheet for your color detector… This type of sensor is designed for “contact” sensing. I.e. what you want to scan must be in contact with the sensor (think the paint color scanner at the hardware store). This is not a kind of sensor that could look into a room, find something red and follow it.

link of the store

Have you something to propose for this kind of application(for my robot)?

Kinda tough

It could be done through blob detection, but you would be looking at a webcam, laptop, way of communitcation between laptop and robot and lot of software.


I think i will remove this function from the rmoar …

 

Don’t give up!try an ldr or

Don’t give up!

try an ldr or infrared sensor with cellophane (candy wrapper plastic) of whatever color you want over it. The brightest place should be an object of that color. You can also try the gels they use for color projectors in theater. If you know anyone in theater or have a school theater or something, ask. They have to cut shapes out and throw scraps out all the time if they aren’t big enough.

You would need a separate infrared sensor for object avoidance. I’m thinking a couple ldrs (like you would for line-following) for colors and infrared for objects.

To make it better at finding colors, use a bright led (but shielded from the ldr to prevent interference) of the same color as what you’re looking for. Or just get a bright white led and shine it through whatever you used for the ldr.

Really, there are a lot of ways you could do this. I did some research a while back about this thinking about making a red bullfighter robot and a red-following bull robot.

These pictures looking like

These pictures looking like I see the world after the 15th beer :slight_smile:

Can you clean the lens of your camera?

which pictures?

which pictures ?the last two?

all — and I had no beer

all — and I had no beer till now. See this nobody else?


I can only retake the last 2 photographs is this ok ?

ColorPAL

Hello flokos, I wondered what piece of code your using to communicate between the colorPAL and Arduino. I recently bought a colorPAL for use with my Arduino but can’t get anything working. Is there a chance you could upload what your using to help me?

   Thanks. goatboy

**i will not use colorPal **

the reasons are below (othe members replies) and i havent get colorPal work yet but if il make something il give you a copy.

Is that…

Is that the metal shell of a CD/DVD drive?

Well in any case it looks awesome.


Yes it is.I started building it with a cd/dvd case but it was too high so I changed it and now Im using the one on the photos.


Well I think its cool how i have seen robots built out of everyday material like a CD/DVD drive case and so on. Awesome robot. It has inspired me.