Go Down

Topic: How to control a 4wd robot to move by arduino? (Read 9748 times) previous topic - next topic

Hi everyone,
I want to control a 4wd robot to move using arduino.
http://www.dfrobot.com/index.php?route=product/product&path=35_49&product_id=97

But I am new in this region and don't know how to code.
I have assembled the robot together, also installed the arduino software. I have all the materials needed.

Can anybody tell me the process of making it move, also tell me how to code?

Thank you very much! :)

Graynomad

Quote
Can anybody tell me the process of making it move, also tell me how to code?

Anything else while we're at it :)

To do this we would have to analyse the Romeo controller schematic and spend a lot of time. And that's if you already now how to write code.

Surely there are examples on the dfrobot site.


______
Rob

Rob Gray aka the GRAYnomad www.robgray.com

Mark Bramwell

I would like to know if you can turn without tearing the wheels off.  4WD drive usually self-destructs as wheels try to rub sideways during a turn.

Graynomad

With no steering this would be the case with any robot wouldn't it.

And with no diff how does one handle the different travel of inside and outside wheels?

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Pauly

#4
Apr 11, 2011, 10:13 pm Last Edit: Apr 11, 2011, 10:14 pm by Pauly Reason: 1
I built this as well as the 2 wheeled version.  Both are coded similarly.
The 4 wheel one tends to slide more than actually turn.

http://www.robotliving.com/building-robots/four-wheeled-robot/

zoomkat

Quote
I would like to know if you can turn without tearing the wheels off.  4WD drive usually self-destructs as wheels try to rub sideways during a turn.


I've seen large skid-steer consruction equipment that didn't have the wheels falling off.
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

Graynomad

Yes most Bobcats etc do this, it's hard on the gear though and needs a lot of power (depending on the surface).

Obviously tracked robots have the same issues and they seem to work.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

DCContrarian

The way tanks steer is by having one tread move faster than the other. The ratio of the speeds controls the turning radius.  The bigger the turning radius the gentler the turn on the wheels.  You could do that with an Arduino.

I'm so appreciate to see many replies, but I still feel confused. Maybe I don't ask the question clearly. Hope someone can help me with the following questions:
1.Which equipment do I need? The arduino, the assembled robot, the robot controller(board), anything else? Do I need a Ethernet shield,cable?
How to install and connect?

2.What's the theory by controlling the robot move?

3.What kind of server-side technology do you recommend? J2EE or something else?

Thank you again for your patience.

jraskell

You are asking for a considerable amount of information here

http://www.societyofrobots.com/step_by_step_robot.shtml

That link should give you an idea of just how much information you're asking for.  It's got nothing to do with the dfrobot 4wd platform you are looking at, but it should give you a much better idea of what's involved with building a robot piecemeal or from scratch.

Pauly

To get started all you really need are four things.
1. An Arduino
2. The robot body/kit
3. Motor controller (I used one from Adafruit)
4. Batteries

Check out how I built the 2 wheeled robot.  It is almost the same for building the for wheeled robot.  http://www.robotliving.com/building-robots/two-wheeled-robot-2/

zoomkat

Below is a link to a kit 4wd robot assembly instructions. You should be able to learn a lot by studying their assembly instructions.

http://www.lynxmotion.com/driver.aspx?Topic=assem05
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

Hi everyone,
Thank you all for your kindly replies. Yesterday I finally get my first step, use the code involved here:http://www.dfrobot.com/wiki/index.php?title=DFRduino_RoMeo and finally the motor moves,(although only one moves, I'm still learning and fixing it).
The code involved in that link is as follows:
Code: [Select]
Sample Code?

int E1 = 5;     //M1 Speed Control
int E2 = 6;     //M2 Speed Control
int M1 = 4;    //M1 Direction Control
int M2 = 7;    //M1 Direction Control

///For previous Romeo, please use these pins.
int E1 = 6;     //M1 Speed Control
int E2 = 9;     //M2 Speed Control
int M1 = 7;    //M1 Direction Control
int M2 = 8;    //M1 Direction Control


void stop(void)                    //Stop
        {
          digitalWrite(E1,LOW);   
          digitalWrite(E2,LOW);     
        }   
void advance(char a,char b)          //Move forward
        {
          analogWrite (E1,a);      //PWM Speed Control
          digitalWrite(M1,HIGH);   
          analogWrite (E2,b);   
          digitalWrite(M2,HIGH);
        } 
void back_off (char a,char b)          //Move backward
        {
          analogWrite (E1,a);
          digitalWrite(M1,LOW);   
          analogWrite (E2,b);   
          digitalWrite(M2,LOW);
}
void turn_L (char a,char b)             //Turn Left
        {
          analogWrite (E1,a);
          digitalWrite(M1,LOW);   
          analogWrite (E2,b);   
          digitalWrite(M2,HIGH);
        }
void turn_R (char a,char b)             //Turn Right
        {
          analogWrite (E1,a);
          digitalWrite(M1,HIGH);   
          analogWrite (E2,b);   
          digitalWrite(M2,LOW);
        }
void setup(void)
{
    int i;
    for(i=6;i<=9;i++)
    pinMode(i, OUTPUT); 
    Serial.begin(19200);      //Set Baud Rate
}
void loop(void)
{
     char val = Serial.read();
     if(val!=-1)
       {
          switch(val)
           {
             case 'w'://Move Forward
                     advance (100,100);   //PWM Speed Control
                     break;
             case 's'://Move Backward
                     back_off (100,100);
                     break;
             case 'a'://Turn Left
                     turn_L (100,100);
                     break;       
             case 'd'://Turn Right
                     turn_R (100,100);
                     break;         
            }     
          delay(40);
       }
      else stop(); 
}


What I used are a Duemilanove Arduino, a Romeo, a 4wd robot and of course batteries. But the problem is :
1.The code above controls only two motors, when I control four motors, where should I change?

2.As you can see, there are many switch-case in the loop method, but I never used that before,what does that mean?
For example, can I enter the word "w" to control the robot move forward? Where to enter? How can I write a java interface or web interface to control?

Thank you again for everyone's help, in this place I really learned a lot. :*

jraskell

Quote
1.The code above controls only two motors, when I control four motors, where should I change?


When dealing with fixed orientation motors/wheels, controlling four motors is the same as controlling two motors, because you should be controlling the motors in pairs.  There's no reason for the two motors on the left side to be driven separately (same for the right side).  Ideally, just wire the two left motors in parallel to the motor controller (making sure the motor controller can handle the current of two motors), and then wire the two right motors in parallel to the motor controller.

Pauly

I would just double up your motor code.
Here are some examples from my code. I used the Adafruit motor shield.
RF = Right Front LF = Left Front, etc..

Code: [Select]
// defining motors

AF_DCMotor motorRF(1, MOTOR12_1KHZ);
AF_DCMotor motorLF(2, MOTOR12_1KHZ);
AF_DCMotor motorRR(3, MOTOR12_1KHZ);
AF_DCMotor motorLR(4, MOTOR12_1KHZ);


Code: [Select]
//Going forward
  motorRF.run(FORWARD);
  motorLF.run(FORWARD);
  motorRR.run(FORWARD);
  motorLR.run(FORWARD);

Go Up