Leo Rover
Tutorials: Leo Rover Mobile Robot
Getting Started
Step 0: Start the Django Server
Before you can register or control your robot, you'll need to have the server running. To do this, navigate to the directory where your manage.py file is located and run:
python manage.py runserver
Step 1: Register your robot
Navigate to our webpage. Click on the Add Robot button. Fill out the form with your robot's information, including the robot's name, its degree of freedom, motion range, and other relevant details. Ensure that you establish a connection between your robot and the IoHRT's TCP server (./tcp_server/main.py). Note: You can modify or delete the robot's information after registering it.
Step 2: Start the IoHRT TCP Server
To enable communication between the server and your robot, you need to run the IoHRT system's TCP server.
Navigate to the directory containing main.py inside the tcp_server folder and run:
python ./tcp_server/main.py
Step 3: Implement TCP Client on the Robot
Code the TCP client on your robot's side. This client is responsible for sending commands and data to the IoHRT TCP server. Ensure the TCP-client sends data in the following format:
b'{"id": "leo", "action": "location change"}'
Replace "leo" with the id you set on the webpage during robot registration.
Important: The id in the data payload should match the id you set during robot registration on the webpage.
Note: Once you've followed these steps, your robot should be successfully connected to our IoHRT system and ready to be controlled. Should you encounter any issues, please consult our troubleshooting guide or contact our support team.
Here an example is given:
import socket
import json
from datetime import datetime
host = 'target_server_IP'
port = 9000 # socket server port number
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client_socket.connect((host, port)) # connect to the server
origin = {"id": "leo", "action": "location change"}
message = json.dumps(origin)
while Ture:
client_socket.send(message.encode('utf-8'))
data = client_socket.recv(1024).decode()
parsed_data = json.loads(data)
print(float(parsed_data))
After receiving the parsed_data from TCP server, you can use as the input to control your robot.
Please check our Github:
leo is ROS package which gives an example of how to combine this tcp client with ROS.