The default configuration performed by the MDK install script can be modified, if required. Instructions for doing so are on this page.
Some of the settings below are stored in
~/.miro2/config/user_setup.bash. This file is also used on-board the robot, and contains various settings relevant only to that environment—you can safely ignore comments and settings that are not described on this page.
Add symbolic link
During install, a link is placed at
~/mdk pointing to the MDK directory (in our example installation, to
~/mdk-190211). You may safely delete—or move—this link if you prefer.
If you do so, you must ensure that the correct path to the MDK is used whenever
~/mdk is used. You should check the remaining items on this page, and also replace
~/mdk wherever it is used in the documentation with the correct path to your MDK installation.
~/mdk—at least to begin with—since you can then copy-and-paste code directly from the documentation into your terminal.
A command is placed at the bottom of your
~/.bashrc to initialise the MDK (by sourcing
Some users will prefer to remove this automatic initialisation command from their
~/.bashrc. In that case, source
setup.bash manually in your terminal before each use of the MDK.
~/mdk, as described in the previous step, you must update the command in
The value listed beside "Network address" when
setup.bash runs should be the network address of your system. A correct network address is required if the MDK is to be able to communicate with the robot or with the simulator.
If the indicated network address is not correct, or if you wish to change how that address is determined, this section describes the procedure.
ifconfig—to handle this situation, read on.
Most machines have only one network address—aka "IP address"—and it is this that the MDK must determine. Usually, then, this will be performed correctly by the default scripts.
Three approaches can be used to determine the network address: "dynamic", "static", and "loopback". Which technique is used is controlled by the value of
MIRO_NETWORK_MODE. This value is set in
user_setup.bash, which is stored at
~/.miro2/config/user_setup.bash, and you can change it if required.
The network address determination is performed by the function
setup.bash should not be changed, but you can follow it through if you need to debug network address determination.
The default configuration is to use "dynamic" determination mode, which is described below.
MIRO_NETWORK_MODE is set to "dynamic" (the default setting), the network address is determined dynamically when
setup.bash is run using the function
In the default implementation of the function (in
setup.bash), the first qualifying IPv4 address listed by
ifconfig is taken. If your system has more than one IPv4 address, and the first is not the one you intend to use, either provide your own implementation of
user_setup.bash) or use one of the static address determination modes
miro_get_dynamic_address(), uncomment the version in
user_setup.bash and modify it to correctly recover the network address dynamically. Note that an uncommented function in
user_setup.bash automatically overrides the one defined in
The custom function should set the network address into
MIRO_DYNAMIC_IP and then exit.
Here is an example function that returns the address of the network adapter with a specified name
Constraining accepted dynamic address
In some conditions, your network interface may self-assign a bogus IP address (often of the form
169.x.x.x) for a moment before it is assigned a valid IP address by DHCP. At boot, the system waits for a valid IP address and then uses it to start the network services (including the ROS master), and by default any address is allowed. If network services are started with a bogus address, they will not work correctly (ROS master will be unreachable) after DHCP has assigned a real address. See the related FAQ: Why can I not reach the on-board ROS master?
There are two ways to solve this problem. The first, if appropriate, is to switch to "static" for Network address mode, and specify the address in advance. If you can't do this (because you want to use DHCP), you can alternatively restrict the set of valid IP addresses that the robot will accept at boot time by modifying the setting
user_setup.bash. For example, to allow only addresses that take the form
192.x.x.x, use the setting below.
MIRO_DYNAMIC_IP_MATCHwas introduced at R190407—if the variable is not present in your
user_setup.bash, add it manually using the template at
If your network address is fixed, you can set
MIRO_NETWORK_MODE to "static" and
MIRO_STATIC_IP to the network address. For example:
If you do not need the network—for instance, you intend to use only the simulator—you can also use the "loopback" mode, which is equivalent to "static" mode with the network address set to
If you are having configuration problems with the MDK, run
miro_info and check over the environment variables to see if anything is awry. A typical output is shown below.