Skip to content

Gams Project Configurator

James Edmondson edited this page Jul 7, 2018 · 9 revisions

Introduction

Shortly before the release of version 1.0.0, a tool called the GAMS Project Configurator (GPC) was released into the master branch. The GPC is a dynamic code and project generation tool that helps developers generate new agent controllers and features like algorithms, platforms, transports, transport filters, and threads. In this wiki page, we will describe the major features of this powerful tool.


Table of Contents


Getting Help

As with most other GAMS tools, help can be obtained by passing a -h or --help option or an invalid option to the script. For example, the following command will generate help information.

$GAMS_ROOT/scripts/projects/gpc.pl --help

The Action Script

GPC generates an Action Script into a project directory to aid the developer with compiling and simulating controllers and distributed algorithms. The Action Script comes in two flavors: Linux .sh and Windows .bat. The Linux Action Script can be ran from any terminal. The Windows .bat must be ran inside of a Visual Studio Developer Command Prompt in order to use the compile or compile-vrep option.

Examples (Linux and Windows, .sh and .bat, respectively)

action.sh|.bat help                   # get help and usage information
action.sh|.bat compile-vrep           # compile the project to include V-REP support
action.sh|.bat compile                # compile the project, potentially without V-REP support
action.sh|.bat compile-vrep vrep sim  # compile the project for V-REP, launch vrep, and run the configured sim

Generating Sims

The GPC has dozens of options for generating, modifying, and running V-REP simulations. Configuring a simulation is one of the first target usages of GPC and the tool has many features to make interesting, realistic simulations.

By default, any project you create will have a simulation of one quadcopter in the center of a GPS region. For instance, the following actually generates the default one quadcopter simulation into the current directory:

$GAMS_ROOT/scripts/projects/gpc.pl

We can make this simulation more interesting by scaling the number of agents and giving them random locations in the current region.

$GAMS_ROOT/scripts/projects/gpc.pl --agents 10 --randomize

To run sims that you have configured, simply run the action script with vrep and sim

action.sh vrep sim  # linux
action.bat vrep sim # windows

The GPC help has good descriptions of these options, but the following list may help with configuring common simulation options (note the gpc.pl is located inside $GAMS_ROOT/scripts/projects):

gpc.pl --min-height 4 --unique          # give all agents unique heights starting at 4m
gpc.pl --group group.allies             # create a GAMS group called "group.allies" that contains all agents
gpc.pl --group group.allies --last 3    # create a GAMS group called "group.allies" that contains agent 0-3
gpc.pl --multicast "239.100.5.40:47000" # all agents should use a multicast transport for collaboration
gpc.pl --algorithm "debug"              # all agents should use the "debug" algorithm
gpc.pl --distributed --invert --rotate  # invert and rotate the formation, used in distributed formations
gpc.pl --platform "vrep-boat"           # use a boat platform in V-REP instead of the vrep-quad

Generating New Algorithms

To generate a new algorithm that agents can use in a simulation or real-world test, the --new-algorithm or --na option should be passed with the name of the algorithm. GPC will generate a new algorithm into the src/algorithms directory and create a new custom controller in the src directory. In addition to the new named algorithm, the GPC will also generate an algorithm factory that allows the custom algorithm to be called remotely, at run-time, by users through karl or any interaction with a MADARA KnowledgeBase that has the same network transport configuration.

$GAMS_ROOT/scripts/projects/gpc.pl --new-algorithm my_alg

The results of the call will be three files created:

src/algorithms/my_alg.h
src/algorithms/my_alg.cpp
src/controller.cpp

The my_alg.h|cpp files should then be edited to include the logic necessary for the developer's distributed application. After changes have been made, the new controller can be compiled with either the compile or compile-vrep options.

Clone this wiki locally