Files
M. Anthony Aiello 04b71a337d Feature/create run example (#40)
* Intermediate progress

* Update run-example

Delaying while OpenAMASE opens appears to be important. It takes a while for OpenAMASE to actually open, and the user is supposed to click on the run button before OpenUxAS instances start. The five seconds offered by some examples is insufficient, and may not be guaranteed in any case.

We make the delay configurable, so that the user can remove or adjust it, as needed.

We also make sure that we kill off forked subprocesses and report if we're unable to do so.

* Rename the Ada Waterway Search example

Suggesting this naming convention so that we can create other examples that use the Ada UxAS more easily.

* Add two additional configs

Configs for Examples 03 and 05

* Update config for example 03

This should work out of the box on modern Linux.

* Add config-driven delay after OpenAMASE starts

This is important for the Ada example, although it may be related to the way in which we implemented it.

* Enhance run-example

- Fix error when OpenAMASE does not run
- Handle Ctrl-C gracefully (shut down all subprocesses)
- Allow a relative or absolute path to the example to be specified - this is nice, because then tab-complete works

* Add missing example configs

Also make sure that each ends with a newline (nice for `cat`).

* Use Test_SimulationTime service to sync with AMASE

Removes the need for any timeout to start UxAS instances.

* Fix example 05_AssignTasks

Adding the Test_SimulationTime service + a longer timeout on task assignment allows the example to run correctly.
2020-05-14 13:49:06 -04:00
..
2020-05-14 13:49:06 -04:00

Hello World Example

This is a basic example of a UxAS service that sends/receives KeyValuePair messages and prints out the results.

Files:

*runUxAS_HelloWorld.py* - This is a python script used to execute the example

*runUxAS_HelloWorld_Docker.py* - This is a python script used to execute the example using Docker

*runUxAS_HelloWorld.sh* - This is a bash shell script used to execute the example (deprecated)

*cfg_HelloWorld.xml* - This is the file used to configure the example for UxAS

*01_HelloWorld.cpp* - the C++ source code for the example. Note: this file is located in the following directory:
    src/Services/

*01_HelloWorld.h* - the C++ header file for the example. Note: this file is located in the following directory:
    src/Services/

Running the Example:

  1. open a terminal window in the directory: "examples/01_HelloWorld/"
  2. enter the command: ./runUxAS_HelloWorld.sh

What Happens?

Two copies of the HelloWorld service start up and begin sending messages. One copy sends a message once a second and the other sends a message every 5 seconds. Each service receives the messsages sent by the other service. When messages are received the services print them out.

Things to Try:

  1. Change the rate that messages are sent out. This is done by editing the cfg_HelloWorld.xml file and changing the value of SendPeriod_ms. Note: the time is entered in milliseconds, i.e. 1000 milliseconds == 1 second.
  2. Change the message sent by each of the services. This is done by editing the cfg_HelloWorld.xml file and changing the value of StringToSend.