Skip to content

Commit

Permalink
Cleanup for release, fixed bugs with WebUI, added documentation for it.
Browse files Browse the repository at this point in the history
  • Loading branch information
computer-whisperer committed Jan 4, 2015
1 parent 6da1a04 commit be11ebc
Show file tree
Hide file tree
Showing 19 changed files with 57 additions and 303 deletions.
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
include LICENSE.txt
include LICENSE.txt
include yeti/*
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@
# built documents.
#
# The short X.Y version.
version = '0.0.1'
version = '0.1'
# The full version, including alpha/beta/rc tags.
release = '0.0.1'
release = '0.1rc0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
11 changes: 11 additions & 0 deletions docs/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,14 @@ sleep for .05 of a second to let the rest of the robot program run.
.. note:: Rather than using python's native time.sleep(), or wpilib's Timer.delay(), always
use asyncio.sleep(), which allows other coroutines to execute.

Yeti WebUI
----------
Yeti comes preinstalled with a convenient WebUI, where you can control what is
going on with loaded modules. From here you can load, unload, and reload any module
with the click of a button.

To run the webui, set "yeti.preloaded_modules.webui" to load from your module
config file. The http server will start up on port 8080, and you should be able
to reach it at <computer_ip>:8080/index.html .

.. image:: images/WebUI.png
5 changes: 0 additions & 5 deletions examples/GearsBot/mods.conf

This file was deleted.

75 changes: 0 additions & 75 deletions examples/GearsBot/modules/arcade_drive.py

This file was deleted.

127 changes: 0 additions & 127 deletions examples/GearsBot/modules/claw.py

This file was deleted.

27 changes: 0 additions & 27 deletions examples/GearsBot/modules/debug.py

This file was deleted.

26 changes: 0 additions & 26 deletions examples/GearsBot/robot.py

This file was deleted.

21 changes: 0 additions & 21 deletions examples/basic_example/example_module.py

This file was deleted.

7 changes: 3 additions & 4 deletions examples/basic_example/mods.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[StartupMods]
#example
drivetrain
yeti.preloaded_modules.webui

[example]
example_module_fail
example_module
[drivetrain]
modules.arcade_drive
11 changes: 11 additions & 0 deletions yeti/config_manger.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class ConfigManager(object):
"""

_STARTUP_MOD_SECTION = "StartupMods"
_config_path = ""

def __init__(self):
self.config_structure = None
Expand All @@ -27,6 +28,7 @@ def load_startup_mods(self, context):
:param context: The context to load the modules into.
"""

if self.config_structure is None:
raise ConfigurationError("No config file loaded.")
for module_name in self.config_structure[self._STARTUP_MOD_SECTION]:
Expand All @@ -41,6 +43,10 @@ def load_module(self, name, context):
:returns: The created :class:`ModuleLoader`
"""

#Add reference to context for introspection.
context.config_manager = self

if self.config_structure is None:
fallback_list = [name]

Expand Down Expand Up @@ -76,6 +82,11 @@ def parse_config(self, path):
:returns: The dictionary of the parsed config file.
"""

if path == "":
path = self._config_path
self._config_path = path

#Open the file
f = open(path)
section = None
Expand Down
1 change: 1 addition & 0 deletions yeti/interfaces/gamemode.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def set_gamemode(mode, context=None):
data["mode"] = mode
context.thread_coroutine(_on_gamemode_set(mode, context))

@asyncio.coroutine
def _on_gamemode_set(mode, context):
"""
Sets all saved events for the given gamemode
Expand Down
2 changes: 1 addition & 1 deletion yeti/module_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def load_coroutine(self, module_path=None):
module_class = obj
break
else:
raise ModuleLoadError("No compatible module class found in " + file_to_load)
raise ModuleLoadError("Loader", "No compatible module class found in " + file_to_load)

#Initialize the actual module object
self.module_object = module_class()
Expand Down
1 change: 1 addition & 0 deletions yeti/preloaded_modules/webui/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .webui import *
Loading

0 comments on commit be11ebc

Please sign in to comment.