Welcome to Team 405 Found's repository for the ReRo 24hr Hackathon! This project demonstrates our solution to remotely control a bot using Python. Our bot is designed to follow a line path from start to finish by processing sensor data and issuing motor commands accordingly.
- Kshitij Koushik Kota - PES1UG23CS908 GitHub
- Pranav Hemanth - PES1UG23CS433 GitHub
- Sampriti Saha - PES1UG23CS505 GitHub
- Pranav Rajesh Narayan - PES1UG23CS435 Github
- Roshini Ramesh - PES1UG23CS488 Github
In this hackathon, we created a Python-based solution to enable our bot to follow a line autonomously. The bot reads sensor data representing line detection and determines motor actions in real time. The objective was to reach the endpoint efficiently and accurately.
- This file contains the main client-side code that reads sensor data from the bot and sends control commands to adjust the botβs movement.
- The bot uses a sensor array with 5 sensors (labeled
s1tos5) to detect the line. A value of1means the sensor detects the line; otherwise, it's0.
- This file simulates a server environment to test the botβs client-side script.
- It establishes a socket connection and sends sample sensor data to the client, allowing us to simulate the competitionβs live server environment.
The bot connects to an ESP32 board using Python sockets. Hereβs an overview of the data exchange:
- Input Format: JSON object
{'s1':0, 's2':0, 's3':0, 's4':1, 's5':0}(left-to-right sensor data). - Output Format: Motor commands in the format
'motor "f" "50" "b" "50"\n', where:"f"and"b"represent forward and backward movement, respectively.- The first
50controls the left motor, and the second50controls the right motor.
- Input from Server:
{'s1':0, 's2':1, 's3':1, 's4':0, 's5':0} - Output from Client:
'motor "f" "40" "b" "60"\n'
To run the client script and simulate control commands:
- Ensure Python is installed.
- Run the client script with the provided server IP and port.
python client_robowars1.py <ip_address> <port>For testing purposes, run the server script to simulate sensor data:
python server_robowars1.py- Exception Handling: Both client and server scripts handle exceptions to avoid connection errors.
- Socket Closure: Each script ensures socket connections are closed using a finally block to maintain stability.
- Logs: Print statements log data flow for real-time debugging.
This project is licensed under the MIT License - see the LICENSE file for details.