Configuring the Routing Map - MrYsLab/s2aiomulti GitHub Wiki
Before starting s2aior, the s2aiomulti router, you must configure a routing map. A graphical board editor called s2aiobe is included to create the configuration file.
This editor uses tkinter, so please make sure that it is installed as part of your Python distribution.
If you configured a map manually with a previous release of s2aiomulti, you will need to reconfigure using the editor.
To start the editor, open a terminal window and type:
f s2aiobe
To create an entry, select the board number from the drop down list. You should use sequential board number entries, starting with board number 1.
Next set the board to active by select "yes" from the drop down list.
Then enter the connectivity information. If you are using a USB cable, enter the COM port for the board. If you are using a wireless connection, fill in the IP address and Port number. It is assumed for wireless operation that you are using a device, such as the WiFly module that converts TCP/IP to serial data.
You may only enter a COM port or an IP ADDRESS/PORT, not both. If you do, you will see the following error dialog box:
When you have completed filling out the information for the selected board, click "Update Board Information". You may then select another board to configure.
When you are done configuring all boards, click "Save All Changes".
An updated configuration file will be saved in the default configuration directory. The default directory is s2aior_boards located in your home directory.
That directory will contain both the latest configuration data and a backup of the previous data.
You may change the default location for the configuration directory and its files by supplying a command line option to s2aiobe. For example if you would like the configuration files to be located in C:\mystuff, invoke s2aiobe as follows:
s2aiobe -p C:\mystuff
This create an s2aio_boards directory in C:\mystuff
The s2aiomulti router, s2aior,will automatically create instances of the s2aiomulti Arduino server, s2aios, for each Arduino board in your system. To configure the system properly, a configuration file needs to be edited with the detailed parameters of your system.
If you use this command line option, you will also have to start the router using the same option so that it can find the configuration file:
s2aior -p C:\mystuff
Understanding The Contents of the boards.cfg Configuration File
The board configuration editor creates and maintains the boards.cfg configuration file that it places in the s2aior_boards directory. This directory is created by the editor and is located either in your HOME directory or in the directory you specified with the -p command line option.
The boards.cfg file contains an entry for each of the potential 10 Arduino boards supported by s2aiomulti.
The file is a text file and a typical entry looks as follows:
[board1]
board_id = 1
active = yes
com_port = /dev/ttyACM0
http_server_address = 127.0.0.1
http_server_port = 50215
arduino_ip_address = None
arduino_ip_port = None
router_address = 127.0.0.1
router_port = 50208
Here is a description of all of the fields of a board entry. The fields that are in italic are the fields currently maintained by the s2aiobe editor. All other fields are populated when the file is created.
You may wish to refer to the data flow data diagram for a better understanding of these fields.
[board1]
- This is the section number for a given board.
board_id = 1
- This is the board identifier. Currently it uses the same id value as the board section number.
active = yes
- If active is set to yes, the router will create an s2aios server for the board.
com_port = /dev/ttyACM0
- This is the COM port used when connecting an Arduino through a USB cable to your computer. You should make sure that each board has a unique COM port entry.
http_server_address = 127.0.0.1
- This is the IP address of the s2aios HTTP server.
http_server_port = 50215
- This is the IP port of for the s2aios HTTP server. This value must be a unique value - each board must contain a different port number.
arduino_ip_address = None
- This field is used to identify the IP address of a WiFly or equivalent TCP to Serial Converter. Normally this field is not used, but is included for those controlling a RedBot robot over WiFi.
arduino_ip_port = None
- This field is used to identify the IP port of a WiFly or equivalent TCP to Serial Converter. Normally this field is not used, but is included for those controlling a RedBot robot over WiFi.
router_address = 127.0.0.1
- This field is the IP address of the s2aior router's HTTP server. This field should contain the same value for all boards.
router_port = 50208
- This field is the IP Port of the s2aior router's HTTP server. This field should contain the same value for all boards.