Suppose a dual channel motor driver is used to control speed of the 2 motors of the robot and polulu imu is used for yaw angle.
If the sensor senses an obstacle near by it gives 0 for no obstacle, +ve for obstacle in left and -ve for obstacle in right. Let obst be the value sensed by sensor. The refference value reff =0;
Let the base speed be base;
For moving forward:
Check the angle from imu set as reference. Let it be ref_angle
now, check the yaw from imu, let it be angle. yaw is +ve clockwise and -ve anticlockwise.
if the obst = 0;
error1 = angle - ref_angle;
PID1 = Kp1*error1 + Ki1*error1_sum+Kd*(last_error1-error1);
error1_sum+ = error1;
last_error1=error1;
Vl= base - PID;
Vr = base + PID;
This will make robot to move in straight line.
If the robot encounter an obstacle. It changes its speed based on distance from the obstacle.
error2 = abs(obst)-reff;
PID2 = Kp2*error2 + Ki2*error2_sum+Kd*(last_error2-error2);
error2_sum+ = error2;
last_error2=error2;
reset the base speed
base = base - PID;
and call the forward function.
For obstacle avoidance. Check the error as follows:
error3 = obst - reff.;
PID3 = Kp*error3 + Ki*error3_sum+Kd*(last_error3-error3);
error3_sum+ = error3;
last_error3=error3;
Vl = base + PID;
Vr = base - PID;
reset the reference angle as current yaw angle.
By using Arduino Uno Project Description: PID is used widely in many applications such as temperature control system...
write the whole code please by using Arduino Uno Project Description: PID is used widely in many applications such as temperature control systems, automotive industries, and robotics. In this project, you will implement multiple PID controllers on a zumo robot. The robot must move in a straight line without drifting and it must adjust its speed when it is approaching an obstacle or when an obstacle suddenly gets in its way. To achieve the above part, you will use two...
Project Description: PID is used widely in many applications such as temperature control systems, automotive industries, and robotics. In this project, you will implement multiple PID controllers on a zumo robot. The robot must move in a straight line without drifting and it must adjust its speed when it is approaching an obstacle or when an obstacle suddenly gets in its way. To achieve the above part, you will use two PID controllers; one for the straight-line movement and one...