Skip to content

adnanmk-1999/Fault_Injection_Toolbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

42 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Fault Injection Toolbox (ROS + Gazebo)

The Fault Injection Toolbox is a simulation-based, extensible framework designed for fault injection, faulty data generation, and scenario-based evaluation of robotic manipulation tasks using the Franka Emika Panda robotic manipulator.
It is built on ROS Noetic, Gazebo, and Python, and includes all required packages and versions for full reproducibility.

Normal Operation vs Fault-Injected Operation

First: Normal pick-and-place task; Second: Task execution with fault injection

πŸ”΅ Normal Joint State Trajectories

Figure 1: Normal (noise-free) joint state trajectories during a pick-and-place task.

πŸ”΄ Fault-Injected Trajectories (Gaussian Noise Οƒ = 0.5)

Figure 2: Joint state trajectories with injected Gaussian noise (mean = 0, standard deviation = 0.5). The noise is visible on the affected joint, and the Fault_Flag line indicates the duration of injection.

This toolbox provides:

  • Real-time fault injection on joint states
  • Dataset generation (ROS β†’ CSV) for ML and fault detection research
  • End-to-end task pipeline (Gazebo β†’ Faults β†’ Data β†’ Controller β†’ Logging)
  • Ready-made scenarios via scenario_pipeline.sh
  • Ability to run custom robots, custom controllers, and custom fault profiles

This repository focuses exclusively on fault injection and faulty data generation.
It does not include the motion controllers, scenario logic, or custom Gazebo world files required to reproduce specific pick-and-place tasks.

All default pick-and-place scenarios, controllers, MoveIt configurations, and world files used in the examples are maintained separately in the companion repository:

πŸ‘‰ Franka Emika Pick & Place: https://github.com/adnanmk-1999/FrankaEmika_Pick_Place

This separation allows users to:

  • Use the Fault Injection Toolbox with any robot, any controller, or any scenario
  • Integrate fault injection into their own simulation setups
  • Keep world files and task logic modular and independent

🎯 Motivation: Why Fault Injection Matters

Modern robotic systems operate in environments where sensor reliability, state estimation, and controller feedback are critical for safe operation. Even small faultsβ€”such as drift, noise, or sudden spikesβ€”can propagate through the system and eventually cause unsafe behavior or complete system failure.

Figure 3: Fault activation, error propagation, and potential system failure in safety-critical systems.

As illustrated above:

  • A fault may activate in a low-risk (green) region
  • It can propagate into an error state (yellow) if unmitigated
  • If the system cannot compensate, it may escalate into a failure (red)

In safety-critical domains such as:

  • Industrial robot manipulation
  • Autonomous systems
  • Medical robots
  • Transportation and aerospace systems
  • Collaborative robots (cobots)

even minor sensor errors can lead to:

  • Unstable control
  • Unpredictable behavior
  • Collisions
  • Damage to equipment
  • Human safety hazards

This toolbox enables researchers and engineers to simulate these faults before they occur in real systems, helping them:

  • Develop fault-tolerant controllers
  • Validate robust perception algorithms
  • Generate faulty datasets for ML-based anomaly detection
  • Explore how faults propagate during different tasks
  • Improve safety and reliability in real deployments

πŸ›  Platforms Used

1. Ubuntu 20.04 LTS (Desktop Image)

The toolbox is developed and tested on Ubuntu 20.04 LTS, the recommended operating system for ROS Noetic and Gazebo integration.

Download:
https://releases.ubuntu.com/20.04/

2. Robot Operating System (ROS Noetic)

ROS Noetic is the core middleware used for communication, motion planning, controller management, and running all nodes in this toolbox.

Install from ROS Wiki:
http://wiki.ros.org/noetic

3. MoveIt for ROS Noetic

MoveIt is used for motion planning, kinematics, controllers, and executing pick-and-place tasks for the Franka Panda robot.

Installation Guide:
https://ros-planning.github.io/moveit_tutorials/doc/getting_started/getting_started.html

4. Franka ROS (franka_ros)

The official ROS integration for the Franka Emika Panda robot.
Note: Do not clone libfranka from Franka Research 3.

Installation Guide:
https://frankaemika.github.io/docs/installation_linux.html

This provides:

  • Panda robot description (URDF/XACRO)
  • Controllers
  • ROS interfaces for simulation
  • Gazebo compatibility

5. Gazebo Simulator

Gazebo is used to simulate the physics-based environment, robot dynamics, and interactions required for fault injection experiments.

https://gazebosim.org/

6. Python + ROS Integration

Python is used for implementing:

  • The real-time fault injector
  • Custom scenarios
  • Data logging logic
  • High-level control utilities

It integrates natively with ROS Noetic using rospy.

πŸ€– Franka Emika Panda – Overview

The Franka Emika Panda robot is a widely-used collaborative 7‑DoF manipulator, ideal for simulation‑based research.

Key Characteristics

  • 7 Degrees of Freedom (Revolute joints)
  • 3 kg payload
  • 855 mm reach
  • High‑precision torque sensing
  • Designed for safety and compliance
  • Standard model available in ROS/Gazebo

Official Website

https://www.franka.de

Franka Emika Panda Illustration

Figure 4: Franka Emika Panda Manipulator with links and joints.

⭐ Toolbox Architecture (Hybrid Overview)

Figure 5: Block diagram of the proposed system.

⭐ Key Modules

1️⃣ Fault Injection Module

Location:

src/joint_state_publisher/joint_state_publisher/scripts/fault_injector

πŸ“‰ Common Sensor Fault Patterns in Cyber-Physical Systems

Figure 6: Common sensor error patterns observed in robotic and cyber-physical systems.

These fault patterns represent the most frequently occurring disturbances in real-world sensing systems:

  • Spike β€” Sudden high-amplitude jump in signal
  • Offset β€” Constant shift added to the real signal
  • Drift β€” Gradually increasing or decreasing bias over time
  • Stuck-at β€” Sensor value freezes at a constant reading
  • Noise β€” High-frequency random variations

These faults are representative of sensor degradation, EMI noise, connection issues, hardware wear, and calibration drift commonly observed in robotics and industrial automation.

Supported Fault Types

  • Noise (Gaussian)
  • Spike
  • Offset
  • Drift
  • Stuck-at
  • Corrupted / Missing data (zero/random)

Affects:

  • Joint positions
  • Joint velocities

Tested on Franka Emika Panda.

2️⃣ Faulty Data Generation Package

Location:

faulty_data_generation/src/data_generation.cpp

Features

βœ” Subscribes to faulty joint states
βœ” Converts ROS messages to CSV
βœ” Publishes custom messages
βœ” Generates datasets per run
βœ” Timestamps used for file naming

CSV Behavior

  • New CSV is created for each run
  • Filename includes timestamp
  • Suitable for ML pipelines, dataset labeling, anomaly detection

πŸ“¦ FaultyData Message Structure

The faulty_data_generation package publishes a custom ROS message named FaultyData, which contains:

  • Header information
  • Fault flag (active/inactive)
  • Affected joint index
  • Joint names
  • Joint position, velocity, and effort arrays

The message structure (from rosmsg show faulty_data_generation/FaultyData) is shown below:

Figure 7: Custom FaultyData message definition used for dataset generation.

πŸ“ Repository Structure (Updated)

Fault_Injection_Toolbox/
β”‚
β”œβ”€β”€ drift_config.yaml
β”œβ”€β”€ noise_config.yaml
β”œβ”€β”€ spike_config.yaml
β”œβ”€β”€ off_set_config.yaml
β”œβ”€β”€ stuck_at_config.yaml
β”‚
β”œβ”€β”€ scenario_pipeline.sh        # Full end‑to‑end scenario execution
β”œβ”€β”€ scenario_stuck_at.sh        # Example scenario
β”œβ”€β”€ bag2csv.sh                  # Bagfile conversion
β”‚
β”œβ”€β”€ faulty_data_generation/
β”‚   β”œβ”€β”€ CMakeLists.txt
β”‚   β”œβ”€β”€ msg/
β”‚   β”œβ”€β”€ package.xml
β”‚   └── src/
β”‚       └── data_generation.cpp
β”‚
β”œβ”€β”€ joint_state_publisher/      # Modified publisher w/ fault injector
β”œβ”€β”€ franka_ros-0.9.1/
β”œβ”€β”€ moveit/
β”œβ”€β”€ panda_gazebo/
└── panda_moveit_config-noetic-devel/

πŸš€ Running the Toolbox

Option A β€” Full Scenario Pipeline (Recommended)

If everything is set up:

./scenario_pipeline.sh

This automatically runs predefined scenarios and controllers:

  1. Starts Gazebo world
  2. Spawns Franka
  3. Begins rosbag logging
  4. Injects configured faults
  5. Starts dataset generator
  6. Runs the controller

This is the fastest way to reproduce results.

Below is a screenshot of the terminal interface when running a complete scenario using the built-in pipeline script.
This interface allows you to:

  • Select a fault type
  • Select a predefined scenario
  • Choose number of runs
  • Automatically launch Gazebo, MoveIt, fault injection, data generation, and logging

Figure 8: User interface of scenario_pipeline.sh during automated multi-run execution.

Option B β€” Run Commands Manually with Your Scenario

Command 1 β€” Start world

roslaunch panda_gazebo start-pick-and-place-world_$world.launch

Command 2 β€” Spawn robot

roslaunch panda_gazebo put_robot_in_world.launch

Command 3 β€” Start recording

rosbag record -O $timestamp.bag /faulty_data

Command 4 β€” Inject fault

rosrun joint_state_publisher fault_injector.$fault_node

Command 5 β€” Start data generation

rosrun faulty_data_generation data_generation

Command 6 β€” Start controller

rosrun moveit_tutorials own_pick_place_yc_$controller

βš™ Fault Configuration Files

Available configurations:

  • noise_config.yaml
  • spike_config.yaml
  • off_set_config.yaml
  • drift_config.yaml
  • stuck_at_config.yaml

Example:

fault_location: 3
fault_magnitude: 0.20
fault_duration: 2.5
fault_start_time: 4.0

Each scenario can load different configs.

πŸ“ˆ Future Extensions

  • Additional fault types
  • Real-robot integration
  • GUI for fault configuration
  • Advanced analytics for fault detection

πŸ‘€ Author

Developed by Adnan
Software Developer & Robotics Engineer