LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
distanceSensor.hpp
Go to the documentation of this file.
1/*
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 */
6#pragma once
7
8#include "api.h"
11#include <memory>
12
13namespace okapi {
14class DistanceSensor : public ControllerInput<double> {
15 public:
27 DistanceSensor(std::uint8_t iport,
28 std::unique_ptr<Filter> ifilter = std::make_unique<PassthroughFilter>());
29
30 virtual ~DistanceSensor() = default;
31
37 double get();
38
45 double controllerGet() override;
46
54 std::int32_t getConfidence() const;
55
63 std::int32_t getObjectSize() const;
64
70 double getObjectVelocity() const;
71
72 protected:
73 std::uint8_t port;
74 std::unique_ptr<Filter> filter;
75};
76} // namespace okapi
PROS API header provides high-level user functionality.
std::int32_t getConfidence() const
Get the confidence in the distance reading.
std::unique_ptr< Filter > filter
virtual ~DistanceSensor()=default
double getObjectVelocity() const
Get the object velocity in m/s.
std::int32_t getObjectSize() const
Get the current guess at relative object size.
DistanceSensor(std::uint8_t iport, std::unique_ptr< Filter > ifilter=std::make_unique< PassthroughFilter >())
A distance sensor on a V5 port.
double controllerGet() override
Get the sensor value for use in a control loop.
double get()
Get the current filtered sensor value in mm.