Runtime

javadoc

The Runtime is the first Service to start when MyRobotLab begins.  Every running instance of MyRobotLab includes a single Runtime Service.  The Runtime is a singleton, which means there should be only one per running process of MyRobotLab.  Its responsibilities include the creation, removal, and merging of Services into the Service registry.

The registry is critical for routing communication between Services.

In addition to managing the endpoints of Service communication the Runtime can retrieve information regarding details of the Java VM, operating system, and other details.

 

Examples:


#file : service/Runtime.py edit raw
# fun with Runtime :)

# install and/or update the Arduino service
runtime.update("org.myrobotlab.service.Arduino")
# install and/or update the OpenCV service
runtime.update("org.myrobotlab.service.OpenCV")

# install and/or update everything
runtime.updateAll()

# update the bleeding edge myrobotlab.jar
runtime.updateMyRobotLab()

# prints the days hours minutes your MRL has been alive
print runtime.getUptime()

# learn about your system
print runtime.availableProcessors()
print runtime.getFreeMemory()
print runtime.getTotalMemory()

# create and start an Arduino service
runtime.createAndStart("arduino", "Arduino")

# start the auto update system
# checks and installs updates - interval is 
# every 300 seconds
runtime.startAutoUpdate()

# stop the auto update system
runtime.stopAutoUpdate()

# the Big Hammer - the last thing
# MRL will see - shuts everything down
runtime.exit()