Omni-directional Robot SArduino Training 2018 cho THPT Saigon Institute of Technology Biên soạn: IT SaigonTech - 2018
Introduction to OMNI wheel Besides the ability to rotate perpendicularly to motor shaft (Hình 1a), it can rotate in the direction of motor shaft (Hình 1b). See wheel picture below: Hình 1a Hình 1b
Omni-directional Robot Robot does not have to care about the heading (Demonstrating video) Common build: (Video)
Type of Omni Robot Omni Robot: Typically Omni robot include 3 wheels or 4 wheels. Pros and cons of each design are dicussed below: Omni 3 wheels Omni 4 wheels - Pro: Better friction and balance on the flat surface. Cheaper because omni wheel is expensive. Simple calculation. Using the motor efficiently. - Cons: Motors not being used efficiently due to 120 degree arrangement. Complicated calculation. - Nhược: Expensive. Hard to ensure the balance
Dynamic demonstration for 3 wheels Omni Robot Dynamic equations Direction + We determine the wheel direction as below: -Positive if clockwise -Negative if counter-clockwise Robot will have 2 main movement: Linear V and rotate 𝜔. Because we want robot not to rotate -> 𝜔 = 0. Consider V includes: 𝑉 𝑥 và 𝑉 𝑦 . Mirror those 2 component on each wheel direction: V1 direction: V2 direction: V3 direction: Dynamic equation: Direction - 𝑉 1 = −𝑉 𝑥 cos 30° − 𝑉 𝑦 𝑠𝑖𝑛 30° (1) 𝑉 2 = 𝑉 𝑥 cos 30° − 𝑉 𝑦 𝑠𝑖𝑛 30° (2) 𝑉 3 = 𝑉 𝑦 (3) Dynamic demonstration for 3 wheels Omni Robot
Dynamic demonstration for 3 wheels Omni Robot Dynamic equations (cont) Replac value of sin(30°) và cos(30°) into (1), (2), (3) we have: 𝑉 1 = − 3 2 𝑉 𝑥 + − 1 2 𝑉 𝑦 𝑉 2 = 3 2 𝑉 𝑥 + − 1 2 𝑉 𝑦 …(4) 𝑉 3 = 𝑉 𝑦 Dynamic demonstration for 3 wheels Omni Robot
Dynamic equations (cont) Calculate the speed ratio: y + V 𝑉 𝑦 90 ° - Wheel Direction Robot angle direction 𝛼 Motor 1 𝑉 𝑥 O x + -We decide the positive angle will be anti-clockwise. 0 degree will be on Ox like picture above. (Note that this direction is different from the wheel rotate direction that is mentioned earlier) When robot moving in direction V (angle 𝛼) we have: 𝑉 𝑥 =cos(𝛼) . V 𝑉 𝑦 =sin(𝛼) . V 180 ° 0 ° Motor 3 Motor 2 …(5) 270 °
Dynamic equations (cont) In order to calculate the Motors ratio, we ignore V in (5), we have the motors ratio for every specific angle: Example: 1-For robot to move 𝛼 = 90°. We need the motors ratios as following: 2-For robot to move 𝛼 =225°. We need the motors ratios as following: 𝑉 1 = − 3 2 𝑉 𝑥 + − 1 2 𝑉 𝑦 𝑉 1 =− 3 2 𝑐𝑜𝑠(𝛼)− 1 2 𝑠𝑖𝑛(𝛼) 𝑉 2 = 3 2 𝑉 𝑥 + − 1 2 𝑉 𝑦 𝑉 2 = 3 2 𝑐𝑜𝑠(𝛼)− 1 2 𝑠𝑖𝑛(𝛼) …(6) 𝑉 3 = 𝑉 𝑦 𝑉 3 =𝑠𝑖𝑛(𝛼) 𝑉 𝑥 =𝑐𝑜𝑠(𝛼) ∗𝑁𝑜𝑡𝑒 𝛼 𝑖𝑛 𝑑𝑒𝑔𝑟𝑒𝑒 𝑉 𝑦 =𝑠𝑖𝑛(𝛼) 𝑉 1 =−0.87𝑐𝑜𝑠(90) −0.5𝑠𝑖𝑛(90) = -0.5 𝑉 2 =0.87𝑐𝑜𝑠(90) −0.5𝑠𝑖𝑛(90) = -0.5 𝑉 3 =𝑠𝑖𝑛(90) = 1 𝑉 1 =−0.87𝑐𝑜𝑠(225) − 0.5𝑠𝑖𝑛(225) = 0.62 + 0.35 = 0.97 𝑉 2 =0.87𝑐𝑜𝑠(225) − 0.5𝑠𝑖𝑛(225) = − 0.62 + 0.35 = −0.27 𝑉 3 =𝑠𝑖𝑛(225) = −0.70
Pascal uses STArduino, STTODRobot; const IN1=22; IN2=23; EN1=5; procedure setup; begin pinMode(IN1,OUTPUT); pinMode(IN2,OUTPUT); pinMode(EN1,OUTPUT); pinMode(IN3,OUTPUT); pinMode(IN4,OUTPUT); pinMode(EN2,OUTPUT); pinMode(IN5,OUTPUT); pinMode(IN6,OUTPUT); pinMode(EN3,OUTPUT); {Khoi tao} todRobotInitialize(IN1, IN2, EN1, IN3, IN4, EN2, IN5, IN6, EN3); end;
Pascal procedure loop; begin {Let robot rotate clockwise, if not, need to adjust the wheel direction before using the library} todRobotRotate(true, 100); delay (1000); todRobotStop; {Move angle 60, PWM 100} todRobotMove(60, 100); delay(5000); {Move angle -60, PWM 100} todRobotMove(-60, 100); end; setup; loop; end.
C/C++ #include <STTODRobot.h> STTODRobot myOmni = STTODRobot(); int IN1 = 22; int IN2 = 23; int EN1 = 5; int IN3 = 24; int IN4 = 25; int EN2 = 6; int IN5 = 26; int IN6 = 27; int EN3 = 7; void setup() { //Initialize Omni myOmni.init(IN1, IN2, EN1, IN3, IN4, EN2, IN5, IN6, EN3); pinMode (IN1, OUTPUT); pinMode (IN2, OUTPUT); pinMode (IN3, OUTPUT); pinMode (IN4, OUTPUT); pinMode (IN5, OUTPUT); pinMode (IN6, OUTPUT); pinMode (EN1, OUTPUT); pinMode (EN2, OUTPUT); pinMode (EN3, OUTPUT); //Rotate Omni: true (clockwise), false (anti- clockwise) myOmni.rotate_omni(true, 200); delay (1000); myOmni.stop_omni(); } void loop() { //Move omni follow angle myOmni.move_omni(90, 200); Library: http://srobot.saigontech.edu.vn/wp-content/uploads/2017/11/STTODRobot.zip Note: angle from 0-360 degree only
Exercise: At 12V, Motor using 100% power: Write a program for robot to move as below, each direction in 2 second. Using 70% power of motors only. 180 ° 90 ° y 270 ° x O 0 °