Changing inertia sensor sensitivity level

I’m trying to use the inertia sensor to detect a vibration but I need to change the sensitivity so that normal movement isn’t recognized, only the vibration. so I’m trying to find a way to decrease the sensitivity of the vibration — does anyone know how to do this? Is there a place in the vex coding program?

This is probably not possible, and if it is, it’s not what the inertial sensor is intended for. What could you possibly need this functionality for?

  vex::inertial gyro = vex::inertial(PORT1);

  // Set the threshold value to adjust the sensitivity
  double threshold = 10.0; // Adjust this value to your desired sensitivity

  while (true) {
    // Apply the threshold to filter out normal movement
    if (abs(gyro.rotation()) > threshold) {
      // Display a message on the controller's screen for testing
      Controller.Screen.print("Vibration detected");
      vex::task::sleep(1000);

      Controller.Screen.clearScreen();
    }
    vex::task::sleep(20);
  }

Hope this helps

1 Like

.rotation() simply gives the absolute heading of the inertial sensor (accumulated over time internally from the acceleration(s) detected)
This wouldn’t work.

You could try using the .acceleration function or try to figure out what the .collision callback does.

1 Like