RSVP: Robot Scenario Visual Planning
- Mapping the Scenario
- Pseudocode and Flowcharting RSVP
- Statecharts for Robots and Objects
Robot Sensitivity Training Lesson #3: Don’t instruct the robot to perform a task you can’t picture it performing.
As described in Chapter 2, “Robot Vocabularies,” the robot vocabulary is the language you use to assign a robot tasks for a specific situation or scenario. And once a vocabulary has been established, figuring out the instructions for the robot to execute using that vocabulary is the next step.
Making a picture or a “visual representation” of the scenario and instructions you want the robot to perform can be great way to ensure your robot performs the tasks properly. A picture of the instructions the robot will perform allows you to think through the steps before translating them to the code. Visuals can help you understand the process, and studying that visual can improve its development by seeing what has to be done and elucidating that which may otherwise pose a problem. We call this the RSVP (Robot Scenario Visual Planning). The RSVP is a visual that helps develop the plan of instructions for what the robot will do. The RSVP is composed of three types of visuals:
A floorplan of the physical environment of the scenario
A statechart of the robot and object’s states
Flowcharts of the instructions for the tasks
These visuals ensure that you have a “clear picture” of what has to be done to program a robot to do great feats that can save the world or light the candles on a cake. RSVP can be used in any combination. Flowcharts may be more useful than statecharts for some. For others, statecharts are best. All we suggest is that a floorplan or layout is needed whether statecharts or flowcharts are utilized.
The saying “a picture is worth a thousand words” means that a single image can convey the meaning of a complex idea as well as a large amount of descriptive text. We grew up with this notion while in grade school especially when trying to solve word problems; “draw a picture” of the main ideas of the word problem and magically it becomes clear how to solve it. That notion still works. In this case, drawing a picture of the environment, a statechart, and flowcharts will be worth not only a thousand words but a thousand commands. Developing an RSVP allows you to plan your robot navigation through your scenario and work out the steps of the instructions for the tasks in the various situations. This avoids the trials and errors of directly writing code.
Mapping the Scenario
The first part of the RSVP is a map of the scenario. A map is a symbolic representation of the environment where the tasks and situations will take place. The environment for the scenario is the world in which the robots operate. Figure 3.1 shows the classic Test Pad for NXT Mindstorms robot.
Figure 3.1 A robot world for NXT Mindstorms Test Pad
A Test Pad like the one shown in Figure 3.1 is part of the Mindstorms robot kits. This Test Pad is approximately 24 inches wide, 30 inches long, and has a rectangular shape. There are 16 colors on the Test Pad and 38 unique numbers with some duplicates. There is a series of straight lines and arcs on the pad. Yellow, blue, red, and green squares are on the Test Pad along with other colored shapes in various areas on the pad. It is the robot’s world or environment used for the initial testing of NXT Mindstorms robots’ color sensors, motors, and so on.
Like the Test Pad, a floorplan shows the locations of objects that are to be recognized like colored squares, objects the robot will interact with, or obstacles to be avoided. If objects are too high or too far away, sensors may not be able to determine their location. Determining the path the robot must navigate to reach those locations can also be planned by using this map.
The dimension of the space and of the robot (the robot footprint) may affect the capability of the robot to navigate the space and perform its tasks. For example, for our BR-1 robot, what is the location of the cake relative to the location of the robot? Is there a path? Are there obstacles? Can the robot move around the space? This is what the map helps determine.
Creating a Floorplan
The map can be a simple 2D layout or floorplan of the environment using geometric shapes, icons, or colors to represent objects or robots. For a simple map of this kind, depicting an accurate scale is not that important, but objects and spaces should have some type of relative scale.
Use straight lines to delineate the area. Decide the measurement system. Be sure the measurement system is consistent with the API functions. Use arrows and the measurements to mark the dimensions of the area, objects, and robot footprint. It’s best to use a vector graphics editor to create the map. For our maps we use Libre Office Draw. Figure 3.2 shows a simple layout of a floorplan of the robot environment for BR-1.
Figure 3.2 A layout of the floorplan for the BR-1 robot environment
In Figure 3.2, the objects of interest are designated: locations of the robot, the table, and the cake on the table. The floorplan marks the dimensions of the area and the footprint of the robot. The lower-left corner is marked (0,0) and the upper-right corner is marked (300,400). This shows the dimensions of the area in cm. It also marks distances between objects and BR-1. Although this floorplan is not to scale, lengths and widths have a relative relationship. BR-1’s footprint length is 50 cm and width is 30 cm.
BR-1 is to light the candles on the cake. The cake is located at the center of an area that is 400 cm × 300 cm. The cake has a diameter of 30 cm on a table that is 100 cm × 100 cm. That means the robot arm of BR-1 should have a reach of at least 53 cm from the edge of the table to reach the candle at the farthest point in the X dimension.
The maximum extension of the robot arm to the tip of the end-effector is 80 cm, and the length of the lighter adds an additional 10 cm. The task also depends on some additional considerations:
The height of the candle
The height of the cake
The length of BR-1 from the arm point to the top of the candle wick
The location of the robot
Figure 3.3 shows how to calculate the required reach to light the candle. In this case, it is the hypotenuse of a right triangle. Leg “a” of the triangle is the height of the robot from the top of the wick to the robot arm joint which is 76 cm, and leg “b” is the radius of the table plus the 3 cm to the location of the farthest candle on the cake, which is 53 cm.
Figure 3.3 Calculating the length of the robot arm as the hypotenuse of a right triangle
So the required reach of the robot arm, end-effector, and lighter is around 93 cm. But the robot’s reach is only 90 cm. So BR-1 will have to lean a little toward the cake or get a lighter that is 3 cm longer to light the wick.
The Robot’s World
For the robot to be automated it requires details about its environment. Consider this: If you are traveling to a new city you know nothing about, how well will you be able to do the things you want to do? You do not know where anything is. You need a map or someone to show you around and tell you “here is a restaurant” and “here is a museum.” A robot that is fully automated must have sufficient information about the environment. The more information the robot has, the more likely the robot can accomplish its goal.
All environments are not alike. We know environments are dynamic. The robot’s environments can be partially or fully accessible to a robot. A fully accessible environment means all objects and aspects of the environment are within the reach of the robot’s sensors. No object is too high, low, or far away from the robot to detect or interact with. The robot has all the necessary sensors to receive input from the environment. If there is a sound, the robot can detect it with its sound sensor. If a light is on, the robot can detect it with its light sensor.
A partially accessible environment means there are aspects of the environment the robot cannot detect or there are objects the robot cannot detect or interact with because it lacks the end-effector to pick it up or the location sensor to detect it. An object that is 180 cm from the ground is out of the reach of the robot with a 80 cm arm extension and a height of 50 cm. What if BR-1 is to light the candles once the singing begins and it does not have a sound sensor? Sound is part of the environment; therefore, it will not be able to perform the task. So when creating the floorplan for a partially accessible environment, consider the “robot’s perspective.” For example, for objects that are not accessible by the robot, use some visual indicator to distinguish those for the objects the robot can access. Use color or even draw a broken line around it.
Deterministic and Nondeterministic Environments
What about control? Does the robot control every aspect of its environment? Is the robot the only force that controls or manipulates the objects in its environment? This is the difference between a deterministic and nondeterministic environment.
With a deterministic environment, the next state is completely determined by the current state and the actions performed by the robot(s). This means if the BR-1 robot lights the candles, they will stay lit until BR-1 blows them out. If BR-1 removes the dishes from the table, they will stay in the location they’re placed.
With a nondeterministic environment, like the one for the birthday party scenario, BR-1 does not blow out the candles. (It would be pretty mean if it did.) Dishes can be moved around by the attendees of the party, not just BR-1. What if there are no obstacles between BR-1 and its destination and then a partygoer places an obstacle there? How can BR-1 perform its tasks in a dynamic nondeterministic environment?
Each environment type has its own set of challenges. With a dynamic nondeterministic environment, the robot is required to consider the previous state and the current state before a task is attempted and then make a decision whether the task can be performed.
Table 3.1 lists some of the types of environments with a brief description.
Table 3.1 Some Types of Environments with a Brief Description
Environment Type |
Description |
Fully accessible |
All aspects of the environment are accessible through the robot’s sensors, actuators, and end-effectors. |
Partially accessible |
Some objects are not accessible or cannot be sensed by the robot. |
Deterministic |
The next state of the environment is completely determined by the current state and actions performed by the robot. |
Nondeterministic |
The next state of the environment is not completely under the control of the robot; the object may be influenced by outside factors or external agents. |
RSVP READ SET
Many aspects of the environment are not part of the layout or floorplan but should be recorded somehow to be referenced when developing the instructions for the tasks. For example, the color, weight, height, and even surface type of the objects are all detectable characteristics that are identified by sensors or affect motors and end-effectors as well as the environment type, identified outside forces, and their impact on objects.
Some of these characteristics can be represented in the floorplan. But a READ set can contain all the characteristics. Each type of environment should have its own READ set.
For example, color is a detectable characteristic identified by a color or light sensor. The object’s weight determines whether the robot can lift, hold, or carry the object to another location based on the torque of the servos. The shape, height, and even the surface determine whether the object can be manipulated by the end-effector.
Any characteristic of the environment is part of the READ set, such as dimensions, lighting, and terrain. These characteristics can affect how well sensors and motors work. The lighting of the environment, whether sunlight, ambient room light, or candle light, affects the color and light sensor differently. A robot traveling across a wooden floor is different from the robot traveling across gravel, dirt, or carpet. Surfaces affect wheel rotation and distance calculations.
Table 3.2 is the READ set for the Mindstorms NXT Test Pad.
Table 3.2 READ Set for the Mindstorms NXT Test Pad
Object: Physical Work Space |
|
Attribute |
Value |
Environment type |
Deterministic, fully accessible |
Width |
24 inches |
Length |
30 inches |
Height |
0 |
Shape |
Rectangular |
Surface |
Paper (smooth) |
Object: Color (Light) |
|
Attribute |
Value |
Num of colors |
16 |
Light intensities |
16 |
Colors |
Red, green, blue, yellow, orange, white, black, gray, green, light blue, silver, etc. |
Object: Symbols |
|
Attribute |
Value |
Symbol |
Integers |
Integer values |
0–30, 90, 120, 180, 270, 360, 40, 60, 70 |
Geometric |
Lines, arcs, squares |
The READ set for the Test Pad describes the workspace including its type (fully accessible and deterministic), all the colors, and symbols. It describes what will be encountered by a robot when performing a search, such as identifying the blue square. The sets list the attributes and values of the physical workspace, colors, and symbols on the Test Pad.
For a dynamic environment such as our birthday party scenario, the READ set can contain information pertaining to the outside forces that might interact with the objects. For example, there are initial locations for the dishes and cups on the table, but the partygoers may move their dishes and cups to a new location on the table. The new locations should be represented in the READ set along with the time or the condition this occurred. Once the party is over and BR-1 is to remove those dishes and cup, each location should be updated. Table 3.3 is the READ set for the birthday party for the BR-1.
Table 3.3 READ Set for the Birthday Party Scenario
Object: Physical Work Space |
||||
Attribute |
Value |
Force |
Time/Condition |
New Value |
Environment type |
Nondeterministic partially |
|
|
|
Width |
300 cm |
|
|
|
Length |
400 cm |
|
|
|
Height |
0 |
|
|
|
Shape |
Rectangular |
|
|
|
Surface |
Paper (smooth) |
|
|
|
Lighting |
Artificial |
|
|
|
Object: Cake |
||||
Attribute |
Value |
Force |
Time/Condition |
New Value |
Height |
14 cm |
|
|
|
Diameter |
30 cm |
|
|
|
Location |
150, 200 |
External |
N/A |
|
Placement |
Table |
External |
N/A |
|
Related objects |
Candles |
|
|
|
Object: Candles |
||||
Attribute |
Value |
Force |
Time/Condition |
New Value |
Height |
4 cm |
|
|
|
Number of candles |
3 |
|
|
|
Locations |
1 153, 200 2 150, 200 3 147, 200 |
External |
N/A |
|
Condition 1 |
Unlit |
BR-1 |
Singing starts |
Lit |
Condition 2 |
Lit |
External |
Singing ends |
Unlit |
Object: Dishes |
||||
Attribute |
Value |
Force |
Time/Condition |
New Value |
Diameter |
20 cm |
|
|
|
Height |
1 cm |
|
|
|
Number of dishes |
4 |
|
|
|
Locations |
1 110, 215 2 110, 180 3 170, 215 4 170, 180 |
External |
After party ends |
All at 110, 215 (stacked) Height 2 cm |
Object: Cups |
||||
Attribute |
Value |
Force |
Time/Condition |
New Value |
Diameter |
5 cm |
|
|
|
Height |
10 cm |
|
|
|
Number of dishes |
4 |
|
|
|
Locations |
1 119, 218 2 105, 189 3 165, 224 4 163, 185 |
External |
After party ends |
All at 119, 218 (stacked) Height 14 cm |
This READ set has three additional columns:
Force
Time/Condition
New Value
Force is the source of the iteration with the object; this force is anything working in the environment that is not the robot. The Time/Condition denotes when or under what condition the force interacts with the object. The New Value is self-explanatory.