Skip to content
Harrison Green edited this page Oct 9, 2017 · 1 revision

RoombaSIM Implementation Documentation

Classes:

roombasim.ai.Controller

Subclass this class in order to implement custom AI.

from roombasim.ai import Controller

class MyController(Controller):

    def setup(self):
        # called after superclass __init__
        # implement initialization routines here
        pass

    def update(self, delta, elapsed):
        # delta - time in ms since last update
        # elapsed - time in ms since start of simulation
        # perform AI task-switching here
        pass

Available attributes:

# a reference to a roombasim.ai.TaskController object
# created during superclass initialization
self.task_controller

# a reference to a roombasim.ai.StateController object
# created during superclass initialization
self.state_controller

roombasim.ai.Task

Subclass this class to implement custom task routines.

from roombasim.ai import Task

class MyTask(Task):

    def __init__(self, my_param1, my_param2):
        # (optional) override this method to accept
        # custom keyword arguments. The default superclass
        # behavior is to store kwargs in self.params
        pass
    
    def update(self, delta, elapsed, state_controller, environment):
        # delta - time in ms since last update
        # elapsed - time in ms since start of simulation
        # state_controller - a reference to the parent controller's
        #     roombasim.ai.StateController object
        # environment - a reference to the "global" roombasim.environment.Environment object
        pass
Clone this wiki locally