You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

If you select this option in the Setup Tab of the LCC, the behaviour of the whole deployment fundamentally changes. Your software is no longer deployed locally, on your device, but on the NUCs (HLCs) which are used in the Lab. Your system must be set up similarly to the main Lab PC for this option to actually work. 

Requirements

Use the main PC

The main Lab PC (IP: 192.168.1.249) must be running (with an Apache Server), ideally before the NUCs are turned on.

Setting up the NUCs correctly

The NUCs need to be set up properly. They also need to have an automatically starting task running, which looks for new versions of the required files. This crontab task relies on lab_autostart.bash. 

Info on lab_autostart.bash

This file can also be found in the software repository (./high_level_controller/autostart). It is the only file that currently is not automatically updated on the NUC. Thus, if you change it, you need to re-upload it on the devices for the guest user. The path is described here.

The script is responsible for setting up the environment on the NUCs (e.g. downloading current versions of the cpm library, middleware etc.) so that programs can be deployed on the machines similarly to local deployment.

Provide all required packages

You need to do this before turning the NUCs on.

The middleware, cpm library and autostart software must be built - the build script puts data required for the software to work on the NUCs in folders that allow the NUCs to download it from the Apache Server (/var/www/html/nuc).

Within the folder for the autostart software (located in ~/dev/software/high_level_controller/autostart), you also find the script create_nuc_package.bash. Call this script as well do create the final part of the NUC package (for matlab scripts).

Check again if all four scripts can be found within var/www/html/nuc and if they are up to date. Only then you should start the NUCs.

The HLCs use a startup script that takes the cpm library, Middleware etc. from an Apache server located on the Lab's main PC. The according files are updated every single time that these components are built. If you changed them during the lab run / if they are missing, please rebuild them and restart the NUCs/HLCs, so that they get the new software.

This decision was made to reduce upload traffic when files are uploaded to the HLCs during a lab run.

Make sure that all your files are uploaded correctly

Your folder structure must match the recommended folder structure (usage of ~/dev/...) for both the cpm library and the software repository. If your script/program relies on this data, then you should always refer to other programs using paths relative from ~ (so do not use /home/username explicitly). Cpm library and middleware can be found in the same folders on the NUCs. Required environment variables, e.g. for DDS, are set by default, so you do not need to take care of that.

All required data must lie in the same folder as your executable or script. The whole folder containing it gets uploaded to each NUC. If you depend on other data (except for the Middleware or cpm library, which are uploaded separately), put it in that folder, or your program might not work correctly. 

WARNING: Relative script paths are currently not supported. Also, please do not enter folders that may contain a lot of data (e.g. "./"), because all that data is then uploaded to all NUCs (which, although it gets deleted after they are restarted, might not be a good idea)

If you use Matlab then you need to use the init script.  It does work for you that you would else need to implement for every single of your own scripts: Load required data (e.g. XML configuration files), setup the reader and writer etc. Alternatively, use a script that is inspired by the init script. QOS_LOCAL_COMMUNICATION.xml is always located in ~/dev/software/middleware/build, and precompiled DDS IDL Matlab files can always be found in ~/dev/software/cpm_lib/dds_idl_matlab. Other files cannot be expected to be found on the NUC, unless you put them in the same folder as your own script.

Matlab example of using the init-script:

clc
script_directoy = fileparts([mfilename('fullpath') '.m']);
cd(script_directoy)

% Initialize data readers/writers...
init_script_path = fullfile('../', '/init_script.m');
assert(isfile(init_script_path), 'Missing file "%s".', init_script_path);
addpath(fileparts(init_script_path));
[matlabParticipant, stateReader, trajectoryWriter, systemTriggerReader, readyStatusWriter, trigger_stop] = init_script(matlabDomainID);
cd(script_directoy)

General information

Mapping of vehicle IDs

Vehicle IDs are matched to available NUC IPs in an ascending order (IP ...211 → ID 1, IP ...215 → ID 4), depending on the vehicle IDs you have selected.

You cannot simulate more vehicles remotely than NUCs are available - each NUC is always responsible for one vehilce only. Any further vehicle is simulated on your local device.

Using IDL-Datatypes and the cpm library

The location of the cpm library is always set using LD_LIBRARY_PATH in the local terminal - you do not need to take care of this in your program, as long as you have linked the library properly in your build script.

Integrated error checking

IDL-Datatype for error checking

The following data type is used to check for NUC-crashes.

struct HLCHello {
    string source_id; //To find out where the msg came from and to not answer to own msg

    boolean script_running; //If true, a Matlab / C++ session is still running
    boolean middleware_running; //If true, a Middleware session is still running
};

Explanation:

Online-indicators for NUCs

The UI indicates how many NUCs are online. The UI shows you how many NUCs are currently online (matching might take up to a minute after the NUCs have been booted and your program has started.) 

If the entry stays empty, you need to check what went wrong. Potential errors are:

  • You are using the wrong domain ID (DDS) for the LCC. If LCC and NUCs are not within the same DDS domain, they cannot discover each other. Please check which ID you need to use.
  • Packages are missing on the NUCs. In this case, upload packages are missing on the main PC or the NUCs have not been set up correctly (e.g. the autostart task, see requirements)
  • The NUCs or your PC are not connected to the same network
  • You are not using the main Lab PC (which is recommended for remote deployment)
  • The NUCs crashed

Crash checks for your programs

As soon as you actually deploy your programs, and after the scripts have been uploaded, the LCC also starts checking if their corresponding tmux sessions (middleware and script) are still running. Errors are reported in the UI if that it not the case anymore (e.g. with a popup).

  • No labels