Skip to content

Conversation

@KavinduMethpura
Copy link
Collaborator

No description provided.

Changed project name to 'py-swarm-robot', updated authors and emails in pyproject.toml, and revised copyright year and holder in LICENSE.
Added a full-featured Robot base class that initializes and manages an MQTT client, coordinate tracker, and RobotMQTT helper. Implemented a robust RobotMqttClient wrapper for paho-mqtt with connection management, message queues, and callback support. RobotMQTT helper now provides a constructor and a placeholder for handling incoming messages. These changes provide a structured foundation for robot lifecycle management and MQTT-based communication.
Expanded RobotMQTT with management topic handling, message routing, and coordinate publishing. Implemented a dead-reckoning MotionController with drive, move, and rotate methods, including kinematic calculations. Minor formatting and constructor updates in Robot base class to support new helpers.
This commit corrects whitespace and formatting issues in robot_mqtt.py, mqtt_client.py, and robot_base.py for improved code consistency and readability. Also updates VSCode settings to add custom dictionary words for spell checking.
Removed unnecessary return statements in the management command handler of RobotMQTT. This streamlines the control flow and clarifies intent, especially for the START and RESET commands.
Introduces a DummyMqttClient for testing and expands test_motion.py to include instantiation of MotionController with dependencies, as well as a test for the Robot base class's run and shutdown behavior.
Added 'testbot' to the cSpell.words list in VSCode settings. Fixed minor whitespace formatting in test_motion.py for consistency.
Changed the initialization of robot_id in RobotMQTT to store it as a string instead of an integer. This may improve compatibility with systems expecting robot_id as a string.
Replaced placeholder sensor classes with full implementations for ColorSensor, DistanceSensor, and ProximitySensor using MQTT request/response patterns. Each sensor now supports synchronous data retrieval with timeouts, internal caching, and handler registration for incoming MQTT messages. Also updated test_motion.py to patch the MQTT connection in test_robot_base_run_and_shutdown, preventing real network calls during tests.
Replaces the NeoPixel placeholder with a full-featured controller class supporting MQTT-based commands for color, pixel, blink, and pulse control, as well as optional acknowledgment handling. Adds input validation, thread safety, and resource cleanup. Also updates VSCode settings to add 'neopixel' to cSpell words.

This comment was marked as outdated.

KavinduMethpura and others added 3 commits September 1, 2025 18:02
Added full implementations for DirectedCommunication and SimpleCommunication classes, supporting inter-robot messaging via MQTT with callback and queue APIs. Replaced the Coordinate placeholder with a dataclass providing pose tracking, odometry updates, frame conversions, and publishing utilities.

This comment was marked as outdated.

@NuwanJ NuwanJ requested a review from Copilot September 2, 2025 01:06
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a comprehensive robot framework with MQTT-based communication for the Pera-Swarm system. It adds core components including sensors, motion control, communication modules, and a base robot class with lifecycle management.

  • Adds complete MQTT client wrapper with queued publishing and message routing
  • Implements sensor modules for proximity, distance, and color with request/response patterns
  • Introduces motion controller with differential drive kinematics and coordinate tracking
  • Adds communication modules for simple broadcast and directed robot-to-robot messaging

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/test_motion.py Adds tests for MotionController instantiation and Robot base class run/shutdown with MQTT mocking
src/robot/sensors/proximity.py Implements proximity sensor with MQTT request/response protocol supporting multiple angles
src/robot/sensors/distance.py Implements distance sensor with correlation ID-based request/response pattern
src/robot/sensors/color.py Implements color sensor for RGB and ambient light readings via MQTT
src/robot/robot_base.py Adds base Robot class with MQTT client, coordinate tracking, and lifecycle management
src/robot/mqtt_client.py Implements MQTT client wrapper with connection management and message queuing
src/robot/motion.py Adds motion controller with differential drive kinematics and dead-reckoning
src/robot/indicators/neopixel.py Implements NeoPixel LED controller with various animation modes
src/robot/helpers/robot_mqtt.py Adds high-level MQTT helper for robot state management and message routing
src/robot/helpers/coordinate.py Implements coordinate tracking with odometry and frame conversion utilities
src/robot/communication/simple_comm.py Adds simple broadcast communication module
src/robot/communication/directed_comm.py Implements directed one-to-one robot communication
.vscode/settings.json Adds spell check words for technical terms

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@NuwanJ NuwanJ changed the title Methpura new MQTT library implementation Sep 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants