Hi! I am WallRider. I am a guardian robot and my task is report any potential dangers or intruders to the command center. My mission for today is to patrol a special part of The Great Wall of China. This part is off limits to tourists for security reasons. Have you ever visited The Great Wall? It is huge, and it has an enormous length, making it difficult for humans to patrol. Luckily I am here to help. I have a unique design suitable for the environment including powerful electric motors. I don’t have a map of The Great Wall, but luckily I am equipped with useful sensors. I have sensors located to the right, left and front of my chassis which tell me how far I am from the walls. But I don’t have an algorithm to use these sensors and make decisions to drive around. Perhaps you can help me get set up properly?
Today we will learn about feedback. This is an important topic for robotic systems. A robot can react to changes in its environment by using different types of sensors. For example, a robot can sense its distance to a surrounding wall by using an ultrasonic distance sensor and react for different situations:
The robot takes measurements with the sensors and then makes decisions. This changes the next measurements and the robot makes new decisions. This is called a feedback loop.
There are many methods to write feedback control algorithms. However some techniques are common and used as building blocks for more complex algorithms. Part of the fun of feedback algorithms is to tune your algorithm so the robot has intelligent behavior. If you learn how to write a control algorithm for one robot, then you can develop similar algorithms for other types of robots and applications.
We will also introduce the concept of continuous-time commands with WallRider. Before we had discrete robotic commands such as “move 1 meter forward” or “rotate 90 degrees clockwise”. Continuous-time commands tell the robot how fast to move or how fast to turn. So we can set the speed as 1 meter per second, instead of saying move exactly 1 meter forward.
Checkpoint #1 – Moving the robot for the first time
while robot.is_ok():
robot.move(1.0)
Checkpoint #2 – Rotating the robot
Checkpoint #3 – First feedback algorithm
while robot.is_ok():
delta = robot.front_right_sensor() – robot.front_left_sensor()
set_point = 0
error = set_point – delta
gain = 1
command = error * gain
robot.move(1.0)
robot.rotate(command)
We also created something called gain. For now we set this to 1.0. But we can change this number to make the robot respond faster or slower. What would happen if we made this 0? What would happen if you made this too big? You can try this.
Checkpoint #4 – Try speeding things up
Checkpoint #5 – Make the robot smarter
slow_down = abs(command)
It is time for a little challenge! Who can finish the stage in the shortest time? Our goal is clear, we will crush the gas pedal! Let’s see who can be the fastest on the track. We have the timer in the metrics section which you can share. Ready? 3-2-1 and start!