Simulation Setup Tutorial 3: Navigation/Base Movement
This tutorial covers asking the robot to autonomously navigate within a map, and also manually moving the base incrementally.
This tutorial assumes you are already familiar with camera movement and its prerequisites.
The robot is able to autonomously navigate to specified poses, when given a map of the environment and an approximately-correct estimate of its current pose.
Tucking the Arms
Before asking the robot to navigate, it is crucial to tuck the arms so that they fit within the footprint of the robot. Failure to do so is likely to result in the robot hitting walls and other objects in the environment with any part of its arms that protrude out of the footprint.
To tuck the arms, you must first have RViz in the Interact mode. Right-click on either of the robot's upper arms to bring up the arm menu, then left-click on 'Tuck' and then on 'Tuck Both Arms', as shown in the following picture:
The robot should end up looking like this after its arms stop moving:
If it does not, try the command again, as the robot does sometimes get stuck.
When the robot has gotten to wherever you wanted it to navigate, you can use the same menu to untuck the arms so that they are free to manipulate objects, by clicking on 'Untuck Both Arms'.
Supplying a Pose Estimate
Before the robot can navigate on the map, it needs to know where it is currently. If you just started up the simulation, the robot happens to know where it is already, so this step is unnecessary (you can skip to the next sub-section). However, the real robot will need to be told where it is, so it is good to practice telling it.
In general, localizing the robot on the map takes two steps:
- supply a rough estimate; the robot will jump to that position
- look at the life robot laser scan data of the walls and refine the position until it aligns well with the map.
Before you start, you should activate the base laser display by checking the check-box next to "Base Laser (Laser Scan)" in the Displays pane, as shown below:
Once that is activated, you will see thin white lines representing the readings from the robot's base laser. On the map, light-grey areas represent known-free space, dark grey areas represent unknown/occluded space (usually behind walls), and black pixels represent known-occupied space, such as the surfaces of walls or the legs of tables. When the robot is well-localized (i.e., in the right place in the map), the white pixels (life laser data) should be nearly overlapping with the black pixels (walls in the map) when viewed from straight overhead, as shown below (ignore the arrows and the ring around the base for now; that will be explained in the section on manual base movement):
If the robot is not well-localized (not in the right place on the map), the base-laser scan will not match the map. In that case, you need to figure out where the robot is, and what direction it is facing, on the map representation. Once you have done so, click the '2D Pose Estimate' button in the top left of the rviz window. The next left-click you make on the map will specify the center of the base. Hold down the left-mouse-button and drag in the direction that the robot is facing to cause the green arrow to point in the robot-facing direction, as shown below:
The robot will jump to that pose on the map, and you can check the base-laser scan to see how well it matches, and re-localize the robot again if necessary. The scans do not need to match exactly, since once the robot starts moving it will be able to localize itself the rest of the way by itself, but if the pose is not approximately correct, the robot is likely to remain confused.
Sending a Navigation Goal
Once the robot is well-localized, you can ask to to navigate to a desired pose. You can send a navigation goal to the robot by clicking on the '2D Nav Goal' button in the top left of the rviz window. You select a navigation goal in the same way as specifying pose estimates, by left-clicking on a spot and dragging to specify the way the robot should face, such as the pose below that sends the robot (in front of the desk near the kitchen, facing the kitchen):
Once the robot has reached the goal successfully, you should see something like the following:
Stopping the Robot
You can stop the robot (cancel a navigation goal) at any time by clicking the 'Stop Navigation' button in the Interactive Manipulation window (between 'Cancel' and 'Arm'). Alternatively, if you click on the 'Interact' button while the robot is moving, a transparent sphere should appear around the robot while it is still trying to go to a navigation goal. The sphere will disappear when the robot thinks it has reached the goal; if you click on the sphere, the goal will be cancelled and the robot will stop.
If the robot does not reach a desired navigation goal, it either got stuck because of spurious/real obstacles seen by the base laser, or because it cannot actually get to that spot due to the desired padding around obstacles/the robot (that keep it from getting too close to obstacles). If the robot appears stuck but you know that it should be able to get through, cancelling the last goal and asking it to move again may allow the robot to get unstuck by itself.
Incremental/Manual Base Movement
In 'Interact' mode, you can turn on the base control arrows by clicking on the skirt of the robot base, shown below (the mouse cursor arrow is in an appropriate place to turn on base control):
Clicking on and holding the left mouse button down on one of the red/yellow arrows causes the robot to drive/rotate in the direction of that arrow (these are buttons, not click-and-drag like the gripper control arrows). When you stop holding the mouse button, the robot will stop; it will also automatically stop after a short distance if you keep holding the button down, to prevent serious disasters from dropped mouse-up signals.
When using these controls, it is VERY IMPORTANT to keep in mind that the robot is NOT doing any sort of obstacle avoidance. These controls are meant to allow you to drive the robot places where navigation will not take you due to being too close to obstacles, such as up to tables, or through narrow spots if autonomous navigation gets stuck. Be VERY careful when using this mode to look all around the robot with the cameras, to make sure that the robot is not hitting anything. The robot when driving can exert a great deal of force on furniture, walls, or objects, or run over peoples' feet or sleeping pets.