Today
For Next Time
Closing the Perception Action Loop
So far you have had experience controlling the robot using user input. You may have also experimented with visualizing the data from the robot's sensors (for instance using image_view or rviz). Today we are going to start to close the loop. That is we will be using sensory information to inform our choice of motor commands. This is known as feedback control and is one of the most fundamental concepts in all of robotics (in addition to many other fields).
One use for feedback control is in trying to program a robot to achieve some goal. A simple case of this is a thermostat. What are the actions and what are the sensors (or perceptions) of such as system?
Let's create our first perception action loop using a strategy called proportional control. We will start by attempting to have the Neato maintain a fixed distance to the wall immediately in front of it. With the person sitting next to you draw a picture of the problem. What do we need to measure? How might we measure it using the sensors on the Neato? What is the "goal" of our controller? What actions (i.e. movements) will the Neato have to take in order to achieve our goal?
Next, as a group we will implement a strategy to achieve the goal set out above.
With the person sitting next to you, answer these questions:
Finite State Control
Next, we will look at combining multiple reactive behaviors together using a finite state machine.
One way that finite state machines can be used for robot control is to think of each state as a behavior the robot is executing and the transitions between states are caused by some condition the robot can sense in its environment.
A motivating example for using finite state machines to define robot controllers is this finite state diagram for the PR2 robot to recharge its batteries (source: http://wiki.ros.org/smach/Tutorials/Getting%20Started). The usage of finite state machines simplifies debugging / testing and gives us a nice way to visualize the controller.
With the person sitting next to you, think of another behavior we might combine with the wall distance regulator defined above. What would the conditions for transitioning between the states be (behaviors).
Time permitting, we will implement one of the ideas as a group.
I suggest on your own going through the smach tutorials on the ROS wiki. smach is a really nice state machine package for ROS that you can make use of in your projects. Note: the code for the smach tutorials is a bit hard to find, you should be able to find it here.