I'm going through Robotics past papers as a revision before the exam, and I found one problem which seems very confusing. My department does not provide answers to past papers, so I can't check if I'm right.
public class Question4i{
public static main(){
float d = 30;
float k = 1; //If it's equal to 1, why do we need it at all?
while(true){
error= GetSonarDepth() - d;
if(error>100) error=100;
setVelocity(k * error)
}
}
}
Then second part is where things are getting interesting:
This is my understanding:
- Robot and Hare are placed in the same position 0
- Robot starts reversing, while hare travels forward at constant velocity (error is negative)
- Robot fires a sonar
- Sonar reading tells the distance is 30 (error is 0)
- Robot stops (error is 0)
- Hare travels constant distance during this adjustment
- Robot fires sonar (error is positive)
- Robot increases its speed to setVelocity(error)
- Hare travels constant distance during this adjustment
- Robot changes its speed based on "old" sonar reading, as during the speed change, hare will travel further
- Therefore, robot will always be at least a little bit too far from desired distance
Also I came to a conclusion that if hare speed is higher than that of robot, distance will be constantly increasing. There will be NO STEADY STATE - where steady refers to kept distance.