2023-Robot
Robot code for 2023 FRC season by Argos, FRC team #1756
Loading...
Searching...
No Matches
drive_to_position.h
Go to the documentation of this file.
1
4
5#pragma once
6
7#include <frc/geometry/Pose2d.h>
8#include <frc2/command/CommandBase.h>
9#include <frc2/command/CommandHelper.h>
10#include <units/angle.h>
11#include <units/velocity.h>
12
13#include <memory>
14
16
17class DriveToPosition : public frc2::CommandHelper<frc2::CommandBase, DriveToPosition> {
18 public:
20 const frc::Pose2d source,
21 const units::degree_t sourceAngle,
22 const frc::Pose2d destination,
23 const units::degree_t destAngle,
24 const frc::TrapezoidProfile<units::inches>::Constraints linearConstraints,
25 const frc::TrapezoidProfile<units::degrees>::Constraints rotationalConstraints,
26 const units::feet_per_second_t initialVelocity = 0_fps,
27 const units::feet_per_second_t finalVelocity = 0_fps);
28
29 void Initialize() override;
30
31 void Execute() override;
32
33 void End(bool interrupted) override;
34
35 bool IsFinished() override;
36
37 private:
39 const frc::Pose2d m_source;
40 const units::degree_t m_sourceAngle;
41 const frc::Pose2d m_destination;
42 const units::degree_t m_destAngle;
43 const frc::TrapezoidProfile<units::inches>::Constraints m_linearConstraints;
44 const frc::TrapezoidProfile<units::degrees>::Constraints m_rotationalConstraints;
45 const units::feet_per_second_t m_initialVelocity;
46 const units::feet_per_second_t m_finalVelocity;
47};
Definition drive_to_position.h:17
const frc::Pose2d m_source
Definition drive_to_position.h:39
const frc::TrapezoidProfile< units::degrees >::Constraints m_rotationalConstraints
Definition drive_to_position.h:44
const units::degree_t m_sourceAngle
Definition drive_to_position.h:40
const frc::TrapezoidProfile< units::inches >::Constraints m_linearConstraints
Definition drive_to_position.h:43
const units::degree_t m_destAngle
Definition drive_to_position.h:42
void End(bool interrupted) override
Definition drive_to_position.cpp:43
bool IsFinished() override
Definition drive_to_position.cpp:50
const units::feet_per_second_t m_initialVelocity
Definition drive_to_position.h:45
void Execute() override
Definition drive_to_position.cpp:38
void Initialize() override
Definition drive_to_position.cpp:31
SwerveDriveSubsystem * m_pDrive
Definition drive_to_position.h:38
const units::feet_per_second_t m_finalVelocity
Definition drive_to_position.h:46
const frc::Pose2d m_destination
Definition drive_to_position.h:41
Subsystem for controlling the swerve drivetrain of the robot.
Definition swerve_drive_subsystem.h:56