Myrobotlab
Open Source Java Framework for Robotics and Creative Machine Control
Install / Use
/learn @MyRobotLab/MyrobotlabREADME
myrobotlab

MyRobotLab Nixie Release
Open Source Framework for Robotics and Creative Machine Control You know, for robots!
- Project Website http://myrobotlab.org
- Project Discord https://discord.gg/AfScp5x8r5
- Latest Build Nixie 1.1.(Latest)
- Latest Javadocs Javdocs
Base Requirements
You will need Java 11 or newer. If you are only running MyRobotLab you need the JRE (Java Runtime Environment.) If you are going to be building from source, you'll need the JDK (Java Development Kit) Oracle or OpenJDK will work
Download the myrobotlab.zip
Download
latest Nixie 1.1.X
Starting MyRobotLab
After downloading and unzipping myrobtlab.zip into a new folder, start the appropriate script
Linux or MacOS
myrobotlab.sh
Windows
myrobotlab.bat
The first time the script runs it will automatically install all services and their dependencies, then it will launch myrobotlab. This can take a long time depending on the speed of your internet connection. The subsequent starting of myrobotlab will skip the installation stage. If a browser does not automatically start you can go to http://localhost:8888 to see the web user interface.
Building Project
MyRobotLab core is written in Java, it is a maven project - Any IDE which can load maven should work. Its web ui is written in AngularJs and html.
A few services (e.g. InMoov2 & ProgramAB) are in a different repo. The can be developed seperately so 3 build instruction sets are described.
All development environments require git and cloning the source.
Cloning Repo
create a directory to clone the repositories in (assuming you're on windows and cloning to the c:\dev directory)
mkdir c:\dev
cd dev
git clone https://github.com/MyRobotLab/myrobotlab.git
cd c:\dev\myrobotlab
Java Core
If you want to be making core changes, you will need to install a Java developement environment
Install Java 11
https://www.oracle.com/java/technologies/downloads/#java11
Building with Eclipse
Download Eclipse for Java Developers At: https://www.eclipse.org/downloads/packages/
Building with Maven
MyRobotLab builds using the Apache Maven java build system.
Download Maven At: https://maven.apache.org/download.cgi
To compile and build a myrobotlab.jar first : ensure that "mvn" (maven version 3.3+ is installed and in the path)
mvn clean install
This should produce a local build for you "myrobotlab.jar" file will be located at
myrobotlab/target/myrobotlab.jar
If you want to compile and skip the tests, you can use the standard maven approach
mvn clean install -DskipTests
Web UI Style Guide
Contributing
All development is done on the develop branch. To contribute code, the typical approach is to create an issue about the feature/bug you're working on.
From Github create a branch based off the "develop" branch with a descriptive name (and associated Issue number if available) Locally switch to the new branch Make code changes Commit & Push (frequently!) When code is ready, submit a pull request to the develop branch! Enjoy the code review, address issues and concern in the code review Reviewer merges pull request to develop. Reviewer deletes branch.
The following config should be useful to work directly on WebGui UI and InMoov2 UI if the repos are submoduled under src/main/resources/resource/InMoov2, src/main/resources/resource/ProgramAB
!!org.myrobotlab.service.config.WebGuiConfig
autoStartBrowser: false
enableMdns: false
listeners: null
peers: null
port: 8888
resources:
# these are the only two in usual runtime
# - ./resource/WebGui/app
# - ./resource
# the rest are useful when doing dev
- ./src/main/resources/resource/WebGui/app
- ./src/main/resources/resource/InMoov2/peers/WebGui/app
- ./src/main/resources/resource
type: WebGui
!!org.myrobotlab.service.config.RuntimeConfig
enableCli: true
id: null
listeners:
locale: null
logLevel: info
peers: null
registry:
- runtime
- security
- webgui
- python
resource: ./src/main/resources/resource
type: Runtime
virtual: false
Starting Flowchart
flowchart LR
CommandLine[CommandLine]
Runtime.main([Runtime.main])
install{install}
shutdown([shutdown])
checkForStartYml{start.yml
exists?}
startYmlEnabled{start.yml
enabled?}
CommandLine --> Runtime.main
Runtime.main --> checkForStartYml
checkForStartYml --> |yes| loadStartYml[load start.yml]
checkForStartYml --> |no| createDefaultStartYml[create default start.yml]
createDefaultStartYml --> loadStartYml
loadStartYml --> startYmlEnabled
startYmlEnabled --> |yes| Runtime.startConfig[config = start.yml config]
startYmlEnabled --> |no| default[config = default]
Runtime.startConfig --> loadRuntimeConfig[load runtime config]
default --> loadRuntimeConfig
loadRuntimeConfig --> startRuntime[start runtime]
startRuntime --> applyRuntimeConfig[apply runtime config
does not process registry]
applyRuntimeConfig --> install{install?}
install -->|yes| loadServiceData[loadServiceData]
install -->|no| Runtime.startConf[get runtime.startConfig config]
loadServiceData --> findUninstalledDependencies[find uninstallled dependencies]
findUninstalledDependencies -->installDependencies[install dependencies]
installDependencies --> shutdown
Network Distributed Architecture
Websockets - Default Response for New Connection
sequenceDiagram
autonumber
box Process Id p1
participant runtime@p1
end
box Process Id p2
participant webgui@p2
participant runtime@p2
end
Note right of runtime@p1: Client runtime@p1 opens a <br/>websocket to remote webgui
runtime@p1->>webgui@p2: Connect<br/>ws://localhost:8888/api/messages?user=root&pwd=pwd&session_id=2309adf3dlkdk&id=p1
Note left of webgui@p2: Remote webgui@p2 and runtime@p2 attempt to subscribe <br/> to the describe method of the runtime@p1
webgui@p2->>runtime@p1: addListener describe
Note left of webgui@p2: runtime@p2 sends a describe request to runtime@p1
webgui@p2->>runtime@p1: describe
Note right of runtime@p1: runtime@p1 responds with a describe response
runtime@p1->>webgui@p2: onDescribe
Note left of webgui@p2: Based on the results of the describe,<br/> more querying and subscriptions can be processed
%% opt Server Add Listener, Describe and Reserve
%% end
Minimal Message API Definition
{
"name": "runtime",
"method": "connect",
"data": [
"\"http://main.myrobotlab.org:8888\""
],
}
Path API Definition
/{service-name}/{method-name}/{json-param1}/{json-param2}/{json-param3}...
The Path API definition is a simple way to define a RESTful API. The path is parsed and the service name, method name, and parameters are extracted. The parameters are json encoded and converted to the correct type when the method is invoked. The response is returned as a JSON object. The REST and CLI both use this API definition.
Examples
http://localhost:8888/runtime/getUptime
http://localhost:8888/runtime/connect/"http://main.myrobotlab.org:8888"
http://localhost:8888/arduino/connect/"COM3"
The exact same paths can be used in the CLI
/runtime/getUptime
/runtime/connect/"http://main.myrobotlab.org:8888"
/arduino/connect/"COM3"
1 Connection
A connection with a websocket starts with an HTTP GET
ws://localhost:8888/api/messages?user=root&pwd=pwd&session_id=2309adf3dlkdk&id=p1
2 Subscribe to Runtime Describe
When a connection is established between two different myrobotlab instances p1 and p2, the following messages are sent. The first message is adding a subscription to the runtime of the other process. The subscription is for the function "describe". The second message will be a describe request.
{
"msgId": 1690145377501,
"name": "runtime",
"sender": "webgui@p2",
"sendingMethod": "",
"historyList": [],
"properties": null,
"status": null,
"encoding": "json",
"method": "addListener",
"data": [
"{\"topicMethod\":\"describe\",\"callbackName\":\"runtime@caring-hector\",\"callbackMethod\":\"onDescribe\",\"class\":\"org.myrobotlab.framework.MRLListener\"}"
],
"class": "org.myrobotlab.framework.Message"
}
3 Send Describe
{
"msgId": 1690145377501,
"name": "runtime",
"sender": "webgui@p2",
"sendingMethod": "",
"historyList": [],
"properties": null,
"status": null,
"encoding": "json",
"method": "describe",
"data": [
"\"fill-uuid\"",
"{\"id\":\"caring-hector\",\"uuid\":\"383b4070-2848-4c3d-85f4-e7f6e081d18e\",\"platform\":{\"os\":\"linux\",\"arch\":\"x86\",\"osBitness\":64,\"jvmBitness\":64,\"lang\":\"java\",\"vmName\":\"OpenJDK 64-Bit Server VM\",\"vmVersion\":\"11\",\"mrlVersion\":\"unknownVersion\",\"isVirtual\":false,\"id\":\"caring-hector\",\"branch\":\"dev
