librmb 1.0
Rambunction 4330 Utility Library
Loading...
Searching...
No Matches
BaseDrive.h
1#pragma once
2
3#include "pathplanner/lib/path/PathPlannerPath.h"
4#include <initializer_list>
5#include <memory>
6#include <string>
7#include <unordered_map>
8
9#include <units/time.h>
10
11#include <wpi/array.h>
12
13#include <frc/interfaces/Gyro.h>
14#include <frc/kinematics/ChassisSpeeds.h>
15#include <frc/trajectory/Trajectory.h>
16
17#include <networktables/DoubleArrayTopic.h>
18#include <networktables/NetworkTable.h>
19#include <networktables/NetworkTableInstance.h>
20
21#include <frc2/command/CommandPtr.h>
22#include <frc2/command/Subsystem.h>
23
24#include <pathplanner/lib/path/PathPlannerTrajectory.h>
25
26namespace rmb {
27
32class BaseDrive {
33protected:
34 BaseDrive() = default;
35
36 // TODO: Modifyable for compatability with LimeLight.
37
50 BaseDrive(std::string visionTable);
51
52 virtual ~BaseDrive();
53
54public:
55 //---------------
56 // Drive Methods
57 //---------------
58
64 virtual void driveChassisSpeeds(frc::ChassisSpeeds chassisSpeeds) = 0;
65
69 virtual frc::ChassisSpeeds getChassisSpeeds() const = 0;
70
71 //------------------
72 // Odometry Methods
73 //------------------
74
78 virtual frc::Pose2d getPose() const = 0;
79
86 virtual frc::Pose2d updatePose() = 0;
87
99 virtual void addVisionMeasurments(const frc::Pose2d &poseEstimate,
100 units::second_t time) = 0;
101
111 virtual void setVisionSTDevs(wpi::array<double, 3> standardDevs) = 0;
112
118 virtual void resetPose(const frc::Pose2d &pose = frc::Pose2d()) = 0;
119
120 //----------------------
121 // Trajectory Following
122 //----------------------
123
129 virtual bool isHolonomic() const = 0;
130
140 virtual frc2::CommandPtr followWPILibTrajectory(
141 frc::Trajectory trajectory,
142 std::initializer_list<frc2::Subsystem *> driveRequirements) = 0;
143
155 virtual frc2::CommandPtr followWPILibTrajectoryGroup(
156 std::vector<frc::Trajectory> trajectoryGroup,
157 std::initializer_list<frc2::Subsystem *> driveRequirements);
158
168 virtual frc2::CommandPtr
169 followPPPath(std::shared_ptr<pathplanner::PathPlannerPath> path,
170 std::initializer_list<frc2::Subsystem *> driveRequirements) = 0;
171
183 // virtual frc2::CommandPtr followPPTrajectoryGroup(
184 // std::vector<pathplanner::PathPlannerTrajectory> trajectoryGroup,
185 // std::initializer_list<frc2::Subsystem *> driveRequirements);
186
200 virtual frc2::CommandPtr followPPPathWithEvents(
201 pathplanner::PathPlannerPath path,
202 std::unordered_map<std::string, std::shared_ptr<frc2::Command>> eventMap,
203 std::initializer_list<frc2::Subsystem *> driveRequirements);
204
219 // virtual frc2::CommandPtr followPPTrajectoryGroupWithEvents(
220 // std::vector<pathplanner::PathPlannerTrajectory> trajectoryGroup,
221 // std::unordered_map<std::string, std::shared_ptr<frc2::Command>>
222 // eventMap, std::initializer_list<frc2::Subsystem *>
223 // driveRequirements);
224
238 virtual frc2::CommandPtr fullPPAuto(
239 pathplanner::PathPlannerPath path,
240 std::unordered_map<std::string, std::shared_ptr<frc2::Command>> eventMap,
241 std::initializer_list<frc2::Subsystem *> driveRequirements);
242
256 virtual frc2::CommandPtr fullPPAuto(
257 std::vector<pathplanner::PathPlannerTrajectory> trajectoryGroup,
258 std::unordered_map<std::string, std::shared_ptr<frc2::Command>> eventMap,
259 std::initializer_list<frc2::Subsystem *> driveRequirements);
260
261protected:
262 //---------------
263 // Vision Thread
264 //---------------
265
272 nt::DoubleArraySubscriber poseSubscriber;
273
283 nt::DoubleArraySubscriber stdDevSubscriber;
284
286 NT_Listener poseListener;
287
291 NT_Listener stdDevListener;
292};
293} // namespace rmb
Definition BaseDrive.h:32
virtual frc2::CommandPtr fullPPAuto(pathplanner::PathPlannerPath path, std::unordered_map< std::string, std::shared_ptr< frc2::Command > > eventMap, std::initializer_list< frc2::Subsystem * > driveRequirements)
virtual void driveChassisSpeeds(frc::ChassisSpeeds chassisSpeeds)=0
virtual frc2::CommandPtr followPPPathWithEvents(pathplanner::PathPlannerPath path, std::unordered_map< std::string, std::shared_ptr< frc2::Command > > eventMap, std::initializer_list< frc2::Subsystem * > driveRequirements)
virtual frc::Pose2d getPose() const =0
virtual frc2::CommandPtr followWPILibTrajectoryGroup(std::vector< frc::Trajectory > trajectoryGroup, std::initializer_list< frc2::Subsystem * > driveRequirements)
NT_Listener poseListener
Definition BaseDrive.h:286
nt::DoubleArraySubscriber stdDevSubscriber
Definition BaseDrive.h:283
virtual frc::Pose2d updatePose()=0
virtual void addVisionMeasurments(const frc::Pose2d &poseEstimate, units::second_t time)=0
virtual void setVisionSTDevs(wpi::array< double, 3 > standardDevs)=0
virtual frc2::CommandPtr fullPPAuto(std::vector< pathplanner::PathPlannerTrajectory > trajectoryGroup, std::unordered_map< std::string, std::shared_ptr< frc2::Command > > eventMap, std::initializer_list< frc2::Subsystem * > driveRequirements)
virtual void resetPose(const frc::Pose2d &pose=frc::Pose2d())=0
virtual bool isHolonomic() const =0
virtual frc2::CommandPtr followWPILibTrajectory(frc::Trajectory trajectory, std::initializer_list< frc2::Subsystem * > driveRequirements)=0
virtual frc::ChassisSpeeds getChassisSpeeds() const =0
nt::DoubleArraySubscriber poseSubscriber
Definition BaseDrive.h:272
virtual frc2::CommandPtr followPPPath(std::shared_ptr< pathplanner::PathPlannerPath > path, std::initializer_list< frc2::Subsystem * > driveRequirements)=0
NT_Listener stdDevListener
Definition BaseDrive.h:291
BaseDrive(std::string visionTable)
the master namespace of librmb
Definition LogitechGamepad.h:9