Skip to content

Pico-ROS/Pico-ROS-software

Repository files navigation

PicoROS logo

Overview

Pico-ROS is a lightweight ROS (Robot Operating System) client implementation designed for resource-constrained devices. Built on top of zenoh-pico and working in conjunction with rmw-zenoh, it provides an easy-to-use interface to ROS host from embedded systems.

Pico-ROS targets resource-constrained microcontroller-based nodes and edge devices in ROS networks.

Features

Core Components

  1. picoros

    • A lightweight ROS client implementation providing core abstractions:
      • Node
      • Publisher
      • Subscriber
      • Service server
      • Service client
  2. picoserdes

    • CDR serialization/deserialization for ROS messages
    • Custom type generation from header files.
  3. picoparams

    • Parameter server implementation built using picoros and picoserdes
    • Customizable parameter backend interface
    • Compatible with ROS 2 parameter services

Getting Started

Prerequisites

Building the Project

git clone <repo>
cd <repo_path>
git submodule update --init --recursive
mkdir build
cd build
cmake ..
make

Build Options

  • Custom type definitions: -DUSER_TYPE_FILE=user_types.h
  • Disable examples: -DPICOROS_BUILD_EXAMPLES=OFF
  • Disable tests: -DPICOROS_BUILD_TESTS=OFF

Examples

The project includes several example applications demonstrating different features:

  • talker.c & talker.cpp: Basic publisher example
  • listener.c: Basic subscriber example
  • srv_server_add2ints.c: Service server example
  • srv_client_add2ints.c: Service client example
  • params_server.c: Parameter server implementation
  • odometry_publisher.c & odometry_listener.c: ROS odometry message handling
  • batteryState_publisher.c BatteryState message with sequence fields.
  • jointState_publisher.cpp JointState message with sequence fields in cpp.

Running the Examples

  1. Ensure ROS 2 is running with rmw_zenoh (Installation Guide)

  2. In separate terminals, run the example nodes:

    # Terminal 1: Run publisher
    ./talker -m client -a <zenoh-router-address>
    
    # Terminal 2: Run subscriber
    ./listener -m client -a <zenoh-router-address>
    
    # Terminal 3: Run service server
    ./srv_add2ints -m client -a <zenoh-router-address>
    
    # Terminal 4: Run parameter server
    ./param_server -m client -a <zenoh-router-address>
  3. Interact with nodes from ROS 2:

    # Subscribe to messages
    ros2 topic echo /picoros/chatter
    
    # Call service
    ros2 service call /picoros/add2 example_interfaces/srv/AddTwoInts '{a: 1, b: 2}'
    
    # List parameters
    ros2 param list /picoros

Documentation

The project uses Doxygen for documentation. To generate and read:

# Install dependencies:
sudo apt-get install doxygen graphviz

# Generate documentation:
cd docs
./generate.sh

# View documentation:
# Open in your default browser
xdg-open docs/generated/html/index.html

Using in your project

See the examples directory for implementation references.

Automatic generation of user_types.h file can be done using scripts in /tools/type-gen. Format of the file is descibed in picoserdes.h. Example with standard ROS types can be found in example_types.h.

For compatibility with rmw_zenohd default configuration, set matching zenoh-pico lease duration settings with defines or edit the zenoh-pico config.h file:

  • -DZ_TRANSPORT_LEASE=60000 and
  • -DZ_TRANSPORT_LEASE_EXPIRE_FACTOR=2

Example projects

Help us add more!

License

See LICENSE file for details.