Skip to content

santsamu/picar-x

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

300 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– PiCar-X - Advanced Robotics Learning Platform

A comprehensive Python library for the SunFounder PiCar-X robot with enhanced educational examples and professional development practices.

This is an enhanced fork of the original SunFounder PiCar-X repository featuring structured learning paths, modern Python practices, and comprehensive examples.

🌟 What's New in This Fork

πŸ“š Comprehensive Learning Structure

  • 9 organized categories with progressive difficulty
  • 36+ educational examples from basics to advanced AI
  • Professional coding practices with type hints and context managers
  • Complete documentation with learning objectives and tutorials

πŸš€ Modern Features

  • Context manager support for safe resource management
  • Enhanced error handling with detailed diagnostics
  • Type hints for better code clarity
  • Comprehensive testing framework for quality assurance

🎯 Educational Focus

  • Structured learning progression from beginner to expert
  • Interactive examples with clear explanations
  • Best practices for robotics development
  • Real-world applications and project ideas

πŸ“– Learning Path

🌱 Beginner (Start Here!)

Master the fundamentals of robot control

  1. 01_basics - Robot Fundamentals

    • Hello World robotics
    • Safe programming with context managers
    • Robot status monitoring
  2. 02_movement - Movement Control

    • Basic movement patterns
    • Speed and direction control
  3. 03_sensors - Sensor Integration

    • Reading sensor data
    • Obstacle avoidance
    • Cliff detection safety

🌿 Intermediate (Build Skills!)

Develop computer vision and behavior programming

  1. 04_vision - Computer Vision

    • Camera basics and image processing
    • Object detection and tracking
    • Video recording and streaming
  2. 05_behaviors - Complex Behaviors

    • State machine programming
    • Face tracking and following
    • Behavior coordination systems

🌳 Advanced (Master Level!)

Create intelligent systems and games

  1. 06_games - Interactive Games

    • Game development concepts
    • Bull fighting simulation
    • Racing and treasure hunt games
  2. 07_ai_integration - AI & Machine Learning

    • GPT integration for natural language
    • Voice command processing
    • Intelligent behavior systems
  3. 08_advanced - Expert Systems

    • Multi-system integration
    • Advanced navigation algorithms
    • Performance optimization
  4. 09_testing - Professional Development

    • Unit testing frameworks
    • Hardware validation
    • Integration testing

πŸš€ Quick Start

1. Installation

Prerequisites:

  • Raspberry Pi 4 with PiCar-X hardware
  • Python 3.7+ installed
  • Required dependencies (robot_hat, vilib, etc.)
# Clone this enhanced fork
git clone -b v2.0 https://github.com/santsamu/picar-x.git
cd picar-x

# Install the library
sudo python3 setup.py install

# Set up your robot (first time only)
cd setup
python3 first_time_setup.py

2. Your First Robot Program

# examples/01_basics/01_hello_world.py
from picarx import Picarx

# Always use context manager for safety!
with Picarx() as px:
    print("πŸ€– Hello, PiCar-X World!")
    px.forward(50)  # Move forward
    px.sleep(1)     # Wait 1 second
    px.stop()       # Stop automatically on exit

3. Explore Examples

# Start with basics
cd examples/01_basics
python3 01_hello_world.py

# Try interactive examples
cd ../02_movement
python3 01_basic_movement.py

# Experiment with computer vision
cd ../04_vision
python3 01_camera_basics.py

πŸ“ Project Structure

picar-x/
β”œβ”€β”€ πŸ“š examples/              # Comprehensive learning examples
β”‚   β”œβ”€β”€ 01_basics/           # Robot fundamentals
β”‚   β”œβ”€β”€ 02_movement/         # Movement control
β”‚   β”œβ”€β”€ 03_sensors/          # Sensor integration
β”‚   β”œβ”€β”€ 04_vision/           # Computer vision
β”‚   β”œβ”€β”€ 05_behaviors/        # Complex behaviors
β”‚   β”œβ”€β”€ 06_games/            # Interactive games
β”‚   β”œβ”€β”€ 07_ai_integration/   # AI & machine learning
β”‚   β”œβ”€β”€ 08_advanced/         # Expert-level systems
β”‚   └── 09_testing/          # Professional testing
β”œβ”€β”€ πŸ”§ setup/                # Setup and calibration tools
β”œβ”€β”€ 🧠 picarx/               # Core library code
β”œβ”€β”€ 🎡 sounds/               # Audio files for TTS
β”œβ”€β”€ 🎢 musics/               # Music files
└── πŸ§ͺ test/                 # Hardware validation tests

🎯 Learning Objectives

By Category

Category What You'll Learn Key Skills
01_basics Robot fundamentals, safety, status monitoring Context managers, error handling
02_movement Precise movement control, navigation patterns Motor control, coordinate systems
03_sensors Data acquisition, environmental awareness Sensor fusion, obstacle avoidance
04_vision Image processing, object detection OpenCV, computer vision algorithms
05_behaviors State machines, complex coordination Behavior trees, multi-tasking
06_games Interactive systems, user engagement Game loops, real-time interaction
07_ai_integration Modern AI, natural language processing GPT integration, voice commands
08_advanced System integration, optimization Performance tuning, fault tolerance
09_testing Professional development, quality assurance Unit testing, validation frameworks

πŸ› οΈ Enhanced Features

Context Manager Support

# Automatic resource cleanup and safety
with Picarx() as px:
    px.forward(50)
    # Robot automatically stops and resets on exit

Type Hints & Modern Python

def move_robot(px: Picarx, speed: int, duration: float) -> bool:
    """Type-safe robot programming"""
    return px.safe_move(speed, duration)

Comprehensive Error Handling

try:
    with Picarx() as px:
        px.navigate_to_target()
except RobotHardwareError as e:
    print(f"Hardware issue: {e}")
except NavigationError as e:
    print(f"Navigation failed: {e}")

πŸŽ“ Educational Philosophy

Progressive Learning

Each example builds on previous knowledge, creating a natural learning progression from simple concepts to complex robotics systems.

Hands-On Practice

Every concept is reinforced with practical, runnable examples that work on real hardware.

Professional Standards

Learn industry best practices including testing, documentation, error handling, and code organization.

Real-World Applications

Examples demonstrate practical robotics applications including navigation, computer vision, AI integration, and interactive systems.

πŸ”— Documentation Links

🀝 Contributing

We welcome contributions! Whether you're fixing bugs, adding examples, or improving documentation:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-example
  3. Follow our coding standards (see examples for patterns)
  4. Add tests for new functionality
  5. Submit a pull request with clear description

Contribution Guidelines

  • Follow the established example structure and naming conventions
  • Include comprehensive docstrings and comments
  • Add learning objectives and explanations
  • Test on actual hardware when possible
  • Update relevant documentation

❓ Troubleshooting

Common Issues

Robot doesn't respond:

# Check hardware connections
cd setup
python3 first_time_setup.py

# Validate hardware
cd ../examples/09_testing
python3 01_hardware_validation.py

Import errors:

# Ensure all dependencies are installed
sudo pip3 install robot-hat vilib pygame opencv-python

# Verify installation
python3 -c "import picarx; print('βœ… PiCar-X installed successfully')"

Permission errors:

# Add user to required groups
sudo usermod -a -G dialout,gpio,i2c,spi $USER
# Logout and login again

Getting Help

  1. Check the examples - Most questions are answered in the comprehensive examples
  2. Run diagnostics - Use the testing examples to identify issues
  3. Visit the forum - SunFounder Community Forum
  4. Open an issue - For bugs or enhancement requests

πŸ“Š Examples Statistics

  • πŸ“ 9 Categories with progressive difficulty
  • πŸ“„ 36+ Examples covering all aspects of robotics
  • πŸ“š 1000+ Lines of educational documentation
  • πŸ§ͺ Professional Testing frameworks included
  • 🎯 Learning Objectives clearly defined for each section

πŸ† What You'll Achieve

After completing all examples, you'll have mastered:

  • βœ… Robot Programming - From basics to advanced systems
  • βœ… Computer Vision - Object detection, tracking, and processing
  • βœ… AI Integration - Modern AI and machine learning applications
  • βœ… Professional Development - Testing, documentation, and best practices
  • βœ… Project Development - Complete robotics project lifecycle
  • βœ… Problem Solving - Debugging and optimization techniques

Ready to become a robotics expert? Start with the basics!


🏒 About SunFounder

SunFounder is a technology company focused on Raspberry Pi and Arduino open source community development. Committed to the promotion of open source culture, we strive to bring the fun of electronics making to people all around the world and enable everyone to be a maker.

Products: Learning kits, development boards, robots, sensor modules, and development tools.

Community: High-quality products with video tutorials to help you build amazing projects.

Join Us: Whether you're interested in open source development or creating something cool, you're welcome to join our community!

πŸ“ž Contact & Support

🌐 Official Links

πŸ“§ Support Channels

πŸ› Issues & Contributions

πŸ“„ License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

License Details

  • License: GNU General Public License v2.0
  • Copyright: SunFounder, Inc.
  • Fork Enhancements: Licensed under the same terms
  • Commercial Use: Permitted under GPL terms

πŸš€ Ready to Start Your Robotics Journey?

Quick Links

Community

  • Share your projects on the SunFounder Forum
  • Get help from the robotics community
  • Contribute your own examples and improvements

Happy Robot Building! πŸ€–βœ¨


This enhanced fork is maintained with ❀️ for the robotics learning community. Original PiCar-X by SunFounder.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 88.7%
  • Shell 11.3%