EasyManua.ls Logo

Dobot AiStarter - 6.5.2 Procedure; 6.5.3 Code Description

Dobot AiStarter
41 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
AiStarter User Guide 6AI-Starter Demo
IssueV1.0.32018-09-01 AiStarter User Guide Copyright © Yuejiang Technology Co., Ltd
21
int speedOffset;
//pid
errorsum += error;
if (errorsum > errorsumLimit) {
errorsum = errorsumLimit;
}
else if (errorsum < -errorsumLimit){
errorsum = -errorsumLimit;
}
errorChange = error - lastError;
speedOffset = kp * error + ki * errorsum + kd * errorChange;
lastError = error;
//calculate the wheel speed
speedLeftWheel = baseSpeed + speedOffset;
speedRightWheel = baseSpeed - speedOffset;
AIStarter_SmartBotSetMotor(MOTORL, speedLeftWheel);
AIStarter_SmartBotSetMotor(MOTORR, speedRightWheel);
Serial.println("go ahead");
}
6.2 Obstacle Avoiding Demo
6.2.1 Description
This demo realizes that AI_Starter avoids obstacle automatically.
6.2.2 Procedure
Step 1 The motors stop running after turning on AI-Starter.
Step 2 Press down the key start|stop, AI-Starter starts avoiding obstacle.
Step 3 AI-Starter moves back for a certain distance after detecting obstacle, and turn left
or right according to the ultrasonic sensors.
Step 4 Press down the key start|stop once agian, AI-Starter stops tracking line after the
buzzer beeps one time.
6.2.3 Code Description
1) Initialize AI-Starter.

Table of Contents

Related product manuals