Robot control from the remote control
Example program
Last updated
Was this helpful?
Example program
Last updated
Was this helpful?
To control the robot with the you need to write a program and run it on the robot.
Write to use the controller in TRIK Studio.
the controller to the computer and the written program to the robot.
Connect your smartphone to the controller by selecting the controller's network.
Open the app on your smartphone.
Execute the algorithm on the controller.
1. Enter variables for gamepad touch coordinates - x
and y
- and initialize them by assigning zero values to them in the "" block:
8. Close the loop on the "Condition" block with a link from the "Timer" block.
2. Add the "" block:
3. To check if the gamepad clicks on the left area (Pad1), add a "" block with the condition > 0
:
4. In case there is no touch, it is necessary to stop the motors. To do this, add a block "":
5. If the area is pressed on the gamepad, you need to get the coordinates of the touch. To do this, use the array in the "" block:
6. After getting the coordinates, add a simple controller with the "" blocks. The Y coordinate offset is responsible for the speed of the robot and the X coordinate offset is responsible for the rotation.
7. To close the condition, add a "" block with a value of 100 ms
(in the program this is the time for a new call to the remote control).
9. If you have a video camera, add the "" block to the beginning of the program:
You can find the finished program in the root folder of TRIK Studio /examples/trik/remoteContro
l or download it .