Class CollisionSensor

  • All Implemented Interfaces:
    Switch

    public class CollisionSensor
    extends java.lang.Object
    implements Switch
    • Constructor Summary

      Constructors 
      Constructor Description
      CollisionSensor​(edu.wpi.first.wpilibj.interfaces.Accelerometer accel, double collisionMagnitudeThreshold)
      Determines if a collision occurred
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isTriggered()
      Triggers if the magnitude of the acceleration is greater or equal to the collision threshold
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CollisionSensor

        public CollisionSensor​(edu.wpi.first.wpilibj.interfaces.Accelerometer accel,
                               double collisionMagnitudeThreshold)
        Determines if a collision occurred
        Parameters:
        accel - An accelerometer
        collisionMagnitudeThreshold - The magnitude of the acceleration in g-forces that determines a collision
    • Method Detail

      • isTriggered

        public boolean isTriggered()
        Triggers if the magnitude of the acceleration is greater or equal to the collision threshold
        Specified by:
        isTriggered in interface Switch
        Returns:
        true if the switch is triggered, false otherwise