You are on page 1of 1

Get errors

Start Start Start

Analog readings from


sensors Initialize parameters Initialize parameters Initialize parameters
(Vr, Wr) (Kp, Ki, Kd, Ts) (Kp, Ki, Kd, Ts)

Yes
At end point ?
Start button pressed?No Start signal from No Start signal from No
Master ? Master ?
No
Yes Yes Yes
Calibrating the sensors
values Set end_flag = 1 Write start signal to Receive desired Receive desired
Slaves motor speed from Master motor speed from Master

Compute e2 using
Weighted Average Calculate current Calculate current
Get errors motor speed motor speed

Compute e3
Yes Set PWM duty cycle using Set PWM duty cycle using
end_flag = 1? PID algorithm PID algorithm
Return to Main Program
No
End signal from No End signal from No
Sub-program of Master Apply Fuzzy law Write end signal Master ? Master ?
to Slaves
Yes Yes
Compute V, W and End End
Start send to Slaves End

Stop button pressed? No


Main program of Slave 1 Main program of Slave 2
Main program of Master (Left motor) (Right motor)
Yes

Reset Master V: desired robot's velocity (m/s)


W: desired robot's angular velocity (rad/s)
Write end signal
to Slaves
Vref: reference velocity (m/s) LINE FOLLOWING ROBOT
Wref: reference angular velocity (rad/s) Function Full name Signature Date Quantity Mass Scale
Design Ng. Truong Huy

End
e2, e3: tracking errors (m) Ng. Ng. Duy Hung
H. Phi Hung
Flowchart diagram 1
Sheet: 1
1:1
Number of sheets: 1
Kp, Ki, Kd: PID controller gains
Instruct Assoc. Prof Ng.Qu.Chi
Ts: sampling time of PID controller HCMC University of Technology
Interrupt program for Emergency Stop Censor Faculty of Mechanical Engineering

You might also like