Skip to content

TensorFleet/example-easy-drone-python

Repository files navigation

Easy Drone Python - Example Project

This is a test project that demonstrates how to use the easy-drone package as a normal user would - by installing it directly from GitHub.

What This Project Does

This project recreates some of the examples from the main easy-drone-python repository to demonstrate:

  • Installing the package from GitHub
  • Using the pub/sub messaging system
  • Communicating with Gazebo simulations
  • Listing available topics

Quick Start

1. Setup Virtual Environment

# Create and activate virtual environment
python3 -m venv venv
source venv/bin/activate  # On Linux/Mac
# On Windows: venv\Scripts\activate

2. Install Dependencies

# Install easy-drone from GitHub
pip install -r requirements.txt

This will install the easy-drone package directly from the GitHub repository.

3. Run Examples

List Topics

Discover all available topics on the network:

python examples/topic_list.py

Simple Publisher & Subscriber

In one terminal (subscriber):

source venv/bin/activate
python examples/simple_subscriber.py

In another terminal (publisher):

source venv/bin/activate
python examples/simple_publisher.py

You should see messages being published and received!

With Gazebo Simulation

If you have Gazebo running with a drone simulation:

# List all topics from Gazebo
python examples/topic_list.py

# Subscribe to a specific Gazebo topic
python examples/simple_subscriber.py /world/default/model/x500/odometry

Project Structure

example-easy-drone-python/
├── README.md              # This file
├── requirements.txt       # Install easy-drone from GitHub
├── examples/
│   ├── simple_publisher.py    # Publish messages
│   ├── simple_subscriber.py   # Subscribe to messages
│   └── topic_list.py          # List available topics
└── venv/                  # Virtual environment (created by user)

Examples Explained

simple_publisher.py

Publishes string messages to a topic at 1 Hz. Great for testing communication.

simple_subscriber.py

Subscribes to a topic and prints received messages. Can connect directly to Gazebo topics.

Tip: If discovery doesn't work (common with Docker), specify the publisher address:

# First, get the publisher address
gz topic -i -t /your/topic
# Output: tcp://172.17.0.1:45943, gz.msgs.Image

# Then use it directly
GZ_PUBLISHER_ADDRESS=tcp://172.17.0.1:45943 python examples/simple_subscriber.py /your/topic

topic_list.py

Discovers and lists all topics on the network. Useful for debugging.

Troubleshooting

No topics discovered

  1. Check firewall allows UDP multicast on port 11317
  2. Ensure Gazebo or other publishers are running
  3. Try with verbose mode (edit examples to set verbose=True)

Messages not received

  1. Ensure publisher is running before subscriber connects
  2. Wait a few seconds for discovery
  3. Try using GZ_PUBLISHER_ADDRESS environment variable (see above)

Installation issues

# Reinstall from GitHub
pip uninstall easy-drone
pip install --no-cache-dir git+https://github.com/TensorFleet/easy-drone-python.git

Backend Selection

The library supports two transport backends:

ZeroMQ (Default)

# Use ZeroMQ (default, no env var needed)
python examples/simple_publisher.py

Zenoh

# Install with Zenoh support
pip install 'easy-drone[zenoh] @ git+https://github.com/TensorFleet/easy-drone-python.git'

# Use Zenoh backend
export GZ_TRANSPORT_IMPLEMENTATION=zenoh
python examples/simple_publisher.py

Important: All communicating nodes must use the same backend!

Learn More

License

Apache 2.0 (same as the main easy-drone-python project)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages