Class documentation - XilefTech/CharlieOSX GitHub Wiki
Class CharlieOSX
'CharlieOSX' is the head-class of this whole project. In this class all the other methods come together and get initialized correctly.
Params:
Param | Description | Value-Type | Standard/Recommended |
---|---|---|---|
configPath | path to the config File in the project | String | 'config.cfg' |
settingsPath | path to the settings File on the brick | String | 'settings.json' |
logFilePath | path to the folder for the logs, when empty, default to logs | String | '' |
Methods:
Method | Description |
---|---|
storeSettings | Writes the given data as a json stream to the file at given location |
loadSettings | returns a dict of the settings from the given path |
applySettings | applies the current settings to take effect |
Class Logger
'Logger' is our custom-made Logger to log data both in the console and to a .log file for analysation of errors.
Params:
Param | Description | Value-Type |
---|---|---|
config | the parsed config | Dictionary |
settings | the parsed settings | Dictionary |
fileLocation | path to the folder for the logs, when empty, default to logs | String |
Methods:
Method | Description |
---|---|
getFormattedTime | Returns the current time, formatted as [DD.MM.YYYY-hh:mm:ss] |
debug | Prints a message to both the log and the console with a [debug] tag |
info | see debug, but with [info] tag |
warn | see debug, but with [warn] tag and creates a popup on-sreen |
error | same as warn, but with [error] tag |
getScreenRefreshNeeded | returns wether or not the screen needs to be refreshed to override old text |
setScreenRefreshNeeded | used to set the Variable for screen refreshing |
Class Robot
'Robot' is the class that does all the driving including interpreting number-codes.
Params:
Param | Description | Value-Type |
---|---|---|
config | the parsed config | Dictionary |
settings | the parsed settings | Dictionary |
brick | initialized EV3-Brick | EV3-Brick Class |
logger | initialized logger | Logger Class |
Methods:
Method | Description |
---|---|
execute | Interprets the number codes and calls the functions below accordingly |
breakMotors | stops all driving-motors |
turn | turns the robot |
straight | drives a straight line whilst self-correcting with gyro-data |
intervall | drives back and forth in a straight line |
curve | drives a curve calculated by robot-move-distance and total curve angle |
toColor | drives straight until a (or multiple) color sensor(s) see a given color |
toWall | drives straight until a button-sensor is pressed |
action | drives the action motors or a gearing port |
Class UI
'UI' is the class that contains all the user interface stuff for the GUI on the brick display.
Params:
Param | Description | Value-Type |
---|---|---|
config | the parsed config | Dictionary |
settings | the parsed settings | Dictionary |
brick | initialized EV3-Brick | EV3-Brick Class |
logger | initialized logger | Logger Class |
settingsPath | path to the settings File on the brick | String |
Methods:
Method | Description |
---|---|
mainloop | method that puts all pieces of the UI together |
drawMenu | draws a Menu |
drawScrollBar | sub-method for drawing a scroll-bar on the side |
drawSettings | sub-method for drawing the settings sub-menu |
animate | sub-method to draw the transitioning animation |
drawDictlist | lists a Dictionary on the screen |
drawList | draws a List on the screen |
drawExtendableList | draws a List on the screen with a little + symbol at the end to extend it |