PiCarX Documentation Spring 2025

Team: Aryama Sharma, Subhanjan Baral, Maimuna Mustafiz, Taha Sahbir, Kris Nguyen

Project Overview & Goals

The PiCarX project aims to create an AI-driven robotic car capable of autonomous navigation and precise sensor calibration. Main objectives include:

Initial Raspberry Pi Setup Instructions

This set up has already been done do not do this again if your Picar is assembled.

  1. Connect a USB keyboard, USB mouse, and an HDMI adapter to the Raspberry Pi’s HDMI0 port.
  2. Attach an HDMI cable from the adapter to an external monitor or TV.
  3. Insert the prepared Raspberry Pi Linux MicroSD card into the board.
  4. Power on the robot using a freshly charged battery pack.
  5. Connect to the wireless hotspot if necessary via the network icon (top right of screen).
  6. Set localization settings:
    • Click Raspberry Pi logo → Preferences → Raspberry Pi Configuration → Localization tab.
    • Set Country: US, Language: English, Timezone: Eastern Time (New York).
  7. Check and install any prompted software updates before proceeding.

Software Installation & Remote Access Setup

  1. Open Chromium browser and visit the Sunfounder PiCar-X Quick Guide.
  2. Follow Python software installation instructions carefully.
  3. Recommended practices when running motor tests:
    • Always hold robot in the air when running motor tests to avoid damaging wheels.
    • Minimize physical peripherals by using remote access after initial setup.
  4. Remote Access Setup (VNC):
    • Enable VNC:
      • Preferences → Raspberry Pi Configuration → Interfaces → Enable VNC.
    • Install RealVNC Viewer on your laptop/desktop.
    • Find Raspberry Pi IP address by typing hostname -I in terminal.
    • Create a new RealVNC connection using IP use raspberrypi.local as the name.
    • Username: cs371; Password: provided by the professor

HTML Folder Structure

Folder organization of documentation files:

PiCarX Folder Structure

Folder organization of project files:

Motor and Camera Calibration Procedures

1. Steering Wheel And Sensor Calibration

Goal: Adjust servo angles to allow the car to drive straight.

Key script Download: wheel_calibration.py

Key script View: wheel_calibration snippet

2. Camera Pan/Tilt Calibration (Facing Forward and Up)

Goal: Set pan and tilt to face forward.

Key script Download: camera_calibration.py

Key script View: camera_calibration snippet

Further Imporovements: Instead of scanning across the entire room, search for the red dot once and move its head accoring to the adjustment, reducing the adjustments(by taking average) until it can find the red dot.

Assessment: The code works and returns a value of 0°

3. Camera Roll Calibration (Horizon Straightness)

Goal: Correct rotational tilt of the camera using optical flow analysis.

Key script Download: camera_calibration.py

Key script View: camera_calibration snippet

Further Improvements: Calibrate using a chessboard pattern ensuring that it doesnt overshoot the measurements.

Assessment: The code works and returns a value of 2.5°. To get this value make sure you avoid any background noise and average over the angles found in the distance specified in the materials section below.

4. Optical Flow (Previous Pioneer Team)

Goal: Use both camera and sensors for line following

Key script Download: optical_flow.py

Key script View: optical flow snippet

Further Improvements: The code still has some issues that we did not have time to address, it has been listed in the to-do comments in the code.

5. Line Tracking

Goal:An attempt towards line following started by us.

Key script Download: line_tracking.py

Key script View: line tracking snippet

Further Improvements: Reduce the jitters and combine the sensor data and camera data such that it uses the camera after it cannot detect the sensor data ensuring that the robot is at the end of the line.

Assessment: We started our own code resembling the optical flow code of the previous pioneer team. We ran and tested the code multiple times, the robot stays on the line, make the improvement mentioned.

Important Tips

Things to Know (Including Common Errors)

Common Errors Solutions
Camera not found Check if the camera is still being used by any other application and restart the picarx
VNC connection failed Ensure VNC is enabled on the Raspberry Pi, check the IP address, and check that you're connected to the same network.
Indentation Error Do not mix your tabs and spaces, be consistent.


Calibration Suggestion
Horizon Calibration Make sure that you are in the right distance as specified and make sure that there is no other things that the picarx is reading introducing noise which might affect the calibration.
Pan And Tilt Keep the red dot on the same level as the picarx to ensure that we're getting accurate measurements.
Vertical Line strips Test using vertical line strips as chessboard and other pattern can over-estimate the angles.

Assessment of Functionality

Materials Used

Team Members and Work Logs