Create a new system project from an existing one that already uses the flexible navigation stack. Then use the newly created map in our new system project.
Level | Beginner |
---|---|
Role | System builder, but also other roles like experienced users |
Assumptions | Having completed the tutorial Map a New Environment by Driving Around with a Joystick or via Keyboard |
System Requirements | Virtual Machine Image Installed, see ready-to-go virtual machine |
You will learn | - how to use a new map in a system project. |
Options | - SystemWebotsRobotino3Navigation - SystemWebotsP3dxNavigation (any system using the flexible navigation stack) |
In the tutorial Map a New Environment by Driving Around with a Joystick or via Keyboard, we generated a map of the environment. In the tutorial Symbolic Names for Rooms - How to Update the Knowledge Base, we updated the behavior project for navigation by specifying symbolic names for places in the environment and storing them in a knowledge base.
In this tutorial, you learn how to use our newly created map with the flexible navigation stack. We create a new system project from an existing one that already uses the flexible navigation stack. Then we use the newly created map in our new system project.
Open the System Builder view and check that the project you want to copy is in the workspace. In this tutorial, we create a new system project by copying the already existing SystemWebotsRobotino3Navigation
.
Select project → right click → Xito Utils → Copy and Rename Project.
Enter the new system project name, i.e SystemWebotsRobotino3NavigationNew
, uncheck Use default location and click Browse to specify the project location. Navigate to the location $SMART_ROOT_ACE/repos/SystemRepository
and select open. Check the project name and location and then select copy.
Now the new project SystemWebotsRobotino3NavigationNew
is created and you can see it in the workspace.
The system parameters in the file «project name».systemParam
specify the initial configuration of the components. In this tutorial, our system project is named SystemWebotsRobotino3NavigationNew
and thus, the file with the system parameters is named SystemWebotsRobotino3NavigationNew.systemParam
.
In our system project in this tutorial, we use the Webots simulator and we need to tell Webots which world to use. As we will use the map created in tutorial Map a New Environment by Driving Around with a Joystick or via Keyboard, we need to use that world here again. Otherwise, obviously, the map would not match the world. Thus, as shown below, we update in the file SystemWebotsRobotino3NavigationNew.systemParam
the parameter WorldPath
to $SMART_ROOT_ACE/repos/DataRepository/webots/worlds/RobotinoHome.wbt
.
Since SystemWebotsRobotino3NavigationNew and SystemWebotsRobotino3Navigation use the same flexible navigation stack, we don't have to modify the other models in the system project (i.e. Component Architecture, Deployment, Target, etc.).
We use the map generated in Map a New Environment by Driving Around with a Joystick or via Keyboard (i.e. laserMap.pgm
, laserMap.yaml
).
Data used by components of a system project is placed in the project folder SystemProjectName/smartsoft/src/
. Each component has it own data folder, e.g. SmartAmcl uses the data folder SmartAmcl_data
.
We first delete the old maps which we do not use anymore in this system project:
SmartAmcl_data
: localizaion-map.pgm, localization-map.yamlSmartMapperGridMap_data
: navigation-map.pgm, navigation-map.yamlYou can delete them either via the file explorer or via a terminal with below commands:
We now need to copy the maps into the corresponding folders:
laserMap.pgm
into the folder SmartAmcl_data
and rename it to localization-map.pgm
laserMap.yaml
into the folder SmartAmcl_data
and rename it to localization-map.yaml
Now open the file localization-map.yaml
and change the name of the image in line 3 from laserMap-pgm
to localization-map.pgm
. The file localization-map.yaml
now looks as shown below:
laserMap.pgm
into the folder SmartMapperGridMap_data
and rename it to navigation-map.pgm
laserMap.yaml
into the folder SmartMapperGridMap_data
and rename it to navigation-map.yaml
Now open the file navigation-map.yaml
and change the name of the image in line 3 from laserMap-pgm
to navigation-map.pgm
. The file navigation-map.yaml
now looks as shown below:
Note: In most scenarios, the same map is used for both, the robot localization (i.e. localization-map.pgm
) and the robot path planning (i.e. navigation-map.pgm
). However, in some cases we want to block areas in the environment so that the robot does not enter them. In this case, the navigation-map.pgm
(used for path planning) is different from the localization-map.pgm
(used for localization). We modify the navigation-map.pgm
such that grid cells belonging to forbidden areas are changed from free to occupied.
The SmartCdlServer (motion execution) requires CDL-lookup files to calculate the motion commands to drive the robot towards intermediate waypoints as received from the path planner. CDL-lookup files are generated using the shape, the kinematics and the dynamics of the robot.
Since SystemWebotsRobotino3NavigationNew
and SystemWebotsRobotino3Navigation
use the same robot (a robotino robot), we don't have to update the cdl-lookup files.
However, this step is required at the moment due to a bug in the copying of the project.
Copying the system project has an effect on the CDL-lookup binary files. So we need to do the following steps:
$SMART_ROOT_ACE/repos/SystemRepository/SystemWebotsRobotino3NavigationNew/smartsoft/src/SmartCdlServer_data/data/lookup-files
$SMART_ROOT_ACE/repos/SystemRepository/SystemWebotsRobotino3NavigationNew/smartsoft/src/SmartCdlServer_data/data/lookup-files
to $SMART_ROOT_ACE/repos/SystemRepository/SystemWebotsRobotino3NavigationNew/smartsoft/src/SmartCdlServer_data/data/lookup-files
Note that if we want to use another robot such as a Pioneer3DX, Tiago, etc., we must use the corresponding CDL-lookup files and we need to update the names of the CDL-lookup files in the SmartCdlServer
parameters in the corresponding *.systemParameters
file.
Now all the changes required in a system project for running the flexible navigation stack in a new environment are done. Now we can deploy and execute the system. The following section describes how to deploy and execute the system. These steps are the same for all the system projects and you have seen them already in the previous tutorials.
Step 1: Right click on project → Run Code-Generation. This step is required if there is any change in models of the project (i.e. any file inside the model folder). In this tutorial, we modified the system parameters and thus, we need to do this step to generate updated configuration files (i.e *.ini files). You can look at the generated configuration files in the folders smartsoft/src-gen/params
and smartsoft/src-gen/combined-ini-files
.
Verify that there are no errors during the code generation by looking at the console terminal:
Step 2: We now deploy the system by clicking the Deployment Action from the right-click menu of the project:
It depends on your configuration whether you are asked for credentials of the configured login account. Finally, you see the following pop-up window which tells you that the deployment was successful:
Step 3: You can now start your system by clicking Yes. A terminal window will open and show the scenario control menu. Choose menu-start to start the scenario. Further terminals open automatically (one for each component and one additional window for the naming service). Note that they may not be visible initially in case they overlap. Choose menu-stop to stop the scenario.
Step 4: Wait until the webots simulator is up and all the components started and are running. Look for the terminal window which contains the ComponentTCLSequencer.
In the menu, select 5 - Approach location and enter one of the offered names for locations.
Now, the robot navigates to this destination and stops there.
Now you can proceed with tutorial «to be added»