Open Rover is a project designed to control a rover using a web interface. The rover can be navigated manually using joystick.
- Live Video Streaming: The rover provides a live video feed from its camera, which can be toggled on or off via the web interface.
- Joystick Controls: Users can control the rover's movement using a joystick interface on the web page.
- Explorer Mode: When enabled, the rover navigates autonomously using vision-based navigation.
- Web Interface: Access the rover's control interface through a web browser.
- RoverWebServer: A Flask-based web server that handles video streaming and WebSocket communication for joystick and toggle controls.
- MotorDriver: A class to control the rover's motors using GPIO pins on a Raspberry Pi.
- CameraHandler: Manages the camera feed for live streaming.
- Web Interface: HTML and JavaScript files to provide a user-friendly control panel.
-
Hardware Setup:
- Connect the motors to the Raspberry Pi using the specified GPIO pins.
- Attach a compatible camera to the Raspberry Pi.
-
Software Setup:
- Ensure you have Python and the necessary libraries installed (
Flask,Flask-SocketIO,RPi.GPIO,OpenCV). - Clone the repository and navigate to the project directory.
- Ensure you have Python and the necessary libraries installed (
-
Permissions:
- Change permissions to be able to read the model file if necessary:
chmod +x /path_to/model.eim
- Change permissions to be able to read the model file if necessary:
-
Running the Rover:
- SSH into your Raspberry Pi:
ssh pi@raspberrypi.local
- Clone the repository and navigate to the project directory:
git clone https://github.com/your_username/open_rover.git cd open_rover - Create a virtual environment:
python3 -m venv venv
- Activate the virtual environment:
source venv/bin/activate - Install the required packages:
pip install -r requirements.txt
- Execute the
rover.pyscript to start the system:python rover.py
- Access the web interface at
http://raspberrypi.local:5001to control the rover.
- SSH into your Raspberry Pi:
- Video Stream: Toggle the video stream on or off using the "Video Stream" switch on the web interface.
- Motors: Enable or disable the motors using the "Motors" switch.
- Joystick: Use the on-screen joystick to manually control the rover's movement.
- Ensure the Raspberry Pi is connected to the same network as the device accessing the web interface.
- The rover's autonomous navigation relies on an external API for vision-based instructions.
- If the video stream does not display, ensure the camera is properly connected and permissions are set.
- Check the console logs for any connection errors or warnings.
For further assistance, refer to the source code and comments within the files for detailed implementation details.
-
Make the Startup Script Executable:
- Run the following command to make
startup.shexecutable:chmod +x startup.sh
- Run the following command to make
-
Edit Crontab for Auto-Startup:
- Open the crontab editor:
crontab -e
- Add the following line to schedule the script to run at boot:
@reboot /home/pi/open_rover/startup.sh > /home/pi/open_rover/rover.log 2>&1
- Open the crontab editor:
-
Verify Crontab Entry:
- Check if the crontab entry was added successfully:
crontab -l
- Check if the crontab entry was added successfully:
-
Reboot and Test:
- Reboot the Raspberry Pi to test the auto-startup:
sudo reboot
- Reboot the Raspberry Pi to test the auto-startup:
-
Check the Logs:
- After rebooting, read the logs to ensure the script ran correctly:
cat /home/pi/open_rover/rover.log
- After rebooting, read the logs to ensure the script ran correctly:
-
Confirm the Web Server is Running:
- Verify that the Python web server is running:
ps aux | grep python - You should see an output similar to:
pi 628 6.5 5.0 848080 21436 ? Sl 12:03 0:08 python webserver.py pi 2216 0.0 0.4 6088 1792 pts/0 S+ 12:05 0:00 grep --color=auto python
- Verify that the Python web server is running:
-
Kill webserver:
kill <PID>