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

Compare with Current View Page History

« Previous Version 5 Next »

Shared or common functionality for the communication via DDS is bundled in the cpm library (cpm_lib). This library is written in C++ and is used by the vehicle. The HLC, on the other hand, is supposed to be more or less independent from the implementation language of the library. Programmers of the HLC programs should also not be troubled with its implementation details. Thus, it was decided to create a Middleware which performs most of the communication tasks that otherwise would have to be implemented in some form in the HLC.

The Middleware coordinates the communication with the DDS domain of the vehicle, LCC and further participants with the HLC. It is responsible for sending timed pre-aggregated vehicle information to the HLC which can be interpreted as a start signal for starting the computation using this data, and it sends the commands generated by the HLC as a reaction to this start signal to the vehicles. Any timing task is performed by the Middleware, so period and offset for the interaction with the HLC are set here (and can be set when starting the application using command line parameters).  The HLC is informed about the current time, in case that is necessary for its own computations.

The application also manages further internal timing according to the current simulated and real time, propagating the LLC's start and stop signals and waiting for the HLC to finish its computation in the simulated case. It is also responsible for logging communication or timing errors regarding the HLC.

The HLC only needs to integrate and configure a reader and a writer to listen to the vehicle and send commands. Thus, as long as the programming language is supported by RTI DDS, the programmer does not need to know the implementation details of the communication.

Command Line Parameters

Parameter Usage Example

./middleware --vehicle_ids=1,7,8 --node_id=middleware --wait_for_start=true --dds_domain=1 --simulated_time=false

Important parameters

  • node_id: Identification string of the middleware instance in the DDS network
  • period_nanoseconds: Length of each period in which the HLC is triggered, in nanoseconds
  • simulated_time: True if the current setup uses simulated time, else false
  • wait_for_start: Whether the middleware should wait for the LCC's start signal, should be true (false only for debugging purposes)
  • vehicle_ids: IDs of the vehicles the HLC(s) that the middleware 'controls' are responsible for (usually just one ID)
  • dds_domain: Domain ID of the domain in which the LCC, vehicle etc. participate
  • domain_number: Local domain ID of the middleware and the HLC
  • dds_initial_peer: Should be explained in Lab Control Center - Usage (TODO)

Other parameters

  • offset_nanoseconds: Set the offset of the communication w.r.t. ~1970 (TODO, real time) or 0 (simulated time); should usually not be changed
  • use_param_server: Irrelevant parameter, false is default (true currently not required, would break the middleware)
  • log_topic: Topic name of the logging topic (logs that are collected by the LCC)
  • hlc_state_topic: Topic name of the vehicle state list topic for the vehicle information sent to the HLC
  • vehicle_state_topic: Topic name of the vehicle states sent by the vehicles
  • hlc_trajectory_topic: Topic name of the trajectory commands sent by the HLC
  • vehicle_trajectory_topic: Topic name of the trajectory commands sent to the vehicles
  • hlc_speed_curvature_topic: Topic name of the speed curvature commands sent by the HLC
  • vehicle_speed_curvature_topic: Topic name of the speed curvature commands sent to the vehicles
  • hlc_direct_topic: Topic name of the direct control commands sent by the HLC
  • vehicle_direct_topic: Topic name of the direct control commands sent to the vehicles

Scripts

Different scripts have already been written to test and deploy the middleware together with all necessary libraries and a matlab program on the local or other machines. These scripts can be found in ./Middleware/remote and ./Middleware/local.

Bash Scripts for Deployment on Other Machines

Basic usage

  • Open the folder deploy
  • Call the deploy script by typing bash deploy.bash [ip address] [vehicle id] [id of the terminal windows started remotely] [id of the middleware in the DDS network] [id of the DDS domain of the vehicles and LCC] [boolean value: simulated time]. If the password set in pw.txt matches the password on the machine on which you want to deploy the Middleware (and use other scripts), then this command should suffice to start the software on another machine.
  • WARNING: Always use Ctrl + C to stop the script. Otherwise, the processes on the other machine are not killed.

Editing the HLC Script

Currently, the content of the Matlab folder is uploaded to the HLCs. Any Matlab script contained in this folder can be used as a HLC script. To call a hlc script, simply change the last line of matlab_start.bash

/home/controller/Documents/Matlab/bin/matlab -nodisplay -nosplash -logfile matlab.log -nodesktop -r "cd '/home/controller/Documents/Remote/Matlab/'; dummy_line_speedCurvature(${vehicleID})"

to

/home/controller/Documents/Matlab/bin/matlab -nodisplay -nosplash -logfile matlab.log -nodesktop -r "cd '/home/controller/Documents/Remote/Matlab/'; name_of_your_script(${vehicleID})"

Debugging


If the middleware or HLC script for some reason do not work - that is, if the vehicle does not do anything up to 60 seconds after the scripts were started - possible error messages do not appear in the console window where bash deploy.bash ... was called.


You can use


sshpass -p password ssh controller@ip_address

(replace password and ip_address) to remotely access the HLC. Then, type ls. Your should see two files (and some other files): middleware.txt and matlab.log. Using cat, you can print the content of these files in the console. They contain the output of the consoles that were started remotely on the HLC to start the Middleware and the Matlab script and may contain error messages that can help you with debugging e.g. your script.


TODO: More info here?

Communication between HLC and Middleware

TODO: Mention IDL type / what it does / what the middleware expects, refer to Matlab tutorial


  • No labels