{"id":791,"date":"2026-06-12T15:21:20","date_gmt":"2026-06-12T07:21:20","guid":{"rendered":"https:\/\/projectleon.net\/make\/blog\/differential-drive-ugv-kinematics-odometry-arduino-farsi\/"},"modified":"2026-06-12T15:21:20","modified_gmt":"2026-06-12T07:21:20","slug":"differential-drive-ugv-kinematics-odometry-arduino-farsi","status":"publish","type":"post","link":"https:\/\/projectleon.net\/make\/blog\/differential-drive-ugv-kinematics-odometry-arduino-farsi\/","title":{"rendered":"Differential Drive UGV: \u0641\u0631\u0645\u0648\u0644\u200c\u0647\u0627\u06cc \u062d\u0631\u06a9\u062a\u060c Odometry \u0648 \u06a9\u062f \u0622\u0631\u062f\u0648\u06cc\u0646\u0648 (\u0641\u0627\u0631\u0633\u06cc)"},"content":{"rendered":"<div class='hero-image-container' style='margin-bottom:28px;border-radius:14px;overflow:hidden;box-shadow:0 4px 18px rgba(0,0,0,0.08)'>\n<img src='https:\/\/projectleon.net\/make\/wp-content\/uploads\/2026\/06\/post153-differential-drive-kinematics.jpg' alt='Differential Drive \u0633\u06cc\u0646\u0645\u0627\u062a\u06cc\u06a9 Odometry \u0622\u0631\u062f\u0648\u06cc\u0646\u0648' style='width:100%;height:auto;display:block' loading='eager'\/>\n<\/div>\n<div class='beginner-intro' style='background:#f0f7ff;border-right:4px solid #2e5fb6;padding:16px 20px;border-radius:10px;margin-bottom:22px'>\n<h2 style='margin-top:0'>\u0633\u06cc\u0646\u0645\u0627\u062a\u06cc\u06a9 Differential Drive \u2014 \u0631\u06cc\u0627\u0636\u06cc\u0627\u062a \u0633\u0627\u062f\u0647<\/h2>\n<p>\u062f\u0631 Differential Drive \u062f\u0648 \u0686\u0631\u062e \u0645\u0648\u0627\u0632\u06cc \u0628\u0627 \u0633\u0631\u0639\u062a \u0645\u0633\u062a\u0642\u0644 \u0648\u062c\u0648\u062f \u062f\u0627\u0631\u062f. \u0627\u06af\u0631 \u0633\u0631\u0639\u062a \u0686\u0631\u062e \u0686\u067e = vL \u0648 \u0631\u0627\u0633\u062a = vR \u0628\u0627\u0634\u062f:<br \/>\n<strong>\u0633\u0631\u0639\u062a \u062e\u0637\u06cc (v)<\/strong> = (vL + vR) \/ 2<br \/>\n<strong>\u0633\u0631\u0639\u062a \u0632\u0627\u0648\u06cc\u0647\u200c\u0627\u06cc (\u03c9)<\/strong> = (vR &#8211; vL) \/ L  (L = \u0641\u0627\u0635\u0644\u0647 \u0628\u06cc\u0646 \u062f\u0648 \u0686\u0631\u062e)<br \/>\n\u0628\u0627 \u0627\u06cc\u0646 \u062f\u0648 \u0645\u0642\u062f\u0627\u0631 \u0645\u06cc\u200c\u062a\u0648\u0627\u0646\u06cc\u0645 \u0645\u0648\u0642\u0639\u06cc\u062a x, y \u0648 \u062c\u0647\u062a \u03b8 \u0631\u0627 \u062f\u0631 \u0647\u0631 \u0644\u062d\u0638\u0647 \u0645\u062d\u0627\u0633\u0628\u0647 \u06a9\u0646\u06cc\u0645.<\/p>\n<\/div>\n<p><svg viewBox='0 0 860 180' width='100%' xmlns='http:\/\/www.w3.org\/2000\/svg' style='background:#fff;border:1px solid #ddd;border-radius:12px;margin-bottom:18px'>\n<text x='430' y='18' text-anchor='middle' font-size='12' font-family='Tahoma' fill='#333'>\u0645\u062f\u0644 \u0633\u06cc\u0646\u0645\u0627\u062a\u06cc\u06a9 Differential Drive<\/text>\n<rect x='330' y='40' width='200' height='110' rx='8' fill='#e3f2fd' stroke='#1565c0' stroke-width='2'\/>\n<text x='430' y='90' text-anchor='middle' font-size='11' font-family='Tahoma' fill='#0d47a1'>\u0631\u0628\u0627\u062a (Robot Body)<\/text>\n<text x='430' y='107' text-anchor='middle' font-size='10' font-family='Tahoma' fill='#333'>\u0645\u0631\u06a9\u0632 \u062f\u0631 \u0646\u0642\u0637\u0647 (x, y, \u03b8)<\/text>\n<rect x='285' y='55' width='40' height='80' rx='4' fill='#ffd54f' stroke='#f57f17' stroke-width='2'\/>\n<text x='305' y='95' text-anchor='middle' font-size='9' font-family='Tahoma' fill='#333'>vL<\/text>\n<rect x='535' y='55' width='40' height='80' rx='4' fill='#ffd54f' stroke='#f57f17' stroke-width='2'\/>\n<text x='555' y='95' text-anchor='middle' font-size='9' font-family='Tahoma' fill='#333'>vR<\/text>\n<line x1='305' y1='40' x2='305' y2='25' stroke='#2196f3' stroke-width='2' marker-end='url(#arr)'\/>\n<line x1='555' y1='40' x2='555' y2='25' stroke='#2196f3' stroke-width='2'\/>\n<line x1='305' y1='95' x2='535' y2='95' stroke='#ff9800' stroke-width='1.5' stroke-dasharray='5,3'\/>\n<text x='430' y='90' text-anchor='middle' font-size='9' font-family='Tahoma' fill='#e65100'> L = \u06f2\u06f0\u06f0mm<\/text>\n<text x='130' y='95' text-anchor='middle' font-size='10' font-family='Tahoma' fill='#333'>v = (vL+vR)\/2<\/text>\n<text x='130' y='112' text-anchor='middle' font-size='10' font-family='Tahoma' fill='#333'>\u03c9 = (vR-vL)\/L<\/text>\n<text x='700' y='90' text-anchor='middle' font-size='10' font-family='Tahoma' fill='#333'>\u0394x = v\u00b7cos(\u03b8)\u00b7\u0394t<\/text>\n<text x='700' y='107' text-anchor='middle' font-size='10' font-family='Tahoma' fill='#333'>\u0394y = v\u00b7sin(\u03b8)\u00b7\u0394t<\/text>\n<text x='700' y='124' text-anchor='middle' font-size='10' font-family='Tahoma' fill='#333'>\u0394\u03b8 = \u03c9\u00b7\u0394t<\/text>\n<\/svg><\/p>\n<h2>\u06a9\u062f Odometry \u0628\u0627 Encoder<\/h2>\n<pre style='background:#1e1e1e;color:#d4d4d4;padding:14px;border-radius:8px;font-size:12px;margin-bottom:18px'><code>\/\/ Encoder \u067e\u0648\u0644\u0633\u200c\u0634\u0645\u0627\u0631 \u2014 \u0647\u0631 \u0645\u0648\u062a\u0648\u0631 \u06cc\u06a9 encoder \u06f2\u06f0PPR\nvolatile long encL=0, encR=0;\nvoid isrL(){ encL++; }\nvoid isrR(){ encR++; }\n\nconst float WHEEL_D    = 65.0;   \/\/ mm \u0642\u0637\u0631 \u0686\u0631\u062e\nconst float WHEEL_BASE = 200.0;  \/\/ mm \u0641\u0627\u0635\u0644\u0647\nconst int   PPR        = 20;     \/\/ \u067e\u0627\u0644\u0633 \u062f\u0631 \u0647\u0631 \u062f\u0648\u0631\n\nfloat posX=0, posY=0, theta=0;   \/\/ mm, mm, radians\n\nvoid updateOdometry(long dL_pulses, long dR_pulses){\n  float dL = (dL_pulses\/(float)PPR)*PI*WHEEL_D;\n  float dR = (dR_pulses\/(float)PPR)*PI*WHEEL_D;\n  float v   = (dL+dR)\/2.0;\n  float dTh = (dR-dL)\/WHEEL_BASE;\n  posX  += v*cos(theta+dTh\/2.0);\n  posY  += v*sin(theta+dTh\/2.0);\n  theta += dTh;\n}\n\nvoid setup(){\n  attachInterrupt(digitalPinToInterrupt(2), isrL, RISING);\n  attachInterrupt(digitalPinToInterrupt(3), isrR, RISING);\n}\n\nvoid loop(){\n  long snapshotL = encL; encL=0;\n  long snapshotR = encR; encR=0;\n  updateOdometry(snapshotL, snapshotR);\n  Serial.print(\"X:\"); Serial.print(posX,1);\n  Serial.print(\" Y:\"); Serial.print(posY,1);\n  Serial.print(\" \u03b8:\"); Serial.println(theta*57.3,1);\n  delay(50);\n}<\/code><\/pre>\n<div style='display:grid;grid-template-columns:repeat(auto-fit,minmax(300px,1fr));gap:18px;margin:20px 0'>\n<iframe width='100%' height='280' src='https:\/\/www.youtube.com\/embed\/aE7RQNhwnPQ' title='Robot Odometry Arduino Encoder Tutorial' frameborder='0' allowfullscreen><\/iframe><br \/>\n<iframe width='100%' height='280' src='https:\/\/www.youtube.com\/embed\/nzHxGMVhM8A' title='Differential Drive Robot Math' frameborder='0' allowfullscreen><\/iframe>\n<\/div>\n<ul>\n<li><a href='https:\/\/www.cs.columbia.edu\/~allen\/F17\/NOTES\/icckinematics.pdf' target='_blank'>Columbia: \u0631\u0627\u0647\u0646\u0645\u0627\u06cc \u0631\u06cc\u0627\u0636\u06cc \u0633\u06cc\u0646\u0645\u0627\u062a\u06cc\u06a9 \u0686\u0631\u062e\u200c\u0645\u062d\u0648\u0631<\/a><\/li>\n<li><a href='https:\/\/www.aparat.com\/result\/%D8%B1%D8%A8%D8%A7%D8%AA+%D8%A7%D9%86%DA%A9%D9%88%D8%AF%D8%B1' target='_blank'>\u0622\u067e\u0627\u0631\u0627\u062a: encoder \u0631\u0628\u0627\u062a \u0622\u0631\u062f\u0648\u06cc\u0646\u0648<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u062f\u0631\u06a9 \u06a9\u0627\u0645\u0644 \u0633\u06cc\u0646\u0645\u0627\u062a\u06cc\u06a9 Differential Drive: \u0641\u0631\u0645\u0648\u0644\u200c\u0647\u0627\u06cc \u0633\u0631\u0639\u062a \u062e\u0637\u06cc \u0648 \u0632\u0627\u0648\u06cc\u0647\u200c\u0627\u06cc\u060c \u0645\u062d\u0627\u0633\u0628\u0647 Odometry \u0628\u0627 encoder\u060c \u062a\u0628\u062f\u06cc\u0644 \u062f\u0633\u062a\u0648\u0631 \u062c\u0648\u06cc\u200c\u0627\u0633\u062a\u06cc\u06a9 \u0628\u0647 \u0633\u0631\u0639\u062a \u0686\u0631\u062e\u200c\u0647\u0627 \u0648 \u06a9\u062f \u06a9\u0627\u0645\u0644 \u0622\u0631\u062f\u0648\u06cc\u0646\u0648.<\/p>\n","protected":false},"author":1,"featured_media":790,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"pagelayer_contact_templates":[],"_pagelayer_content":"","footnotes":""},"categories":[19,16],"tags":[563,577,576,571,48,21,578],"class_list":["post-791","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials-2","category-ugv","tag-differential-drive","tag-encoder","tag-kinematics","tag-odometry","tag-ugv","tag-arduino","tag-578"],"_links":{"self":[{"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/posts\/791","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/comments?post=791"}],"version-history":[{"count":1,"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/posts\/791\/revisions"}],"predecessor-version":[{"id":792,"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/posts\/791\/revisions\/792"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/media\/790"}],"wp:attachment":[{"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/media?parent=791"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/categories?post=791"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/projectleon.net\/make\/wp-json\/wp\/v2\/tags?post=791"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}