2023-Robot
Robot code for 2023 FRC season by Argos, FRC team #1756
Loading...
Searching...
No Matches
lifter_kinematics.h
Go to the documentation of this file.
1
4
5#pragma once
6#include <frc/geometry/Transform2d.h>
7#include <frc/geometry/Translation2d.h>
8#include <units/angle.h>
9#include <units/angular_velocity.h>
10#include <units/length.h>
11
12#include "utils/custom_units.h"
13
14struct ArmState {
15 units::meter_t armLen;
16 units::radian_t shoulderAngle;
17};
18
20 public:
27 LifterKinematics(const frc::Translation2d& fulcrumPosition,
28 const units::meter_t armRotationOffset,
29 const frc::Translation2d& effectorOffset,
30 const frc::Translation2d& fixedBoomActuatorPosition,
31 const frc::Translation2d& actuatedBoomActuatorPosition);
32
33 LifterKinematics() = delete;
34
39 ArmState GetJointsFromEffector(const frc::Translation2d& pose, bool effectorInverted) const;
40
41 ArmState GetJoints(const frc::Translation2d& pose) const;
42
47 frc::Translation2d GetEffectorPose(const ArmState& state, bool effectorInverted) const;
48
49 frc::Translation2d GetPose(const ArmState& state) const;
50
51 units::inch_t ShoulderAngleToBoomExtension(units::degree_t shoulderAngle) const;
52 units::degree_t BoomExtensionToShoulderAngle(units::inch_t boomExtension) const;
53 units::velocity::inches_per_second_t ShoulderVelocityToBoomVelocity(units::radians_per_second_t shoulderVelocity,
54 units::degree_t shoulderAngle) const;
55 units::radians_per_second_t BoomVelocityToShoulderVelocity(units::velocity::inches_per_second_t boomVelocity,
56 units::inch_t boomPosition) const;
57
58 private:
59 const frc::Translation2d m_fulcrumPosition;
60 const units::meter_t
62 const frc::Translation2d
64
65 const units::inch_t m_fixedBoomAnchorToFulcrumDist;
66 const units::degree_t m_fixedBoomAnchorToFulcrumAngle;
69
70 ArmState GetJoints(const frc::Translation2d& pose, const frc::Translation2d& effectorOffset) const;
71 frc::Translation2d GetPose(const ArmState& state, const frc::Translation2d& effectorOffset) const;
72};
Definition lifter_kinematics.h:19
ArmState GetJointsFromEffector(const frc::Translation2d &pose, bool effectorInverted) const
Solves for the lifter joint from a desired effector state.
Definition lifter_kinematics.cpp:39
LifterKinematics()=delete
ArmState GetJoints(const frc::Translation2d &pose) const
Definition lifter_kinematics.cpp:57
frc::Translation2d GetEffectorPose(const ArmState &state, bool effectorInverted) const
Solves for effector position based off of the lifter state.
Definition lifter_kinematics.cpp:61
units::inch_t ShoulderAngleToBoomExtension(units::degree_t shoulderAngle) const
Definition lifter_kinematics.cpp:84
const units::inch_t m_articulatedBoomAnchorToFulcrumDist
Definition lifter_kinematics.h:67
const units::degree_t m_articulatedBoomAnchorToFulcrumAngle
Definition lifter_kinematics.h:68
units::degree_t BoomExtensionToShoulderAngle(units::inch_t boomExtension) const
Definition lifter_kinematics.cpp:91
const frc::Translation2d m_effectorOffset
End effector offset from measure up point at end of arm. y is actually z. Measured when arm is at 0 d...
Definition lifter_kinematics.h:63
const units::inch_t m_fixedBoomAnchorToFulcrumDist
Definition lifter_kinematics.h:65
const units::degree_t m_fixedBoomAnchorToFulcrumAngle
Definition lifter_kinematics.h:66
const units::meter_t m_armRotationOffset
Offset from center of lifter rotation axis to measure up point at end of arm in radial direction.
Definition lifter_kinematics.h:61
units::velocity::inches_per_second_t ShoulderVelocityToBoomVelocity(units::radians_per_second_t shoulderVelocity, units::degree_t shoulderAngle) const
Definition lifter_kinematics.cpp:98
const frc::Translation2d m_fulcrumPosition
Fulcrum position in robot coordinate space (y is actually z)
Definition lifter_kinematics.h:59
frc::Translation2d GetPose(const ArmState &state) const
Definition lifter_kinematics.cpp:68
units::radians_per_second_t BoomVelocityToShoulderVelocity(units::velocity::inches_per_second_t boomVelocity, units::inch_t boomPosition) const
Definition lifter_kinematics.cpp:113
Definition lifter_kinematics.h:14
units::meter_t armLen
Definition lifter_kinematics.h:15
units::radian_t shoulderAngle
Definition lifter_kinematics.h:16