Kinematika Differential Wheels Robot PDF Free
Kinematika Differential Wheels Robot PDF Free
4 WHEELS ROBOT
Tujuan
Memahami perhitungan trayektori differential wheel robot.
Memahami kinematika differential wheel mobile robot.
Pokok Bahasan
Differential Wheels Robot
Perhitungan Trayektori
Eksperimen 4-1: Perhitungan Trayektori
Differential Wheels Robot Forward Kinematics
Eksperimen 4-2: Differential Wheels Forward Kinematics
Differential Wheels Robot Inverse Kinematics
Eksperimen 4-3: Differential Wheels Inverse Kinematics
Tugas dan Pertanyaan
Peralatan Eksperimen
1 unit 2WD Nexus Robot
1 unit PC dengan software Arduino IDE
4.Kinematika Differential Wheels Robot
B. Perhitungan Trayektori
Untuk menghitung trayektori (lintasan) robot saat ini, maka dapat dilakukan dengan cara
membaca secara terus menerus nilai rotary encoder yang dipasang pada kedua roda.
Gambar 4-2 memperlihatkan jarak tempuh yang dilalui differential wheels robot.
: radius roda
1. Hitung nilai dan dalam satuan meter yaitu jarak tempuh roda kiri dan kanan.
2. Membagi jumlah pulsa encoder yang terukur dengan jumlah pulsa encoder untuk
satu putaran penuh untuk mendapatkan jumlah putaran roda.
3. Mengalikan jumlah putaran roda dengan keliling roda, sehingga diperoleh jarak yang
telah ditempuh dalam satuan meter menggunakan persamaan
(4-1)
( )
(4-3)
( )
(4-4)
8. ̇ ̇
Kita akan mendapatkan velocity menggunakan kecepatan roda masing-masing dan
̇
̇ (4-6)
Gambar 4-3 menunjukkan rotasi robot terhadap jarak tempuh
̇ ̇
̇ ̇
̇ ̇
#include <PinChangeInt.h>
#include <PinChangeIntConfig.h>
#define PIN1 4
#define PIN2 6
int encoder1PhaseA = 4;
int encoder1PhaseB = 5;
int encoder1Position = 0;
int encoder2PhaseA = 6;
int encoder2PhaseB = 7;
int encoder2Position = 0;
int n,m = LOW;
float sL,sR,s;
float r=143/2; //wheel radius
float phi=3.14;
int tickPerRev=775;
float PHI;
float d=290;
void setup() {
pinMode (encoder1PhaseA,INPUT);
pinMode (encoder1PhaseB,INPUT);
void loop()
{ sL=(2*phi*r*encoder1Position)/tickPerRev;
sR=-(2*phi*r*encoder2Position)/tickPerRev;
s=(sL+sR)/2;
PHI=(sL-sR)/d;
PHI=(180/3.14)*PHI;
Serial.print ("Enc1="); Serial.print (encoder1Position);
Serial.print ("\t");
Serial.print ("Enc2="); Serial.print (encoder2Position);
Serial.print ("\t");
Serial.print ("sL="); Serial.print (sL); Serial.print (" ");
Serial.print ("mm");
Serial.print ("\t");
Serial.print ("sR="); Serial.print (sR); Serial.print (" ");
Serial.print ("mm");
Serial.print ("\t");
Serial.print ("s="); Serial.print (s); Serial.print (" ");
Serial.print ("mm");
Serial.print ("\t");
Serial.print ("PHI="); Serial.print (PHI); Serial.print (" ");
Serial.print ("deg");
Serial.println ("\t");
}
void readEncoder1()
{
n = digitalRead(encoder1PhaseA);
if (n == HIGH) {
if (digitalRead(encoder1PhaseB) == LOW) {
encoder1Position--;
} else
{ encoder1Position+
+;
}
}
}
void readEncoder2()
{
m = digitalRead(encoder2PhaseA);
if (m == HIGH) {
if (digitalRead(encoder2PhaseB) == LOW) {
encoder2Position--;
} else
{ encoder2Position+
+;
}
}
Belajar Robotika, Hak Cipta: Hendawan Soebhakti, 2017 Hal. | 6
}
[] [ ][ (4-6)
̇]
Dimana:
#include <PinChangeInt.h>
#include <PinChangeIntConfig.h>
#define PIN1 4
#define PIN2 6
int encoder1PhaseA = 4;
int encoder1PhaseB = 5;
int encoder1Position = 0;
int encoder2PhaseA = 6;
int encoder2PhaseB = 7;
int encoder2Position = 0;
int n,m = LOW;
float sL,sR,s;
float r=143/2; //wheel radius
float phi=3.14;
int tickPerRev=775;
float PHI;
float d=290;
int timer2_counter;
int pulse1, pulse2;
float rpm1, rpm2;
float rps1, rps2;
float v,w;
void setup() {
//Setup Timer2 to fire every 1.6ms
TCCR2B = 0x00; //Disable Timer2 while we set it up
TCNT2 = 6; //Reset Timer Count to 6 out of 255
TIFR2 = 0x00; //Timer2 INT Flag Reg: Clear Timer Overflow Flag
TIMSK2 = 0x01; //Timer2 INT Reg: Timer2 Overflow Interrupt Enable
void loop(){
v = 2*phi*r*((rps1/2)+(rps2/2)); w
= 2*phi*r*(-(rps1/d)+(rps2/d));
Serial.print (rps1); Serial.print (" ");
Serial.print (rps2); Serial.print (" ");
Serial.print (v); Serial.print (" ");
Serial.println (w);
}
void readEncoder1()
{
n = digitalRead(encoder1PhaseA);
if (n == HIGH) {
if (digitalRead(encoder1PhaseB) == LOW) {
encoder1Position--;
pulse1--;
} else
{ encoder1Position+
+; pulse1++;
}
}
}
void readEncoder2()
{
m = digitalRead(encoder2PhaseA);
if (m == HIGH) {
if (digitalRead(encoder2PhaseB) == LOW) {
encoder2Position--;
pulse2--;
} else
{ encoder2Position+
+;
pulse2++;
}
}
}
[ [ ][ ] (4-6)
̇]
Dimana:
#include <PinChangeInt.h>
#include <PinChangeIntConfig.h>
#define PIN1 4
#define PIN2 6
boolean M1=8; //DIR
int E1=9; //PWM
boolean M2=11; //DIR
int E2=10; //PWM
int encoder1PhaseA = 4;
int encoder1PhaseB = 5;
int encoder1Position = 0;
int encoder2PhaseA = 6;
int encoder2PhaseB = 7;
int encoder2Position = 0;
int n,m = LOW;
int timer2_counter;
int pulse1, pulse2;
float rpm1, rpm2;
float rps1, rps2;
float v,w;
float thetaDotL, thetaDotR;
float x1,x2,y1,y2;
// PID 2
float Kp2=4; // osilasi di 15, set setengahnya
float Kd2=0.001;
float Ki2=0.1; // mengurangi sse
float setPoint2, PV2;
float outPID2, Sum2;
float minPID2 = -2.42;
float maxPID2 = 2.42;
float error2 = 0;
float error2_1 =0;
void setup() {
//Setup Timer1 as PWM output TCCR1B=TCCR1B&0xf8|0x01;
// Pin9,Pin10 PWM 31250Hz pinMode(M1, OUTPUT);
pinMode(E1, OUTPUT);
pinMode(M2, OUTPUT);
pinMode(E2, OUTPUT);
void loop(){
v=100; //mm per second
w=0; //deg per second
w=w*(phi/180);
thetaDotL = (1/(2*phi*r))*(v-(w*d/2));
thetaDotR = (1/(2*phi*r))*(v+(w*d/2));
/ PID 1 Calculation
PV1 = rps1;
error1 = setPoint1 - PV1;
Sum1 = Sum1 + error1;
outPID1 = Kp1*error1 + Ki1*Sum1*dt + ((Kd1/dt)*(error1 -
error1_1));
if (outPID1 > maxPID1) { outPID1 = maxPID1;}
if (outPID1 < minPID1) { outPID1 = minPID1;}
error1_1 = error1;
/ PID 2 Calculation
PV2 = rps2;
error2 = setPoint2 - PV2;
Sum2 = Sum2 + error2;
outPID2 = Kp2*error2 + Ki2*Sum2*dt + ((Kd2/dt)*(error2 –
error2_1));
if (outPID2 > maxPID2) { outPID2 = maxPID2;}
if (outPID2 < minPID2) { outPID2 = minPID2;}
error2_1 = error2;
x1=abs(outPID1);
x2=abs(outPID2); y1=(21.26*x1*x1*x1*x1*x1)-
(92.68*x1*x1*x1*x1)+(151.1*x1*x1*x1)-
(102.5*x1*x1)+(49.68*x1)+5.047; y2=(21.26*x2*x2*x2*x2*x2)-
(92.68*x2*x2*x2*x2)+(151.1*x2*x2*x2)-
(102.5*x2*x2)+(49.68*x2)+5.047;
void readEncoder1()
{
n = digitalRead(encoder1PhaseA);
if (n == HIGH) {
if (digitalRead(encoder1PhaseB) == LOW) {
encoder1Position--;
pulse1--;
} else {
void readEncoder2()
{
m = digitalRead(encoder2PhaseA);
if (m == HIGH) {
if (digitalRead(encoder2PhaseB) == LOW) {
encoder2Position--;
pulse2--;
} else {
encoder2Position++;
pulse2++;
}
}
}