Pages: 1 ... 3 4 [5]   Go Down
Author Topic: Dagu Rover 5 chassis robot demo  (Read 41836 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey nick, i bought the same motor drive shield but im running a 4WD robot, im receiving a command throught a TCP server to move the robot in any direction, i wrote this code and want your opinion (Mind my low programing skills), this code is a test code.
Code:

#define motorpin0 2 // Direction ch1 front right motor
#define motorpin1 3 // Direction ch2 front left motor
#define motorpin2 4 // Direction ch3 back right motor
#define motorpin3 7 // Direction ch4 back left motor
#define speedpin0 5 //Speed Ch1
#define speedpin1 6 //Speed Ch2
#define speedpin2 9 //Speed Ch3
#define speedpin3 10 //Speed Ch4
int count=0;

void setup() {
//the motor control wires are outputs
pinMode (motorpin0, OUTPUT);
pinMode(motorpin1, OUTPUT);
pinMode(motorpin2, OUTPUT);
pinMode(motorpin3, OUTPUT);
//PWM Pins are outputs
pinMode(speedpin0, OUTPUT);
pinMode(speedpin1, OUTPUT);
pinMode(speedpin2, OUTPUT);
pinMode(speedpin3, OUTPUT);

}

void loop() {
 
    analogWrite(speedpin0,255);
    analogWrite(speedpin1,255);
    analogWrite(speedpin2,255);
    analogWrite(speedpin3,255);
   
  switch (count)
  {
    case 0: //forward
    digitalWrite(motorpin0,1);
    digitalWrite(motorpin1,1);
    digitalWrite(motorpin2,1);
    digitalWrite(motorpin3,1);
    delay(10000);
    count++;
    break;
   
     case 1: //Turn right
   
    analogWrite(speedpin0,50);
    analogWrite(speedpin2,50);
   
    digitalWrite(motorpin0,1);
    digitalWrite(motorpin1,1);
    digitalWrite(motorpin2,1);
    digitalWrite(motorpin3,1);
    delay(1200);
    count++;
    break;
   
    case 2: //backward
   
    digitalWrite(motorpin0,0);
    digitalWrite(motorpin1,0);
    digitalWrite(motorpin2,0);
    digitalWrite(motorpin3,0);
    delay (5000);
    count++;
    break;
   
   
    case 3: //Turn left
   
    analogWrite(speedpin1,50);
    analogWrite(speedpin3,50);
   
    digitalWrite(motorpin0,1);
    digitalWrite(motorpin1,1);
    digitalWrite(motorpin2,1);
    digitalWrite(motorpin3,1);
    delay(1200);
    count++;
    break;
}
}
Ill replace the count with the incoming command to move the vehicle as requested, im not using any encoders, also to rotate the vehicle i used the PWM, by reducing the cycle from 255 to 50 on right motoros to move it right, vice versa for the left.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi everybody im a newbie can any one help me with a sketch to control this with a Futaba 7cap transmitter ..
what i want it to do is move with the x and y axis of the right stick on the controller  ...
any and all help will be great... thanks
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

We are only running the two motor dagu 5 rover and hence we have two channels on the 4 channel motor shield unoccupied. We need to run a third dc motor to raise an lower a bridge but the stall current for the dc motor we have is 6.18 A (this is the motor http://www.mabuchi-motor.co.jp/cgi-bin/catalog/e_catalog.cgi?CAT_ID=fk_260sa). The manual for the shield says that a dc motor with stall current greater than 4.5 A should not be used, else we could damage the shield. My question is can we use this motor with the shield ensuring that we read the current pin for that channel and turning the dc motor off when the current exceeds, say 4 A?
Or can we somehow just hook it up through the arduino chip, bypassing the shield? Or do we need to get a motor with a lower stall current?

I know this was addressed to nick, but I also have the Dagu 4 motor controller and rover (4 motor version).  As long as you code it correctly and wire it to check the current on that specific motor/channel, you can absolutely have it stop when it reaches a specific amperage.
 You could probably even put in a 4amp fuse on the motor if you weren't sure of your code.  A failsafe to protect your hardware.  But it is pretty straight forward and easily done with the the 4 motor controller, so that might be overkill. Just write it to operate that specific motor while the current is less than 4amps (while loop) .
 I do something similar with the wheels.  Stop the motors and display a message on the screen.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Greetings.
I've been working on modelling and control of this platform for a while now and I have a question to ask if it is possible. The encder pulses seem to be quite long or slow to be able to get a good PID control from them. Has anyone tride this? have you been successful? can you share with me the method you used for speed measurment? I'll be more than thankful for any answer.
Cheers.
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 132
http://roverduino.blogspot.com/ http://uhebeuav.co.za
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey nick, i bought the same motor drive shield but im running a 4WD robot, im receiving a command throught a TCP server to move the robot in any direction, i wrote this code and want your opinion (Mind my low programing skills), this code is a test code.
Code:

#define motorpin0 2 // Direction ch1 front right motor
#define motorpin1 3 // Direction ch2 front left motor
#define motorpin2 4 // Direction ch3 back right motor
#define motorpin3 7 // Direction ch4 back left motor
#define speedpin0 5 //Speed Ch1
#define speedpin1 6 //Speed Ch2
#define speedpin2 9 //Speed Ch3
#define speedpin3 10 //Speed Ch4
int count=0;

void setup() {
//the motor control wires are outputs
pinMode (motorpin0, OUTPUT);
pinMode(motorpin1, OUTPUT);
pinMode(motorpin2, OUTPUT);
pinMode(motorpin3, OUTPUT);
//PWM Pins are outputs
pinMode(speedpin0, OUTPUT);
pinMode(speedpin1, OUTPUT);
pinMode(speedpin2, OUTPUT);
pinMode(speedpin3, OUTPUT);

}

void loop() {
 
    analogWrite(speedpin0,255);
    analogWrite(speedpin1,255);
    analogWrite(speedpin2,255);
    analogWrite(speedpin3,255);
   
  switch (count)
  {
    case 0: //forward
    digitalWrite(motorpin0,1);
    digitalWrite(motorpin1,1);
    digitalWrite(motorpin2,1);
    digitalWrite(motorpin3,1);
    delay(10000);
    count++;
    break;
   
     case 1: //Turn right
   
    analogWrite(speedpin0,50);
    analogWrite(speedpin2,50);
   
    digitalWrite(motorpin0,1);
    digitalWrite(motorpin1,1);
    digitalWrite(motorpin2,1);
    digitalWrite(motorpin3,1);
    delay(1200);
    count++;
    break;
   
    case 2: //backward
   
    digitalWrite(motorpin0,0);
    digitalWrite(motorpin1,0);
    digitalWrite(motorpin2,0);
    digitalWrite(motorpin3,0);
    delay (5000);
    count++;
    break;
   
   
    case 3: //Turn left
   
    analogWrite(speedpin1,50);
    analogWrite(speedpin3,50);
   
    digitalWrite(motorpin0,1);
    digitalWrite(motorpin1,1);
    digitalWrite(motorpin2,1);
    digitalWrite(motorpin3,1);
    delay(1200);
    count++;
    break;
}
}
Ill replace the count with the incoming command to move the vehicle as requested, im not using any encoders, also to rotate the vehicle i used the PWM, by reducing the cycle from 255 to 50 on right motoros to move it right, vice versa for the left.

I Like your idea of how to handle the direction of the rover, I am doing the same , but I need to find out how I can use my joystick ( diy remote) as a double use I want to control the speed of my rover by the amount you push on the joystick, so when you press it forward 1mm it gives you very slow speed , but full and it gives you high speed but at the same time it needs to take direction into account.
Logged

He who does not try ,does not fail ,does not learn not to fail again http://powerduino.blogspot.com/

Offline Offline
Full Member
***
Karma: 0
Posts: 132
http://roverduino.blogspot.com/ http://uhebeuav.co.za
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

and other question I have is how would I handle it when n joystick is held between 12 o clock and 9 oclock . what code would run ?
Logged

He who does not try ,does not fail ,does not learn not to fail again http://powerduino.blogspot.com/

Larnaca, Cyprus
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Getting one of these for christmas, with a rangefinder and an IR sensor. Along with the pan and tilt sensor mount it should be a nice little rover. I intend on getting some xbees and writing a .NET app to control it from my laptop.
Logged

Belgium
Offline Offline
Sr. Member
****
Karma: 1
Posts: 283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Greetings.
I've been working on modelling and control of this platform for a while now and I have a question to ask if it is possible. The encder pulses seem to be quite long or slow to be able to get a good PID control from them. Has anyone tride this? have you been successful? can you share with me the method you used for speed measurment? I'll be more than thankful for any answer.
Cheers.

I've finally hooked up the encoders on my Rover 5 and wrote some code for them: http://www.bajdi.com/rover-5-encoder-speed-control/ Just trying to make all 4 motors rotate at the same speed. It works but maybe a PID control would be better?
« Last Edit: November 19, 2013, 05:44:18 am by Bajdi » Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,
I recently wired up my Arduino/Rover5 system and written a short tutorial:
http://www.dcsc.tudelft.nl/~mforgione/rover5.html

I implemented PID controller for the position of the robot both using the encoders and an ultrasonic sensor and
it works pretty ok.
I did not try to implement velocity control, but my feeling is that the encoders are sufficiently accurate for that.
Keep me updated!
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 221
Posts: 13855
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Marco for sharing!
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 498
Posts: 19065
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for posting. The lid was a good idea, I didn't think of that. smiley
Logged


Brisbane, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1123
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for posting. The lid was a good idea, I didn't think of that. smiley
That sure does tidy things up a little.  There's an awful lot of stuff and not much room at all.
Logged

"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am using the same motor driver as your are, but I am a bit confused on what pins I should use on the driver.  I am using a pololu motor and the link is listed below.  I am assuming that I need to use the pins on the right side of the board, or am I worng?

http://www.pololu.com/product/1443
Logged

Belgium
Offline Offline
Sr. Member
****
Karma: 1
Posts: 283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Dagu is now selling a new kit that fits on top of the Rover 5 chassis: the service droid. I got an early version and just started playing with it. At the moment it's remote controlled by another Arduino through nRF24L01 modules. But I will add a raspberry pi and camera and try to do some autonomous stuff.
Logged


Pages: 1 ... 3 4 [5]   Go Up
Jump to: