2.4 Making Your Robot Move
W A R N I N G...
Before running your robot under the control of the BeeSoft Commander, make sure you have prepared a safe, clear area in which your robot can move about. The area must be indoors, flat, dry, level, smooth, free of potential hazards such as cables across the floor and bulky floor mats, well away from small children, casual passerby and people who may not be paying attention. Your test area must be away from any stairwell, ramp or other hazard where your robot might tip over or fall. Be sure you know where your robots kill switch is.
Before starting any operations in which your robot actually moves around, you might want to set up an enclosed, protected area for it to navigate within. Surround a large, clear space in your lab with cardboard cartons or the like. Make sure they are at least as tall as the height of the robots sonars.
Before commanding your robot to move, make sure you have disconnected all cables, such as power charge cables, attached to the robot, and that the robot is free to move about. If the robot wanders off while "leashed" it could tear a cable or even tip itself over.
Remember: Keep yourself, your colleagues and your robot safe!
2.4.1 Running wander - A Simple Robot Demo
Are the servers still running? Remember, you can type the command bcheck at any time to check on which servers are currently running. If the servers are not running, restart them now by typing tcxServer and baseServer at the prompt.
Next, were going to start up wander, a simple demonstration program that sets your robot wandering around within a confined area. The program wander collects sonar, tactile and IR information into a list of obstacle points that it stores as world coordinates. Each time wander gets a motion control status update from baseServer, it scans the list of obstacles its seen for the one thats closest, and within a 180 degree arc directly in front of the robot. The program wander then calculates a translate velocity and rotate velocity to avoid that obstacle.
The first time you run wander, let it use its built-in defaults. Later, you can experiment by givingit different values on its command line. The program wander accepts the following arguments on its command line:
-safetyMargin=X : Try to go no closer than X cm to the closest obstacle
-exploreRange=X : Wander no further than X cm from the start point.
-transSpeed=X : Go no faster than X cm per second.
-transAccel=X : Accelerate and decelerate at X cm per second squared.
-rotSpeed=X : Rotate no faster than X degrees per second. (wander will convertthe degrees per second to radians per second.)
-rotAccel=X : Accelerate and decelerate the rotate axis at X degrees per second squared.
When you start up wander, include, if you like, any command line arguments from the above list. However, if youre running wander for the first time, we suggest you run it without any command line arguments. To start up wander, type the following. (Remember, if youve already done the make command for beeExamples, you dont need to do it again.)
Be sure to watch your robots progress closely, and be ready to intervene if it might be in danger of colliding with an obstacle that the sensors cannot detect. If you are concerned at any time that the robot might get itself into trouble, hit the kill switch immediately. Then, follow the directions in the box below to restart the robot. If youve prepared your test area properly, though, this should never happen.
To terminate the wander program, just type <CTRL-C>.
After an Emergency...Restarting after the "Kill Switch"...
After hitting the kill switch (either the single kill switch on the B14 or either of the two kill switches on the B21), you cannot restart your robot operations with software commands alone. You must do the following steps:
1. Stop all servers by typing: killall tcxServer
2. Reset the robot:
On a B21... a. Press the kill reset button, the top of two red buttons found on the base control panel, the panel set into the door with the yellow dot on top. b. Press the system reset button, the top red button on the base control panel.
On a B14...
Reset by pushing the base switch (the second toggle from the right on the top of the robot) forward again.
3. Restart the servers by typing:tcxServer followed by baseServer
2.4.2 colliServer -- The Collision Avoidance Package
Next, well start up colliServer, a robot motion management program that employs a protective strategy of guarded motion and oversees local navigation.
Are the servers still running? Remember, you can type the command bCheck at any time to check on which servers are currently running. If the servers are not running, restart them now by typing tcxServer and baseServer at the prompt.
To start the colliServer, type:
colliServer -noindex -fork=no
(The "noindex" argument simply keeps the robot from starting to move immediately. Without it, the robot would begin indexing -- that is, rotating about its axis to establish orientation between its upper enclosure and its base -- as soon as you typed colliServer. This could be somewhat startling.)
colliServer is the BeeSoft robot motion management software that operates automatically in guarded motion, or collision avoidance mode. Local navigation is the robots "sense as you go" mode of travel, in which it pays attention only to the latest few readings coming in from its sensors, rather than depending on any previous knowledge of the contours of its environment. When traveling in guarded motion, your robot -- rather than just charging blindly ahead - does its best to avoid collisions with any obstacles it can perceive.
A bit later, youll learn about robot motion controlled by baseServer, which does not have automatic collision avoidance.
W A R N I N G:
Both the CTR command, which youre about to use to move your robot, and the test program youll write after that, look at the readings from the robots sonar sensors only. Remember that on the B21 robot, the sonars are about 74 centimeters above the floor. (On the B14 theyre 50 centimeters above the floor.) The robot wont see, and therefore wont try to avoid, obstacles very much below sonar height. Again, scan your test area for potential hazards before proceeding.
Once youve ensured that the area is safe and clear, ask the robot to roll ahead one meter
(100 centimeters). Type:
CTR 100 0
In this CTR ("Control Translation and Rotation") command, the first argument - 100 - is the distance, in centimeters, you want it to move along its current heading: the heading towards which it is already pointed. A positive value in this argument sends the robot forward. The second argument - 0 - is the distance, again in centimeters, you want the robot to move perpendicular to its current heading.
Note that colliServer will attempt to move the robot to the point one meter directly ahead of itself, that is, one meter in the direction the robot is facing when you issue the CTR command. If that spot is blocked (occupied by an obstacle), the robot will continue maneuvering to try to reach that point. It might well, in fact, engage in some impressively complicated perambulations to try to reach that spot.
Next, tell your robot to return to where it started, that is, to back up one meter (100 centimeters). The minus sign just before the 100 tells your robot to roll backwards. Type:
CTR -100 0
Armed with knowledge of the CTR command, spend some time directing your robot around its environment. Try varying one or both parameters of the CTR command and observing the robots behavior.
Remember: The CTR command directs the robot to move relative to its current position (its center point or axis). The first argument represents the displacement, in centimeters, of the desired target point along the robots current heading; a positive value directs the robot forward, while a negative value causes the robot to turn on its axis until it is facing the area behind it, and, only then, move. The second argument represents the displacement, in centimeters, of the desired target point along the heading perpendicular to the robots current heading. A positive value represents a displacement to the robots left, a negative value represents a displacement to the robots right.
There is no substitute for developing an intuitive, hands-on feel for maneuvering your robot through space and observing the nuances of its behavior.
Note how your robot demonstrates its adaptability by attempting to circumvent obstacles as it tries to travel the distance you have requested. Try placing an obstacle (for example, yourself) in front of the robot and see what it does.
CAUTION: Before issuing commands to the robot, picture in your mind approximately where the robot will end up. Remember, 300 means 3 meters, or about three yards.
Try a few of the following command variations and observe what your robot does:
CTR 48 80
CTR 48 -80
CTR -161 14
CTR -300 0
After a while, youll begin to notice such phenomena as "drift," which accumulates as your robot moves continuously along a heading. Remember, unlike a pure, abstract software simulation, your robot is an electro-mechanical entity operating in the real world, subject to dirt, danger, gravity and other assorted laws of physics.
You can stop the colliServer at any time just by typing a period character (.) followed by enter. Stop colliServer and restart it as often as you like; the servers will still be running until youexplicitly terminate them by typing: