A comprehensive control system for the Dofbot robotic arm featuring AI-powered vision, web interfaces, and real-time camera integration.
This project provides multiple interfaces for controlling a Dofbot robotic arm:
- AI Brain: Python-based control system with RealSense camera integration and computer vision
- Web Controller: Flask-based onboard web server for HTTP API control
- Simple Control: Next.js web interface for browser-based robot control
dofbot/
βββ ai-brain/ # AI-powered control system with camera integration
β βββ main.py # Main control loop with interactive keyboard controls
β βββ dofbot_api.py # Python API client for robot communication
β βββ utils.py # RealSense camera utilities
βββ onboard/ # Flask web server for onboard robot control
β βββ app.py # Flask application (runs on robot)
β βββ README.md # Onboard setup instructions
βββ simple-control/ # Next.js web interface
βββ src/ # React components and pages
βββ package.json # Node.js dependencies
βββ README.md # Web interface setup
- Hardware: Dofbot robotic arm with onboard computer
- Cameras: Intel RealSense depth cameras (optional, for AI brain)
- Network: Robot and control computer on same network
Deploy the Flask web server to your robot's onboard computer:
# On the robot (Raspberry Pi/similar)
cd onboard/
pip install flask opencv-python
python app.py
The robot will be accessible at http://[robot-ip]:5000
For advanced control with camera integration:
cd ai-brain/
pip install opencv-python pyrealsense2 requests numpy
python main.py
Controls:
a/z
: Servo 1 (base rotation)s/x
: Servo 2 (shoulder)d/c
: Servo 3 (elbow)f/v
: Servo 4 (wrist pitch)g/b
: Servo 5 (wrist rotation)h/n
: Servo 6 (gripper)1-5
: Set movement step sizeESC
: Exit
For browser-based control:
cd simple-control/
npm install
npm run dev
Access at http://localhost:3000
Update the robot IP address in ai-brain/main.py
:
robot = DofbotApi(ip="192.168.31.157") # Change to your robot's IP
The AI brain automatically detects connected RealSense cameras. Ensure cameras are connected before running.
Endpoint | Method | Description |
---|---|---|
/angles |
GET | Get current servo angles |
/home |
GET | Move to home position (90Β° all servos) |
/set_angles |
GET | Set servo angles with parameters |
GET /set_angles?angles=A,B,C,D,E,F&t=T
angles
: Comma-separated angles for 6 servost
: Movement time in milliseconds (default: 5000)
Servo Ranges:
- Servo 1 (Base): 10Β° - 170Β°
- Servo 2 (Shoulder): 15Β° - 165Β°
- Servo 3 (Elbow): 15Β° - 165Β°
- Servo 4 (Wrist pitch): 10Β° - 170Β°
- Servo 5 (Wrist rotation): 10Β° - 260Β°
- Servo 6 (Gripper): 10Β° - 170Β°
- Real-time camera feeds: Multiple RealSense depth + RGB cameras
- Interactive control: Keyboard-based servo control
- Visual feedback: Live camera display with depth mapping
- Flexible movement: Adjustable step sizes and movement speeds
- HTTP API: RESTful endpoints for robot control
- Safety limits: Automatic angle constraint enforcement
- Service integration: Systemd service for auto-start
- Cross-platform: Works with any HTTP client
- Modern web UI: React-based control interface
- Real-time updates: Live robot status and control
- Responsive design: Works on desktop and mobile
- State management: Redux for application state
- Robot API: Extend
DofbotApi
class inai-brain/dofbot_api.py
- Camera processing: Add functions to
ai-brain/utils.py
- Web endpoints: Add routes to
onboard/app.py
- UI components: Add React components to
simple-control/src/
# Test robot connection
python -c "from ai_brain.dofbot_api import DofbotApi; print(DofbotApi('192.168.31.157').connected)"
# Test camera setup
python -c "from ai_brain.utils import all_devices; print(f'{len(all_devices())} cameras found')"
opencv-python
: Computer vision and image processingpyrealsense2
: Intel RealSense camera SDKrequests
: HTTP client for API communicationnumpy
: Numerical computingflask
: Web framework (onboard only)
next
: React frameworkreact
: UI library@reduxjs/toolkit
: State managementreact-redux
: React-Redux bindings
- Always ensure robot workspace is clear before operation
- Servo angle limits are enforced to prevent mechanical damage
- Emergency stop: Press ESC in AI brain mode or close browser tab
- Test movements at low speeds initially
This project is licensed under the MIT License - see the LICENSE file for details.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
For issues and questions:
- Check existing issues in the repository
- Create a new issue with detailed description
- Include robot model, OS, and error messages
Happy robot controlling! π€