TRIK controllers can interact with each other, which makes it possible to solve problems of transferring messages between robots.
For the interaction of controllers, it will be necessary to select a master controller — the one to which we will connect the rest of the controllers. And also connect all controllers to one network. This can be done in two ways:
1. Using the existing network.
2. By creating a Wi-Fi access point on one of the controllers.
1. Select a master controller and connect it to an existing Wi-Fi network in client mode.
2. In the web interface of the master controller, in the "Interaction of robots" field, specify the tail number (usually for the master it is 01, but any other is possible) and its IP address.
3. Connect all other controllers to the same Wi-Fi network in client mode.
4. Specify for each of them in your web interfaces in the "Interaction of robots" field the tail number (different from the others) and the IP address of the master controller.
Also, the flight number and IP address of the master controller can be specified on the controller in the Interaction
menu item.
1. Select a master controller and share Wi-Fi from it using access point mode (select Network → Wi-Fi access point
in the menu).
2. Next, return to the main menu screen and select Interaction
.
3. Specify the tail number (usually for the master it is 01, but any other is possible) and its IP address.
4. Connect the rest of the controllers to the master using the Wi-Fi client mode. To do this, in the web interface of each controller, in the "Wi-Fi client" fields, specify the name and password of the network of the master controller.
5. Open the web interface using the IP address displayed on the controller in Wi-Fi client mode.
6. Specify for each of the controllers in their web interfaces in the "Interaction of robots" field the tail number (different from others) and the IP address of the master controller.
Also, the flight number and IP address of the master controller can be specified on the controller in the Interaction
menu item.
Using access point and client modes
The TRIK controller can be connected to other devices in two ways:
Using the TRIK controller as an access point (the controller creates a new network) and connects the devices to it.
Using the TRIK controller in Wi-Fi client mode and connect the devices and the controller itself to an existing network.
In this mode, the controller creates a new network, so we can connect devices to it.
1. Select Network → Wi-Fi hotspot
in the menu. The controller will distribute Wi-Fi, and the network parameters will appear on the screen:
Network name.
Password.
Controllers IP address.
2. When connecting a computer or smartphone to a Wi-Fi network, select the network and enter the password.
In this mode, we connect the controller and devices to an existing Wi-Fi network.
To do this, in the controller's web interface, we need to enter the name and password of the network to which we will connect the controller.
1. To launch the web interface, connect your computer or smartphone to the controller as an access point.
2. In the address bar of the browser, enter the IP address of the controller. The web interface will open.
3. In the "Wi-Fi client" field, enter the name and password of the network to which you want to connect the controller. Click the Save button.
4. Switch the controller to Wi-Fi client mode.
The TRIK controller has a Wi-Fi module that can work in two modes:
The access point mode, when the controller creates a new network, and we connect devices to it.
The Wi-Fi client mode, when we connect the controller to an existing network.
To select a mode in the controller menu, select the Network
item.
Read about connecting the controller to devices in different modes and the interaction of several controllers in the articles:
1. Connect the controller to the computer with TRIK Studio installed in either of two ways.
2. In the TRIK Studio settings, go to the "Robots" section and select the TRIK platform in the "Platforms" window.
3. Enter the IP address of the controller in the "TCP Settings" field.
Also, the controller IP address can be specified on the toolbar:
4. Click "OK".
Try to upload a program to the controller.
If there is no connection to the controller, TRIK Studio will show an error:
In this case check:
Whether the IP address in TRIK Studio matches the IP address on the controller.
Whether the TRIK controller displays its IP address. The IP address may not exist if the controller is connected to a Wi-Fi network in Wi-Fi client mode, but the router did not issue it. We recommend that you wait for a little or switch to the "Access Point" mode and back in the Wi-Fi client mode. It can also happen in Access Point mode. We recommend turning off the controller for a while and then restarting it.
4. On all controllers go to the Interaction
menu item and click the "Connect" button. The icon should appear in the upper right corner of the controller screens.
7. On all controllers go to the Interaction
menu item and click the "Connect" button. An icon should appear in the upper right corner of the controller screens.
5. If the connection is successful, the controller's IP address will be displayed at the top of the screen next to the icon , and the network name will be highlighted in the list with the icon .
Send message "5" from one robot and receive it on another.
Please note that the task can only be solved in real robot mode.
To solve the problem, you have to:
Write a message transmission algorithm for the leading robot.
Write a message reception algorithm for the second robot.
Connect robots to a single network.
Run programs on robots.
1. Switch TRIK Studio to the real robot mode.
2. Enter a message
variable for the message and initialize it by assigning it the number 5
in the "Expression" block.
3. Add "Send message" and "End" blocks. In the properties of the "Send message" block, specify the onboard number of the robot to which you want to send the message and the variable containing the message.
1. Switch TRIK Studio to the real robot mode.
2. Add the "Receive message" block.
In the block properties, specify the variable in which you want to write a message sent from another robot. The variable can be named whatever you want.
Set the "Wait for message" property to true
.
3. After the message has arrived, display it on the robot's screen for 3 seconds, and then finish the algorithm. To do this, add blocks "Print Text", "Timer" and "End".
In the properties of the "Print text" block, check the Calculate
box and specify true
in the "Update image" field.