public class BaseController extends GamsJNI
| Constructor and Description |
|---|
BaseController(BaseController input)
Copy constructor
|
BaseController(ai.madara.knowledge.KnowledgeBase knowledge)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAlgorithmFactory(String name,
AlgorithmFactory factory)
Adds a named algorithm factory to the controller, which allows for usage
of the named factory in swarm.command and device.*.command
|
long |
analyze()
Analyzes the platform, algorithm and accents
|
long |
execute()
Executes the algorithm and accents
|
protected void |
finalize()
Cleans up underlying C resources
|
void |
free()
Deletes the C instantiation.
|
static BaseController |
fromPointer(long cptr,
boolean shouldManage)
Creates a java object instance from a C/C++ pointer
|
void |
initAccent(String name,
ai.madara.knowledge.KnowledgeList args)
Initialize an accent within the controller
|
void |
initAlgorithm(BaseAlgorithm algorithm)
Initialize an algorithm within the controller
|
void |
initAlgorithm(String name,
ai.madara.knowledge.KnowledgeList args)
Initialize an algorithm within the controller
|
void |
initPlatform(BasePlatform platform)
Initialize a platform within the controller
|
void |
initPlatform(String name)
Initialize a platform within the controller
|
void |
initPlatform(String name,
ai.madara.knowledge.KnowledgeList args)
Initialize a platform within the controller
|
void |
initVars(BaseAlgorithm algorithm)
Initialize the variables for an algorithm.
|
void |
initVars(BasePlatform platform)
Initialize the variables for a platform.
|
void |
initVars(long id,
long processes)
Initialize the variables within the controller
|
long |
monitor()
Monitors the platform's sensors
|
long |
plan()
Plans the algorithm and accents
|
long |
run(double period,
double duration)
Runs the monitor, analyze, plan and execute loop with a
specific period and duration
|
long |
run(double loopPeriod,
double duration,
double sendPeriod)
Runs iterations of the MAPE loop with specified periods between loops
|
long |
runHz(double loopHz,
double duration,
double sendHz)
Runs iterations of the MAPE loop with specified hertz
|
long |
systemAnalyze()
Analyzes the controller and system
|
String |
toString()
Converts the value to a string
|
public BaseController(ai.madara.knowledge.KnowledgeBase knowledge)
throws GamsDeadObjectException
knowledge - knowledge base to useGamsDeadObjectExceptionpublic BaseController(BaseController input) throws GamsDeadObjectException
input - the instance to copyGamsDeadObjectExceptionpublic static BaseController fromPointer(long cptr, boolean shouldManage)
cptr - C pointer to the objectshouldManage - if true, manage the pointerpublic long analyze()
throws GamsDeadObjectException
GamsDeadObjectExceptionpublic long execute()
throws GamsDeadObjectException
GamsDeadObjectExceptionpublic void initAccent(String name, ai.madara.knowledge.KnowledgeList args) throws GamsDeadObjectException
name - name of the accentargs - arguments to the accent initializationGamsDeadObjectExceptionpublic void initAlgorithm(String name, ai.madara.knowledge.KnowledgeList args) throws GamsDeadObjectException
name - name of the algorithmargs - arguments to the algorithm initializationGamsDeadObjectExceptionpublic void addAlgorithmFactory(String name, AlgorithmFactory factory) throws GamsDeadObjectException
name - the string name to associate with the factoryfactory - the factory that creates the algorithmGamsDeadObjectExceptionpublic void initPlatform(String name) throws GamsDeadObjectException
name - name of the platformGamsDeadObjectExceptionpublic void initPlatform(String name, ai.madara.knowledge.KnowledgeList args) throws GamsDeadObjectException
name - name of the platformargs - arguments to the platform initializationGamsDeadObjectExceptionpublic void initAlgorithm(BaseAlgorithm algorithm) throws GamsDeadObjectException
algorithm - the algorithm to add to the controllerGamsDeadObjectExceptionpublic void initPlatform(BasePlatform platform) throws GamsDeadObjectException
platform - platform to add to the controllerGamsDeadObjectExceptionpublic void initVars(long id,
long processes)
throws GamsDeadObjectException
id - the id of this process within the swarmprocesses - the number of processes participating in the swarmGamsDeadObjectExceptionpublic void initVars(BasePlatform platform) throws GamsDeadObjectException
platform - the user-defined platformGamsDeadObjectExceptionpublic void initVars(BaseAlgorithm algorithm) throws GamsDeadObjectException
algorithm - the user-defined algorithmGamsDeadObjectExceptionpublic long monitor()
throws GamsDeadObjectException
GamsDeadObjectExceptionpublic long plan()
throws GamsDeadObjectException
GamsDeadObjectExceptionpublic long run(double period,
double duration)
throws GamsDeadObjectException
period - the time in between executions of the loop in secondsduration - the duration of the loop in secondsGamsDeadObjectExceptionpublic long run(double loopPeriod,
double duration,
double sendPeriod)
throws GamsDeadObjectException
loopPeriod - time in seconds between executions of the loop. 0
means run as fast as possible (no sleeps).duration - the duration of time spent running the loop in seconds.
Negative duration means run loop forever. 0 duration
means run once.sendPeriod - time in seconds between sending updates over network.
If sendPeriod is non-positive, loopPeriod is used.GamsDeadObjectExceptionpublic long runHz(double loopHz,
double duration,
double sendHz)
throws GamsDeadObjectException
loopHz - the intended hz at which the loop should execute.
anything non-negative is valid. 0hz is treated as
as infinite hertz (i.e., run as fast as possible).duration - the duration of time spent running the loop in seconds.
Negative duration means run loop forever. 0 duration means
run once.sendHz - the intended hz at which updates should be sent. If
non-positive, loopHz is used.GamsDeadObjectExceptionpublic long systemAnalyze()
throws GamsDeadObjectException
GamsDeadObjectExceptionpublic String toString()
public void free()
throws GamsDeadObjectException
GamsDeadObjectExceptionCopyright © 2018. All rights reserved.