|
ART v1.0-alpha
A Robot Template that raises the floor for VRC teams
|
A struct for tracking the robot's lateral displacement. More...
Public Member Functions | |
| HorizontalTracker () | |
| Construct an empty Horizontal Tracker object. | |
| HorizontalTracker (vex::rotation rotation, Length wheelSize, double gearRatio) | |
| Construct a new Horizontal Tracker object. | |
| HorizontalTracker (vex::rotation rotation, Length wheelSize, double gearRatio, Length wheelOffset) | |
| Construct a new Horizontal Tracker object. | |
| Length | getTravel () |
| Get the distance traveled by the Horizontal Tracker. | |
Public Attributes | |
| std::shared_ptr< vex::rotation > | m_rotation {nullptr} |
| A Pointer to a rotation sensor object. | |
| Length | m_wheelSize {Inches(2.75)} |
| A Length representing the diameter of the wheel. | |
| double | m_gearRatio {1.0} |
| A double representing the gear ratio of the tracker. | |
| Angle | m_lastAngle = Angle(0) |
| Stores the last angle recorded from the encoder. | |
| Angle | m_travelAngle = Angle(0) |
| Stores the change in angle since the last call of getTravel() | |
| Length | m_travelDistance = Length(0) |
| Stores the distance traveled. | |
| Length | m_offset = Length(0) |
| Stores a Length representing the vertical distance from horizontal tracker to the tracking center (positive is toward the front of the robot) | |
A struct for tracking the robot's lateral displacement.
Basically just a nested class to handle a horizontal tracking wheel if the robot has one. This supplements the odometry by allowing it to observe travel in another direction, which can be essential to robots that can slide sideways.
As with the odometry, the HorizontalTracker requires an Inertial as well as wheel size and gear ratio. The wheel offset can also be used if the tracking wheel isn't in the center of the robot, but rather in front or behind it.
A HorizontalTracker object is kept internally in the SmartDrive class. The definition of the class is private, so you can't create your own Horizontal Tracker. It is only meant to be used internally within the SmartDrive class.
Definition at line 462 of file SmartDrive.h.
| art::SmartDrive::HorizontalTracker::HorizontalTracker | ( | ) |
Construct an empty Horizontal Tracker object.
The default empty constructor, which is used to create an empty HorizontalTracker if the robot doesn't have one or isn't configured to have one. Basically, this is the default and adding a functional tracker is optional.
Because the class is private, there isn't a way to construct your own horizontal tracker. This is just used internally.
Definition at line 221 of file SmartDrive.cpp.
| art::SmartDrive::HorizontalTracker::HorizontalTracker | ( | vex::rotation | rotation, |
| Length | wheelSize, | ||
| double | gearRatio ) |
Construct a new Horizontal Tracker object.
| rotation | a rotation sensor to use for tracking |
| wheelSize | a Length object representing the diameter of the wheel |
| gearRatio | a double representing the ratio of output to input gears(output/input) |
Because the class is private, there isn't a way to construct your own horizontal tracker. This is just used internally to add a tracker to the SmartDrive.
Definition at line 222 of file SmartDrive.cpp.
| art::SmartDrive::HorizontalTracker::HorizontalTracker | ( | vex::rotation | rotation, |
| Length | wheelSize, | ||
| double | gearRatio, | ||
| Length | wheelOffset ) |
Construct a new Horizontal Tracker object.
| rotation | a rotation sensor to use for tracking |
| wheelSize | a Length object representing the diameter of the wheel |
| gearRatio | a double representing the ratio of output to input gears(output/input) |
| wheelOffset | a Length object representing the vertical distance from horizontal tracker to the tracking center (positive is toward the front of the robot) |
Because the class is private, there isn't a way to construct your own horizontal tracker. This is just used internally to add a tracker to the SmartDrive.
Definition at line 225 of file SmartDrive.cpp.
| Length art::SmartDrive::HorizontalTracker::getTravel | ( | ) |
Get the distance traveled by the Horizontal Tracker.
Uses the difference in the encoder's position to calculate how far the robot has traveled laterally. The value returned is the distance from the last getTravel() call. Therefore, it should be called only within the track function and not used in other places, lest it throw off the values used for tracking.
Of course, the HorizontalTracker is stored privately by the SmartDrive, so you wouldn't be able to call this unless you modified the source code.
Definition at line 228 of file SmartDrive.cpp.
| double art::SmartDrive::HorizontalTracker::m_gearRatio {1.0} |
A double representing the gear ratio of the tracker.
If the Tracker has a gear ratio between the encoder and the wheel, a gear ratio will need to be entered to convert the encoder values to wheel travel. The gear ratio is a number that can be calculated using (output teeth#)/(input teeth#).
It is advised to simply type out both tooth counts in the constructor, like 60.0/36.0. Note the ".0" added to each number to ensure that the result is a double and not an integer. If it converts to an integer, then all the decimal places will be truncated and the odometry will not work.
Definition at line 555 of file SmartDrive.h.
Stores the last angle recorded from the encoder.
This is used to calculate the difference in angle, m_travel angle, which is then used to calculate the distance traveled, m_travelDistance.
Definition at line 563 of file SmartDrive.h.
Stores a Length representing the vertical distance from horizontal tracker to the tracking center (positive is toward the front of the robot)
Definition at line 583 of file SmartDrive.h.
| std::shared_ptr<vex::rotation> art::SmartDrive::HorizontalTracker::m_rotation {nullptr} |
A Pointer to a rotation sensor object.
A pointer to a rotation sensor object. A shared pointer is kept so that the same object can be stored and the pointer can be copied between objects without losing the original sensor.
Because the tracker is private, there isn't a way to access this from outside the SmartDrive class. Its use is completely internal to the SmartDrive class.
Definition at line 529 of file SmartDrive.h.
Stores the change in angle since the last call of getTravel()
This is calculated using m_lastAngle and helps to calculate the distance traveled, m_travelDistance.
Definition at line 569 of file SmartDrive.h.
Stores the distance traveled.
This is calculated using m_travelAngle as well as the information about the wheel size from m_wheelSize. Then it stores a Length
Definition at line 576 of file SmartDrive.h.
A Length representing the diameter of the wheel.
The standard Vex Wheel sizes are 2.75, 3,25 and 4 inches. As with any other Length, you are free to use any unit you wish, but keep in mind that this is the Diameter and not the travel of the wheel.
Defaults to 2.75 inches, but the set-up function attached to the SmartDrive constructor will make you input your own wheel size anyway.
Definition at line 542 of file SmartDrive.h.