From e3ed2d6619a617e9408334df1f602a3b9d07321f Mon Sep 17 00:00:00 2001 From: Nicolas Rabault Date: Tue, 28 Mar 2023 11:02:16 +0200 Subject: [PATCH 1/6] Add a `no_board` tab on part 3 of the Get started --- tutorials/get-started/get-started3.mdx | 111 +++++++++++++++++++++++++ 1 file changed, 111 insertions(+) diff --git a/tutorials/get-started/get-started3.mdx b/tutorials/get-started/get-started3.mdx index 6ba814a57..0aa3665b4 100644 --- a/tutorials/get-started/get-started3.mdx +++ b/tutorials/get-started/get-started3.mdx @@ -31,6 +31,8 @@ We will use the same board from the first two parts, but **you also need a secon ::: ## 2. Create a physical network + + As we saw in Part 1, Luos engine allows you to define services and use them together on one MCU. What really sets Luos apart and makes it special is that you can also make services work together on separated MCUs. @@ -231,6 +233,115 @@ The LED of _board 1_ should blink thanks to the blinker app in _board 2_. **Congratulation, you've just created your first Luos distributed system. The objective of this part of our Get started was to use a service located in your first board, in another board to perform an action on it.** + + + +As we saw in Part 1, Luos engine allows you to define services and use them together on one program. What really sets Luos apart and makes it special is that you can also make services work together on separated programs. + +In Part 1, you have downloaded or cloned the Get started code folder in your computer. We will use this code to demonstrate how Luos engine works using a network. +To create a link between multiple programs on your computer Luos will use WebSockets toexchange information instead of a serial communication between electronic boards. + +To be able to do that, you need to run a broker that will share any transmitted message with all other programs. + +This broker is a simple python script, to make it run you need to install simple_websocket_server: + +``` +pip install simple_websocket_server==0.4.2 +``` + +Then you can run the broker script on `Get_started/No-Board/`: + +```bash +python broker.py +``` + +:::info +By default the broker will use localhost IP address. +If you want to experiment it using multiple computers you can configure your IP and port: +```bash +python broker.py --ip 'YOUR_LOCAL_IP' -p 8000 +``` +::: + + +## 3. Build a Luos distributed system + +We will begin by moving the blinker app service from _board 1_ to _board 2_ and see what happens next. + +### Run _board 1_ + +1. In VS Code, open the folder _Get_started/No-Board_: `file/open folder`. +2. From the left panel, locate and open the file _src/main.c_. +3. Comment the following two lines to remove the blinker service from this board: `Blinker_Init();` and `Blinker_Loop();` + + ```c + ... + Luos_Init(); + Led_Init(); + Pipe_Init(); + Gate_Init(); + //Blinker_Init(); <== comment this line + ... + Luos_Loop(); + Led_Loop(); + Pipe_Loop(); + Gate_Loop(); + //Blinker_Loop(); <== comment this line + ``` + +:::info +These lines trigger the initialization and looping execution of all the packages in your project. +::: +:::info +By default the program will use localhost IP address. +If you want to experiment it using multiple computers you can set the broker IP and port on the node_config.h file by replacing #define WS_BROKER_ADDR "ws://YOUR_LOCAL_IP:8000" with the correct IP and port. +::: + +4. Build the project. +5. On a new terminal run the compiled binary: +```bash +./.pio/build/native/program +``` + +### Run _board 2_ + +1. In VS Code, open the same folder _Get_started/No-Board_: `file/open folder`. +2. From the left panel, find and open the file _src/main.c_. +3. This time, comment the following six lines to remove all of the services except the blinker: `Led_Init();`, `Pipe_Init();`, `Gate_Init();`, `Led_Loop();`, `Pipe_Loop();`, and `Gate_Loop();` + + ```c + ... + Luos_Init(); + //Led_Init(); <== comment this line + //Pipe_Init(); <== comment this line + //Gate_Init(); <== comment this line + Blinker_Init(); + ... + Luos_Loop(); + //Led_Loop(); <== comment this line + //Pipe_Loop(); <== comment this line + //Gate_Loop(); <== comment this line + Blinker_Loop(); + ``` + +:::tip +In order to keep using Luos engine in your program, don't comment `Luos_init()` nor `Luos_Loop()`. +::: + +4. Build the project. +5. On a new terminal run the compiled binary: +```bash +./.pio/build/native/program +``` + +We are done! + +To check if everything is OK, the LED displayed on the terminal running _board 1_ should blink thanks to the blinker app in _board 2_. + +**Congratulation, you've just created your first Luos distributed system. The objective of this part of our Get started was to use a service located in your first program, in another board to perform an action on it.** + + + ## 4. Use Pyluos to control your network You can now use `pyluos-shell` in your terminal, as we did in Part 2. You should see the following: From 90530667bd180dba0beea2ad6eec9f0df56e679a Mon Sep 17 00:00:00 2001 From: Nicolas Rabault Date: Tue, 28 Mar 2023 11:07:05 +0200 Subject: [PATCH 2/6] Add a small info bloc on part 4 get_started to support Native. --- tutorials/get-started/get-started4.mdx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tutorials/get-started/get-started4.mdx b/tutorials/get-started/get-started4.mdx index 4e2c77fd4..dac6283c1 100644 --- a/tutorials/get-started/get-started4.mdx +++ b/tutorials/get-started/get-started4.mdx @@ -90,6 +90,13 @@ Those lines trigger the initialization and loop execution of all the packages in 6. Build and flash by clicking on the arrow pointing to the right on the bottom left in VS Code. +:::info + If you run Luos on your computer just compile and run using : + ```bash + ./.pio/build/native/program +``` +::: + ## 3. Connect to Luos Network Display 1. Open the tool Luos Network Display From 2444dfb37d21fd82b4a79e8ccec9f125a101f561 Mon Sep 17 00:00:00 2001 From: Nicolas Rabault Date: Tue, 28 Mar 2023 12:39:34 +0200 Subject: [PATCH 3/6] Add Pyluos modification for native usage --- tutorials/get-started/get-started3.mdx | 48 ++++++++++++++++++++------ 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/tutorials/get-started/get-started3.mdx b/tutorials/get-started/get-started3.mdx index 0aa3665b4..7b49420fb 100644 --- a/tutorials/get-started/get-started3.mdx +++ b/tutorials/get-started/get-started3.mdx @@ -233,6 +233,36 @@ The LED of _board 1_ should blink thanks to the blinker app in _board 2_. **Congratulation, you've just created your first Luos distributed system. The objective of this part of our Get started was to use a service located in your first board, in another board to perform an action on it.** +## 4. Use Pyluos to control your network + +You can now use `pyluos-shell` in your terminal, as we did in Part 2. You should see the following: + +```bash +**$ pyluos-shell** +Searching for a gate available +Testing /dev/cu.usbserial-D308N885 +Testing /dev/cu.usbmodem13102 +Connected to "/dev/cu.usbmodem13102". +Sending detection signal. +Waiting for routing table... +Device setup. + + Hit Ctrl-D to exit this interpreter. + +Your luos device have been successfully mounted into a "device" object: + ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ + ┃ ╭node 1 /!\ Not certified ┃ + ┃ │ Type Alias ID ┃ + ┃ ├> State led 2 ┃ + ┃ ├> Pipe Pipe 3 ┃ + ┃ ╰> Gate gate 1 ┃ +╔>┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +║ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ +╚══ 0>┃0 ╭node 2 /!\ Not certified ┃ + ┃ │ Type Alias ID ┃ + ┃ ╰> Unknown blinker 4 ┃ + >┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ +``` @@ -339,26 +369,23 @@ We are done! To check if everything is OK, the LED displayed on the terminal running _board 1_ should blink thanks to the blinker app in _board 2_. **Congratulation, you've just created your first Luos distributed system. The objective of this part of our Get started was to use a service located in your first program, in another board to perform an action on it.** - - ## 4. Use Pyluos to control your network -You can now use `pyluos-shell` in your terminal, as we did in Part 2. You should see the following: +You can now use `pyluos-shell -p 'localhost'` in your terminal, as we did in Part 2. You should see the following: ```bash -**$ pyluos-shell** -Searching for a gate available -Testing /dev/cu.usbserial-D308N885 -Testing /dev/cu.usbmodem13102 -Connected to "/dev/cu.usbmodem13102". +**$ pyluos-shell -p 'localhost'** + +Connected to "localhost". Sending detection signal. Waiting for routing table... +Sending telemetry... Device setup. Hit Ctrl-D to exit this interpreter. -Your luos device have been successfully mounted into a "device" object: +Your luos device has been successfully mounted into a "device" object: ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ ╭node 1 /!\ Not certified ┃ ┃ │ Type Alias ID ┃ @@ -372,7 +399,8 @@ Your luos device have been successfully mounted into a "device" object: ┃ ╰> Unknown blinker 4 ┃ >┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ``` - + + As we can see, the blinker application is now displayed on a separate board. You still can control and interact with services on both boards with pyluos, as we did in Part 2. For example, with your network connected to the computer, follow the step 3 from Part 2 and try to execute these lines one by one in an IPython session: From d7d55783345cca8da862866a3fa62638c2112d48 Mon Sep 17 00:00:00 2001 From: Nicolas Rabault Date: Wed, 29 Mar 2023 09:24:58 +0200 Subject: [PATCH 4/6] Add a small info for windows user compiler installation. --- tutorials/get-started/get-started.mdx | 6 ++++++ tutorials/get-started/get-started3.mdx | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/tutorials/get-started/get-started.mdx b/tutorials/get-started/get-started.mdx index ad231dcb8..526e1d21a 100644 --- a/tutorials/get-started/get-started.mdx +++ b/tutorials/get-started/get-started.mdx @@ -93,6 +93,12 @@ If VS Code displays the message “Do you trust the authors of the files in the ::: +:::info +Windows users must install a specific 64 bits version of GCC to compile the no board projects. +For example, the current version has been tested with MinGW-w64 (MSVCRT runtime). This library can be downloaded on https://winlibs.com/ + +::: + The project folder should now be opened in the PlatformIO explorer. 👍 :::info diff --git a/tutorials/get-started/get-started3.mdx b/tutorials/get-started/get-started3.mdx index 7b49420fb..ce185f6af 100644 --- a/tutorials/get-started/get-started3.mdx +++ b/tutorials/get-started/get-started3.mdx @@ -328,6 +328,13 @@ If you want to experiment it using multiple computers you can set the broker IP ::: 4. Build the project. + +:::info +Windows users must install a specific 64 bits version of GCC to compile the no board projects. +For example, the current version has been tested with MinGW-w64 (MSVCRT runtime). This library can be downloaded on https://winlibs.com/ + +::: + 5. On a new terminal run the compiled binary: ```bash ./.pio/build/native/program From becefac38777b0cabad370711c5d3f33b7e6a696 Mon Sep 17 00:00:00 2001 From: Nicolas Rabault Date: Wed, 29 Mar 2023 09:34:22 +0200 Subject: [PATCH 5/6] !fix a small typo --- tutorials/get-started/get-started3.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/get-started/get-started3.mdx b/tutorials/get-started/get-started3.mdx index ce185f6af..80da0453f 100644 --- a/tutorials/get-started/get-started3.mdx +++ b/tutorials/get-started/get-started3.mdx @@ -269,7 +269,7 @@ Your luos device have been successfully mounted into a "device" object: As we saw in Part 1, Luos engine allows you to define services and use them together on one program. What really sets Luos apart and makes it special is that you can also make services work together on separated programs. In Part 1, you have downloaded or cloned the Get started code folder in your computer. We will use this code to demonstrate how Luos engine works using a network. -To create a link between multiple programs on your computer Luos will use WebSockets toexchange information instead of a serial communication between electronic boards. +To create a link between multiple programs on your computer Luos will use WebSockets to exchange information instead of a serial communication between electronic boards. To be able to do that, you need to run a broker that will share any transmitted message with all other programs. From 7b2772664fe3d1cb7e42d5eb9bfaae7ce5c8223c Mon Sep 17 00:00:00 2001 From: Simon Bdy Date: Thu, 30 Mar 2023 10:07:34 +0200 Subject: [PATCH 6/6] Fixed minor typos --- tutorials/get-started/get-started.mdx | 4 ++-- tutorials/get-started/get-started3.mdx | 21 +++++++++++---------- tutorials/get-started/get-started4.mdx | 2 +- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/tutorials/get-started/get-started.mdx b/tutorials/get-started/get-started.mdx index 526e1d21a..32108be89 100644 --- a/tutorials/get-started/get-started.mdx +++ b/tutorials/get-started/get-started.mdx @@ -94,8 +94,8 @@ If VS Code displays the message “Do you trust the authors of the files in the ::: :::info -Windows users must install a specific 64 bits version of GCC to compile the no board projects. -For example, the current version has been tested with MinGW-w64 (MSVCRT runtime). This library can be downloaded on https://winlibs.com/ +Windows users must install a specific 64-bit version of GCC to compile the no-board projects. +For example, the current version has been tested with MinGW-w64 (MSVCRT runtime). This library can be downloaded on https://winlibs.com/. ::: diff --git a/tutorials/get-started/get-started3.mdx b/tutorials/get-started/get-started3.mdx index 80da0453f..8020aa732 100644 --- a/tutorials/get-started/get-started3.mdx +++ b/tutorials/get-started/get-started3.mdx @@ -269,11 +269,11 @@ Your luos device have been successfully mounted into a "device" object: As we saw in Part 1, Luos engine allows you to define services and use them together on one program. What really sets Luos apart and makes it special is that you can also make services work together on separated programs. In Part 1, you have downloaded or cloned the Get started code folder in your computer. We will use this code to demonstrate how Luos engine works using a network. -To create a link between multiple programs on your computer Luos will use WebSockets to exchange information instead of a serial communication between electronic boards. +To create a link between multiple programs on your computer, Luos will use WebSockets to exchange information instead of a serial communication between electronic boards. To be able to do that, you need to run a broker that will share any transmitted message with all other programs. -This broker is a simple python script, to make it run you need to install simple_websocket_server: +This broker is a simple Python script. To make it run, you need to install _simple_websocket_server_: ``` pip install simple_websocket_server==0.4.2 @@ -287,7 +287,7 @@ python broker.py :::info By default the broker will use localhost IP address. -If you want to experiment it using multiple computers you can configure your IP and port: +If you want to experiment it using multiple computers, you can configure your IP and port: ```bash python broker.py --ip 'YOUR_LOCAL_IP' -p 8000 ``` @@ -323,28 +323,28 @@ We will begin by moving the blinker app service from _board 1_ to _board 2_ and These lines trigger the initialization and looping execution of all the packages in your project. ::: :::info -By default the program will use localhost IP address. -If you want to experiment it using multiple computers you can set the broker IP and port on the node_config.h file by replacing #define WS_BROKER_ADDR "ws://YOUR_LOCAL_IP:8000" with the correct IP and port. +By default the program will use a localhost IP address. +If you want to experiment it using multiple computers, you can set the broker IP and port in the _node_config.h_ file by replacing `#define WS_BROKER_ADDR "ws://YOUR_LOCAL_IP:8000"` with the correct IP and port. ::: 4. Build the project. :::info -Windows users must install a specific 64 bits version of GCC to compile the no board projects. -For example, the current version has been tested with MinGW-w64 (MSVCRT runtime). This library can be downloaded on https://winlibs.com/ +Windows users must install a specific 64-bit version of GCC to compile the no-board projects. +For example, the current version has been tested with MinGW-w64 (MSVCRT runtime). This library can be downloaded at https://winlibs.com/ ::: -5. On a new terminal run the compiled binary: +5. In a new terminal, run the compiled binary: ```bash ./.pio/build/native/program ``` ### Run _board 2_ -1. In VS Code, open the same folder _Get_started/No-Board_: `file/open folder`. +1. In VS Code, open the same folder _Get_started/No-Board_: _File/Open folder_. 2. From the left panel, find and open the file _src/main.c_. -3. This time, comment the following six lines to remove all of the services except the blinker: `Led_Init();`, `Pipe_Init();`, `Gate_Init();`, `Led_Loop();`, `Pipe_Loop();`, and `Gate_Loop();` +3. This time, comment the following six lines to remove all of the services except the blinker: `Led_Init();`, `Pipe_Init();`, `Gate_Init();`, `Led_Loop();`, `Pipe_Loop();`, and `Gate_Loop();`: ```c ... @@ -408,6 +408,7 @@ Your luos device has been successfully mounted into a "device" object: ``` + As we can see, the blinker application is now displayed on a separate board. You still can control and interact with services on both boards with pyluos, as we did in Part 2. For example, with your network connected to the computer, follow the step 3 from Part 2 and try to execute these lines one by one in an IPython session: diff --git a/tutorials/get-started/get-started4.mdx b/tutorials/get-started/get-started4.mdx index dac6283c1..5049ab441 100644 --- a/tutorials/get-started/get-started4.mdx +++ b/tutorials/get-started/get-started4.mdx @@ -91,7 +91,7 @@ Those lines trigger the initialization and loop execution of all the packages in 6. Build and flash by clicking on the arrow pointing to the right on the bottom left in VS Code. :::info - If you run Luos on your computer just compile and run using : + If you run Luos on your computer, just compile and run using: ```bash ./.pio/build/native/program ```