Webots controller class.
This class can be used in a webots controller in conjunction with the webots dispatcher. It provides convenient functions to retrieve the task description the robot should evaluate. This class is a singleton and as such is easily accessible from anywhere within your controller application. Additionally, you can easily check on this object if your controller is running in optimization mode or not. Thus, you can write a single controller which can work both in and out of optimziation mode.
Namespace: Optimization.Dispatcher
Assembly: Optimization (in Optimization.dll)
See Also: Inherited members from Dispatcher.
⊟ Public Methods
staticInstance () : Webots Get the webots dispatcher interface singleton instance.Respond (Dictionary<string, double>) Send a response to the worker.Respond (double) Send a response to the worker.Respond (Optimization.Messages.Response.StatusType, Dictionary<string, double>) Send a response to the worker.Respond (Dictionary<string, double>, Dictionary<string, string>) Send a response to the worker.Respond (double, Dictionary<string, string>) Send response to the worker.Respond (Optimization.Messages.Response.StatusType, Dictionary<string, double>, Dictionary<string, string>) Send response to the worker.RespondFail () Send failure response to the worker.Response (Optimization.Messages.Response) Send a response to the worker.⊟ Protected Methods
overrideRequestStream () : System.IO.Stream Get the stream to read the request from. overrideRunTask () : bool Run task.
⊟ Instance Method
Get the webots dispatcher interface singleton instance.
public static Webots Instance ()⊟ Returns
The singleton instance.⊟ Remarks
Get the webots dispatcher interface singleton instance. You can use the implicit bool operator to check if you are actually in optimization mode or not.⊟ Requirements
Namespace: Optimization.Dispatcher
Assembly: Optimization (in Optimization.dll)
⊟ RequestStream Method
Get the stream to read the request from.
protected override System.IO.Stream RequestStream ()⊟ Returns
The stream to read the request from.⊟ Remarks
This is an implementation detail. The structure to read requests is the same as that of dispatchers, and the Optimization.Dispatcher.Dispatcher functionality is reused by this class.⊟ Requirements
Namespace: Optimization.Dispatcher
Assembly: Optimization (in Optimization.dll)
⊟ Respond Method
Send a response to the worker.
public void Respond (Dictionary<string, double> fitness)⊟ Parameters
- fitness
- The fitness map.
⊟ Remarks
Send a fitness map response to the worker. Use this if you want to write multiple fitnesses, or if you want to give your fitness value a specific name.⊟ Requirements
Namespace: Optimization.Dispatcher
Assembly: Optimization (in Optimization.dll)
⊟ Respond Method
Send a response to the worker.
⊟ Parameters
- fitness
- The fitness.
⊟ Remarks
Send a single fitness to the worker. Use this if you want to write a single fitness value. By default this will be received by the worker with the name "value".⊟ Requirements
Namespace: Optimization.Dispatcher
Assembly: Optimization (in Optimization.dll)
⊟ Respond Method
Send a response to the worker.
public void Respond (Optimization.Messages.Response.StatusType status, Dictionary<string, double> fitness)⊟ Parameters
- status
- Response status.
- fitness
- Response fitness map.
⊟ Remarks
Send a response to the worker. Use this to send a specific status to the worker. Normally you don't need to use this function directly.⊟ Requirements
Namespace: Optimization.Dispatcher
Assembly: Optimization (in Optimization.dll)
⊟ Respond Method
Send a response to the worker.
⊟ Parameters
- fitness
- Fitness map.
- data
- Additional data map.
⊟ Remarks
Send a set of fitnesses and additional data to the worker. Use this method to send additional data to the worker which gets recorded in the results database.⊟ Requirements
Namespace: Optimization.Dispatcher
Assembly: Optimization (in Optimization.dll)
⊟ Respond Method
Send response to the worker.
⊟ Parameters
- fitness
- The fitness.
- data
- Additional data map.
⊟ Remarks
Send a single fitness response with additional data to the worker. Use this method to send a single fitness to the worker (with the default name "value") and some additional data which will be recorded in the results database.⊟ Requirements
Namespace: Optimization.Dispatcher
Assembly: Optimization (in Optimization.dll)
⊟ Respond Method
Send response to the worker.
public void Respond (Optimization.Messages.Response.StatusType status, Dictionary<string, double> fitness, Dictionary<string, string> data)⊟ Parameters
- status
- Response status.
- fitness
- Response fitness.
- data
- Additional data.
⊟ Remarks
Use this to send the status, fitness and data to the worker. You normally don't need to be able to set the status explicitly.⊟ Requirements
Namespace: Optimization.Dispatcher
Assembly: Optimization (in Optimization.dll)
⊟ RespondFail Method
Send failure response to the worker.
public void RespondFail ()⊟ Remarks
Send a failure response to the worker. Use this method if the task failed to evaluate properly.⊟ Requirements
Namespace: Optimization.Dispatcher
Assembly: Optimization (in Optimization.dll)
⊟ Response Method
Send a response to the worker.
public void Response (Optimization.Messages.Response response)⊟ Parameters
- response
- The response.
⊟ Remarks
This is the most low level way of sending a response. You will have to construct the correct response message by yourself. Usually some of the other methods provided are more convenient.⊟ Requirements
Namespace: Optimization.Dispatcher
Assembly: Optimization (in Optimization.dll)
⊟ RunTask Method
Run task.
protected override bool RunTask ()⊟ Returns
True if the task evaluated successfully.⊟ Remarks
Run the task. This is currently not used.⊟ Requirements
Namespace: Optimization.Dispatcher
Assembly: Optimization (in Optimization.dll)