2024-05-24 15:55:30 -04:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <hal/SimDevice.h>
|
|
|
|
|
#include <units/length.h>
|
|
|
|
|
|
|
|
|
|
#include "frc/SharpIR.h"
|
|
|
|
|
|
|
|
|
|
namespace frc {
|
|
|
|
|
|
2024-05-24 14:02:22 -07:00
|
|
|
/** Simulation class for Sharp IR sensors. */
|
2024-05-24 15:55:30 -04:00
|
|
|
class SharpIRSim {
|
|
|
|
|
public:
|
2024-05-24 14:02:22 -07:00
|
|
|
/**
|
|
|
|
|
* Constructor.
|
|
|
|
|
*
|
|
|
|
|
* @param sharpIR The real sensor to simulate
|
|
|
|
|
*/
|
2024-05-24 15:55:30 -04:00
|
|
|
explicit SharpIRSim(const SharpIR& sharpIR);
|
2024-05-24 14:02:22 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructor.
|
|
|
|
|
*
|
|
|
|
|
* @param channel Analog channel for this sensor
|
|
|
|
|
*/
|
2024-05-24 15:55:30 -04:00
|
|
|
explicit SharpIRSim(int channel);
|
|
|
|
|
|
2024-05-24 14:02:22 -07:00
|
|
|
/**
|
|
|
|
|
* Set the range returned by the distance sensor.
|
|
|
|
|
*
|
|
|
|
|
* @param rng range of the target returned by the sensor
|
|
|
|
|
*/
|
2024-05-24 15:55:30 -04:00
|
|
|
void SetRange(units::centimeter_t rng);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
hal::SimDouble m_simRange;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace frc
|