Autoware.Auto
|
|
The LGSVL simulation always spawns the car at a particular location of the map that is different from the origin. The NDT localizer used in the Autoware.Auto stack requires an initial guess of the vehicle pose that is somewhere close to the truth. From this guess, NDT finds the best pose (i.e. localizes) in an interactive optimization. Once initialized, NDT uses the information of the previous time step to initialize and does not need further user input. It should localize as the car moves around.
The following error message is expected in the terminal in which the stack was started until the localization is successful:
[localization.p2d_ndt_localizer_node]: Could not find a connection between 'map' and 'base_link' because they are not part of the same tree.Tf has two or more unconnected trees.
There are two ways to send an initial guess of the vehicle pose to the system:
Option 1. is more flexible, as one can drive the car around in the simulation to any spot on the available map, and then choose to initialize the localization there.
Option 2. is easier to achieve reproducible results.
Initially RViz is centered on the origin of the map frame but the vehicle is spawned to a different location in the map, still unknown to RViz. Zoom in/out with the mouse wheel and pan the view with the middle-mouse button in RViz. Press F1
in the simulator window to see the camera controls. The following figure shows the vehicle at its spawning point and RViz zoomed out enough to display the origin of the map frame and the location of the vehicle. The origin of the map is indicated with a small white grid containing a white outline of the supposed (but incorrect) vehicle pose.
Check that in RViz, the map
fixed frame is selected. Make sure the map and TF visualizations are enabled and you have a good top-down view.
In RViz, click on 2D pose estimation
button and then click/drag on the position of the vehicle such that the arrow points in the same direction as the car and release the mouse button. A message with the pose estimate is then sent to NDT.
Here is what rviz
should look like when setting the initial pose:
A tf
visualization (the red-blue-green axes) should appear at that location and the Could not find a connection
error messages in the terminal should stop.
Here is what rviz
should look like after successful initialization, depending on which visualizations are enabled; the important ones are the colorful tf
crosses for odom
and base_link
whose marker scale has been increased for better visibility within RViz:
If the initial pose estimate was close, you should be able to drive around in the simulator and see the base_link
frame track the car's position
Note that the pose can be echoed and copied for later use with the second initialization method:
In order to initialize localization at the spawning point of the simulation as defined in SVL simulator, enter the following command in a new terminal: