2023-Robot
Robot code for 2023 FRC season by Argos, FRC team #1756
Loading...
Searching...
No Matches
scoring_positions.h
Go to the documentation of this file.
1
4
5#pragma once
6
7#include <frc/geometry/Translation2d.h>
8
9#include <optional>
10
15
20
22
23 constexpr static auto visionScoringAlignOffset =
24 frc::Translation2d{0_in, 0_in};
25 constexpr static auto visionScoringPlacementOffset =
26 frc::Translation2d{5_in, 0_in};
27
28 namespace lifter_extension_end {
30 constexpr static auto floppyConeOffset = frc::Translation2d(0_in, 1.5_in);
31
32 constexpr static SetpointPosition coneLow(frc::Translation2d(24.5_in, 19_in), BashGuardPosition::Retracted);
33 constexpr static SetpointPosition coneLow_wristInverted(frc::Translation2d(24.5_in, 19_in),
35 constexpr static SetpointPosition coneMid(frc::Translation2d(36.0_in, 44.5_in), BashGuardPosition::Retracted);
36 constexpr static SetpointPosition coneMid_wristInverted(frc::Translation2d(34_in, 44.5_in),
38 constexpr static SetpointPosition coneHigh(frc::Translation2d(53_in, 55.5_in), BashGuardPosition::Retracted);
39 constexpr static SetpointPosition coneHigh_wristInverted(frc::Translation2d(51_in, 55_in),
41 constexpr static SetpointPosition cubeLow(frc::Translation2d(20.5_in, 23_in), BashGuardPosition::Retracted);
42 constexpr static SetpointPosition cubeLow_wristInverted(frc::Translation2d(20.5_in, 23_in),
44 constexpr static SetpointPosition cubeMid(frc::Translation2d(33_in, 37_in), BashGuardPosition::Retracted);
45 constexpr static SetpointPosition cubeMid_wristInverted(frc::Translation2d(33_in, 37_in),
47 constexpr static SetpointPosition cubeHigh(frc::Translation2d(48.5_in, 49_in), BashGuardPosition::Retracted);
48 constexpr static SetpointPosition cubeHigh_wristInverted(frc::Translation2d(48.5_in, 49_in),
50 constexpr static SetpointPosition coneIntake(frc::Translation2d(31.5_in, 13.25_in), BashGuardPosition::Deployed);
51 constexpr static SetpointPosition cubeIntake(frc::Translation2d(31.5_in, 14.75_in), BashGuardPosition::Deployed);
52 constexpr static SetpointPosition stow(frc::Translation2d(10.5_in, 19.5_in), BashGuardPosition::Retracted);
53 } // namespace lifter_extension_end
54
55} // namespace scoring_positions
56
57constexpr std::optional<SetpointPosition> GetTargetPosition(ScoringPosition gridPosition,
58 bool enableBashGuard,
59 WristPosition wristPosition) {
60 bool wristInverted = wristPosition == WristPosition::RollersDown;
61 SetpointPosition targetPosition;
62 if (gridPosition.column == ScoringColumn::coneIntake) {
64 } else if (gridPosition.column == ScoringColumn::cubeIntake) {
66 } else if (gridPosition.column == ScoringColumn::stow) {
68 } else if (gridPosition.column == ScoringColumn::leftGrid_leftCone ||
74 if (gridPosition.row == ScoringRow::low) {
77 } else if (gridPosition.row == ScoringRow::middle) {
80 } else if (gridPosition.row == ScoringRow::high) {
83 } else {
84 return std::nullopt;
85 }
86 if (gridPosition.column == ScoringColumn::rightGrid_leftCone) {
87 targetPosition.lifterPosition =
89 }
90 } else if (gridPosition.column == ScoringColumn::leftGrid_middleCube ||
93 if (gridPosition.row == ScoringRow::low) {
96 } else if (gridPosition.row == ScoringRow::middle) {
99 } else if (gridPosition.row == ScoringRow::high) {
102 } else {
103 return std::nullopt;
104 }
105 } else {
106 return std::nullopt;
107 }
108
109 return SetpointPosition{targetPosition.lifterPosition,
110 enableBashGuard ? targetPosition.bashGuardPosition : BashGuardPosition::Stationary};
111}
BashGuardPosition
Definition bash_guard_subsystem.h:12
WristPosition
Definition lifter_subsystem.h:22
constexpr units::inch_t length
Definition measure_up.h:20
constexpr auto bumperExtension
Distance from frame to outer edge of bumpers.
Definition measure_up.h:17
static constexpr SetpointPosition coneIntake(frc::Translation2d(31.5_in, 13.25_in), BashGuardPosition::Deployed)
static constexpr SetpointPosition coneMid_wristInverted(frc::Translation2d(34_in, 44.5_in), BashGuardPosition::Retracted)
static constexpr SetpointPosition cubeIntake(frc::Translation2d(31.5_in, 14.75_in), BashGuardPosition::Deployed)
static constexpr SetpointPosition cubeLow_wristInverted(frc::Translation2d(20.5_in, 23_in), BashGuardPosition::Retracted)
static constexpr SetpointPosition cubeLow(frc::Translation2d(20.5_in, 23_in), BashGuardPosition::Retracted)
static constexpr SetpointPosition stow(frc::Translation2d(10.5_in, 19.5_in), BashGuardPosition::Retracted)
static constexpr SetpointPosition cubeHigh(frc::Translation2d(48.5_in, 49_in), BashGuardPosition::Retracted)
static constexpr SetpointPosition cubeHigh_wristInverted(frc::Translation2d(48.5_in, 49_in), BashGuardPosition::Retracted)
static constexpr units::inch_t robotPlacingOffsetX
Definition scoring_positions.h:29
static constexpr SetpointPosition coneHigh(frc::Translation2d(53_in, 55.5_in), BashGuardPosition::Retracted)
static constexpr SetpointPosition coneHigh_wristInverted(frc::Translation2d(51_in, 55_in), BashGuardPosition::Retracted)
static constexpr SetpointPosition coneLow_wristInverted(frc::Translation2d(24.5_in, 19_in), BashGuardPosition::Retracted)
static constexpr SetpointPosition coneMid(frc::Translation2d(36.0_in, 44.5_in), BashGuardPosition::Retracted)
static constexpr auto floppyConeOffset
Definition scoring_positions.h:30
static constexpr SetpointPosition coneLow(frc::Translation2d(24.5_in, 19_in), BashGuardPosition::Retracted)
static constexpr SetpointPosition cubeMid_wristInverted(frc::Translation2d(33_in, 37_in), BashGuardPosition::Retracted)
static constexpr SetpointPosition cubeMid(frc::Translation2d(33_in, 37_in), BashGuardPosition::Retracted)
Definition scoring_positions.h:21
static constexpr auto visionScoringAlignOffset
Definition scoring_positions.h:23
static constexpr auto visionScoringPlacementOffset
Definition scoring_positions.h:25
constexpr std::optional< SetpointPosition > GetTargetPosition(ScoringPosition gridPosition, bool enableBashGuard, WristPosition wristPosition)
Definition scoring_positions.h:57
Definition field_points.h:37
ScoringColumn column
Definition field_points.h:38
ScoringRow row
Definition field_points.h:39
Definition scoring_positions.h:16
frc::Translation2d lifterPosition
Definition scoring_positions.h:17
BashGuardPosition bashGuardPosition
Definition scoring_positions.h:18