LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
tracking_wheel.hpp
Go to the documentation of this file.
1/*
2This Source Code Form is subject to the terms of the Mozilla Public
3License, v. 2.0. If a copy of the MPL was not distributed with this
4file, You can obtain one at http://mozilla.org/MPL/2.0/.
5*/
6
7#pragma once
8
9#include "light/adi.hpp"
10#include "light/rotation.hpp"
11
21namespace light {
31 public:
32 pros::adi::Encoder adi_encoder;
33 pros::Rotation smart_encoder;
34
47 tracking_wheel(std::vector<int> ports, double wheel_diameter, double distance_to_center = 0.0, double ratio = 1.0);
48
63 tracking_wheel(int smart_port, std::vector<int> ports, double wheel_diameter, double distance_to_center = 0.0, double ratio = 1.0);
64
77 tracking_wheel(int port, double wheel_diameter, double distance_to_center = 0.0, double ratio = 1.0);
78
82 double get();
83
87 double get_raw();
88
95 void distance_to_center_set(double input);
96
101
109
114
118 void reset();
119
124
133 void ticks_per_rev_set(double input);
134
139
146 void ratio_set(double input);
147
151 double ratio_get();
152
159 void wheel_diameter_set(double input);
160
165
166 private:
167#define DRIVE_ADI_ENCODER 2
168#define DRIVE_ROTATION 3
169 int IS_TRACKER = 0;
170
171 bool IS_FLIPPED = false;
172
173 double DISTANCE_TO_CENTER = 0.0;
174 double WHEEL_DIAMETER = 0.0;
175 double RATIO = 1.0;
176 double ENCODER_TICKS_PER_REV = 0.0;
177 double WHEEL_TICK_PER_REV = 0.0;
178};
179}; // namespace light
Single tracking wheel for odometry.
void ticks_per_rev_set(double input)
Sets the amount of ticks per revolution of your sensor.
pros::Rotation smart_encoder
Backing Rotation sensor (used when constructed from a smart port).
void ratio_set(double input)
Sets the gear ratio for your tracking wheel.
tracking_wheel(std::vector< int > ports, double wheel_diameter, double distance_to_center=0.0, double ratio=1.0)
Creates a new tracking wheel with an ADI Encoder.
bool distance_to_center_flip_get()
Returns if the distance to center is flipped or not.
pros::adi::Encoder adi_encoder
Backing ADI encoder (used when constructed from ADI ports).
void wheel_diameter_set(double input)
Sets the diameter of your wheel.
double get()
Returns how far the wheel has traveled in inches.
double get_raw()
Returns the raw sensor value.
tracking_wheel(int smart_port, std::vector< int > ports, double wheel_diameter, double distance_to_center=0.0, double ratio=1.0)
Creates a new tracking wheel with an ADI Encoder plugged into a 3-wire expander.
tracking_wheel(int port, double wheel_diameter, double distance_to_center=0.0, double ratio=1.0)
Creates a new tracking wheel with a Rotation sensor.
double wheel_diameter_get()
Returns the diameter of your wheel.
double distance_to_center_get()
Returns the distance to the center of the robot.
void distance_to_center_set(double input)
Sets the distance to the center of the robot.
double ratio_get()
Returns the gear ratio for your tracking wheel.
void reset()
Resets your sensor.
double ticks_per_rev_get()
Returns the amount of ticks per revolution of your sensor.
void distance_to_center_flip_set(bool input)
Sets the distance to the center to be flipped to negative or not.
double ticks_per_inch()
Returns the constant for how many ticks is 1 inch.
Public LightLib odometry / pose-estimation API.
Definition pid.hpp:22