Skip to content

Create ROS2 SVDD anomaly detection package with OneClassSVM#1

Closed
Copilot wants to merge 4 commits intomainfrom
copilot/create-ros2-svdd-monitor-package
Closed

Create ROS2 SVDD anomaly detection package with OneClassSVM#1
Copilot wants to merge 4 commits intomainfrom
copilot/create-ros2-svdd-monitor-package

Conversation

Copy link

Copilot AI commented Dec 9, 2025

Implements SVDD-based anomaly detection for robot monitoring using /imu and /cmd_vel topics. Package structure follows ROS2 Humble ament_python conventions with MIT license.

Package Structure

  • config.py: SVDD hyperparameters and topic configuration
  • features.py: Windowed statistical features (mean/std/min/max) from sensor streams
  • svdd_model.py: OneClassSVM wrapper with StandardScaler and persistence
  • train_node.py: Collects normal operation data for configurable duration (default 60s)
  • monitor_node.py: Real-time anomaly detection publishing to /anomaly_detected and /anomaly_score

Entry Points

ros2 run ros2_svdd_monitor train    # Train on normal data
ros2 run ros2_svdd_monitor monitor  # Detect anomalies

Feature Extraction

48-dimensional feature vector per window:

  • IMU: 6 dimensions (linear_accel xyz, angular_vel xyz) × 4 statistics
  • cmd_vel: 6 dimensions (linear xyz, angular xyz) × 4 statistics

Testing

  • pytest suite covering config, model training/prediction/persistence, feature extraction
  • CI enabled with skip-tests changed to false in ros-ci.yml
  • Dependencies (numpy, scikit-learn) added to setup.py install_requires

Configuration

Model persists to ~/svdd_model.pkl (excluded via .gitignore with *.pkl, *.bag, *.db3)

Original prompt

Seed from LCAS/ros2_pkg_template as LCAS/ros2_svdd_monitor. Preserve .devcontainer. Create a ROS2 Humble ament_python package (rclpy) implementing SVDD using ONLY /imu and /cmd_vel. Add train (OneClassSVM) and monitor nodes (entry points: train, monitor), svdd_model, features, config, tests, CI (pytest), requirements, README. MIT license. Do NOT include rosbag files.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: jondave <6209386+jondave@users.noreply.github.com>
limitations under the License.
MIT License

Copyright (c) 2024 L-CAS
Copy link
Member

Choose a reason for hiding this comment

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

2024?

Copilot AI and others added 2 commits December 9, 2025 15:12
…ogging

Co-authored-by: jondave <6209386+jondave@users.noreply.github.com>
Co-authored-by: jondave <6209386+jondave@users.noreply.github.com>
Copilot AI changed the title [WIP] Create ROS2 SVDD monitor package from template Create ROS2 SVDD anomaly detection package with OneClassSVM Dec 9, 2025
Copilot AI requested a review from jondave December 9, 2025 15:18
@jondave
Copy link
Collaborator

jondave commented Dec 9, 2025

@copilot what is the difference between this PR and PR2 with the branch copilot/create-ros2-svdd-monitor-package-again

Copy link
Author

Copilot AI commented Dec 9, 2025

@copilot what is the difference between this PR and PR2 with the branch [copilot/create-ros2-svdd-monitor-package-again](https://github.com/LCAS/ros2_svdd_monitor/tree/copilot/create-ros2-svdd-monitor...

The main differences between this PR and the copilot/create-ros2-svdd-monitor-package-again branch are:

This PR (copilot/create-ros2-svdd-monitor-package):

  • Uses config.py module for configuration
  • Node files named train_node.py and monitor_node.py
  • Simpler structure with 3 main commits focusing on core functionality
  • No examples directory or sample data generator

Other branch (copilot/create-ros2-svdd-monitor-package-again):

  • Uses YAML-based configuration (config/config.yaml)
  • Node files renamed to train.py and monitor.py
  • Includes examples/ directory with sample data generator
  • Adds utility module (utils/rosbag_to_csv.py)
  • Has dedicated pytest workflow (.github/workflows/pytest.yml)
  • More comprehensive testing improvements
  • Enhanced documentation with examples
  • Additional .gitignore entries

The other branch appears to be a more feature-complete iteration with better tooling, examples, and testing infrastructure.

@jondave jondave closed this Dec 9, 2025
@jondave jondave deleted the copilot/create-ros2-svdd-monitor-package branch December 9, 2025 15:35
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.

3 participants