Skip to content

Logical05/rqt_pico_uploader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

RQT Pico Uploader

A ROS 2 RQT plugin that provides a graphical interface for compiling and uploading code to Raspberry Pi Pico boards using PlatformIO.

License ROS 2 Python

Overview

The RQT Pico Uploader is a Python-based GUI tool that simplifies the process of uploading firmware to Raspberry Pi Pico boards. It integrates seamlessly with ROS 2's RQT framework and uses PlatformIO for compilation and upload operations.

Key Features

  • GUI Interface: User-friendly interface integrated with RQT
  • Multiple Projects: Support for managing multiple Pico projects simultaneously
  • PlatformIO Integration: Uses PlatformIO for compilation and uploading
  • Project Validation: Validates PlatformIO projects for Pico compatibility
  • Unique ID Assignment: Automatically assigns unique IDs to uploaded firmware
  • Status Tracking: Real-time status updates for upload operations

Prerequisites

System Requirements

  • Ubuntu 22.04
  • ROS 2 Humble Hawksbill
  • Python 3.x
  • PlatformIO Core (CLI)

Installation

1. Clone the Repository

cd ~/your_ros2_workspace/src
git clone https://github.com/Logical05/rqt_pico_uploader.git

2. Install Dependencies

Make sure you have PlatformIO installed. To install, go to PlatformIO installation.

3. Build the Package

cd ~/your_ros2_workspace
colcon build --packages-select rqt_pico_uploader
source install/setup.bash

4. Install as RQT Plugin

The plugin will be automatically available in RQT after building and sourcing.

Usage

Launch Methods

Option 1: Through RQT

  1. Launch RQT (use --force-discover for first time use):

    # First time usage
    rqt --force-discover
    
    # Subsequent usage
    rqt
  2. Go to Plugins β†’ Miscellaneous Tools β†’ Pico Uploader (Custom)

Option 2: Standalone Mode

ros2 run rqt_pico_uploader rqt_pico_uploader

Using the Plugin

  1. Set PlatformIO Path (if needed):

    • Click the pulse icon
    • Select your PlatformIO installation directory (usually ~/.platformio)
  2. Add a Project:

    • Enter or click "Browse" to browse your PlatformIO project folder
    • Click the pulse icon to add the project to the upload queue
    • The project must contain a valid platformio.ini file configured for Pico
  3. Select Target Drive:

    • Connect your Raspberry Pi Pico in BOOTSEL mode
    • The plugin will automatically detect available drives
    • Select the appropriate drive for each project
    • Important: Do not use the same drive for multiple projects at the same time
  4. Upload:

    • Click "Upload" to compile and upload all projects
    • Monitor the status column for progress updates

Status Indicators

  • 🟨 Ready: Project is ready for upload
  • 🟦 Uploading: Compilation and upload in progress
  • 🟩 Complete: Upload completed successfully
  • πŸŸ₯ Error: Upload failed

Project Structure

rqt_pico_uploader/
β”œβ”€β”€ LICENSE                    # Apache 2.0 license
β”œβ”€β”€ package.xml                # ROS 2 package manifest
β”œβ”€β”€ plugin.xml                 # RQT plugin configuration
β”œβ”€β”€ setup.cfg                  # Setup configuration
β”œβ”€β”€ setup.py                   # Package setup script
β”œβ”€β”€ resource/
β”‚   β”œβ”€β”€ rqt_pico_uploader      # Resource marker
β”‚   └── uploader_gui.ui        # Qt UI file
└── src/
    └── rqt_pico_uploader/
        β”œβ”€β”€ __init__.py        # Package initialization
        β”œβ”€β”€ main.py            # Entry point
        β”œβ”€β”€ uploader.py        # RQT plugin class
        └── uploader_widget.py # Main widget implementation

How It Works

  1. Project Validation: The plugin checks for a valid platformio.ini file with Pico board configuration
  2. Temporary Compilation: Projects are copied to /tmp for compilation to avoid modifying the original source code
  3. ID Assignment: Each project gets a unique ID that's injected into the main.cpp file by replacing RQT_PICO_ID = NULL
  4. PlatformIO Build: Uses PlatformIO CLI to compile the project and generate the firmware
  5. Upload: The compiled .uf2 file is automatically copied to the selected Pico drive

Configuration

PlatformIO Project Requirements

Your PlatformIO project must:

  • Have a valid platformio.ini file
  • Be configured for Raspberry Pi Pico board
  • Contain a src/main.cpp file
  • Include the RQT_PICO_ID placeholder in your code (optional, for ID assignment)

Example platformio.ini:

[env:pico]
platform = raspberrypi
board = pico
framework = arduino

ID Assignment Feature

If your main.cpp contains the placeholder int RQT_PICO_ID = NULL;, it will be replaced with a unique numeric ID:

// Before compilation
int RQT_PICO_ID = NULL;

// After compilation (example)
int RQT_PICO_ID = 1;

Troubleshooting

Common Issues

  1. PlatformIO Not Found

  2. Project Not Recognized

    • Verify your project has a valid platformio.ini file
    • Ensure the board is set to "pico" in the configuration
  3. Drive Not Detected

    • Make sure the Pico is connected in BOOTSEL mode
    • Check that the device is mounted under /media/username/
    • Try reconnecting the Pico while holding the BOOTSEL button
  4. Upload Fails

    • Verify the selected drive is correct
    • Ensure the Pico is properly connected
    • Check that the project compiles successfully
    • Make sure you're not using the same drive for multiple projects simultaneously
  5. Plugin Not Visible in RQT

    • Use rqt --force-discover for first-time plugin discovery
    • Ensure the package is built and sourced correctly

Contributing

Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Author

J. Chawanakorn

J. Chawanakorn

Acknowledgments

  • Built on top of ROS 2 and RQT framework
  • Uses PlatformIO for compilation and upload
  • Designed for Raspberry Pi Pico development

About

A Python GUI tool to compile and upload code to a Raspberry Pi Pico board using PlatformIO.

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages