Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
turret_gimbal_config.hpp
Go to the documentation of this file.
1#pragma once
2
4
5namespace fang::robot
6{
7using namespace units::literals;
8
9static const trap::motor::DjiSpeedPid::Config kPitchPositionPid
10{
11 .kp = 50.0,
12 .ki = 0.0,
13 .kd = 0.0,
14 .maxICumulative = 0.0,
16 .tQDerivativeKalman = 1.0, //Cause value to be more "sluggish to reduce oscillation"
17 .tRDerivativeKalman = 0.0,
18 .tQProportionalKalman = 1.0,
19 .tRProportionalKalman = 500.0,
20 .errDeadzone = 0.17
21};
22
23static const trap::motor::DjiSpeedPid::Config kPitchVelocityPid
24{
25 .kp = 5'000,
26 .ki = 0,
27 .kd = 0.0,
28 .maxICumulative = 0,
30 .tQDerivativeKalman = 1.0, //Cause value to be more "sluggish to reduce oscillation"
31 .tRDerivativeKalman = 0.0,
32 .tQProportionalKalman = 1,
33 .tRProportionalKalman = 150'000.0,
34};
35
36static const trap::motor::DjiMotor::Config kPitchMotorConfig
37{
40 .name = "pitchMotor",
41 .inverted = true,
42 .currentControl = false
43};
44
45static const motor::DualCascadeGm6020::PidMotor::Config kPitchMotorPidConfig
46{
47
48 .mainPidConfig = kPitchPositionPid,
49 .intermediatePidConfig = kPitchVelocityPid,
50 .mainPidInitialValue = 0.0_rad,
51 .intermediatePidInitialValue = 0.0_rpm,
52};
53
54
55
56static const trap::motor::DjiSpeedPid::Config kYawPositionPid
57{
58 .kp = 80.0,
59 .ki = 0.0,
60 .kd = 0.0,
61 .maxICumulative = 0.0,
63 .tQDerivativeKalman = 1.0, //Cause value to be more "sluggish to reduce oscillation"
64 .tRDerivativeKalman = 0.0,
65 .tQProportionalKalman = 1,
66 .tRProportionalKalman = 100.0,
67};
68
69static const trap::motor::DjiSpeedPid::Config kYawVelocityPid
70{
71 .kp = 475,
72 .ki = 0,
73 .kd = 0.0,
74 .maxICumulative = 0,
76 .tQDerivativeKalman = 1.0, //Cause value to be more "sluggish to reduce oscillation"
77 .tRDerivativeKalman = 0.0,
78 .tQProportionalKalman = 1.0,
79 .tRProportionalKalman = 200.0,
80 .errorDerivativeFloor = 0 //rpm
81};
82
83static const turret::PierceFieldGimbal::YawSystem::Gm6020CounterChassisFieldYaw::ModdedCascadeMotor::Config kYawMotorPidConfig
84{
85 .mainPidConfig = kYawPositionPid,
86 .intermediatePidConfig = kYawVelocityPid
87};
88
89static const trap::motor::DjiGM6020::Config kYawMotorConfig
90{
93 .name = "yawMotor",
94 .inverted = false,
95 .currentControl = false
96};
97
98static const motor::DualCascadeGm6020::Config kDualCascadePitchMotorConfig
99{
100 .motorConfig = kPitchMotorConfig,
101 .pidMotorConfig = kPitchMotorPidConfig
102};
103
104static const turret::BasicFieldPitchSystem::Config kBasicFieldPitchConfig
105{
106 .pitchError = 0_deg,
107 .pitchRange = {
108 .min = -20_deg,
109 .max = 15_deg
110 }
111};
112
113static const turret::PierceFieldGimbal::PitchSystem::Config kPitchSystemConfig
114{
115 .motorConfig = kDualCascadePitchMotorConfig,
116 .pitchSystemConfig = kBasicFieldPitchConfig
117};
118
119static const turret::PierceFieldGimbal::YawSystem::Config kYawSystemConfig
120{
121 .motorConfig = kYawMotorConfig,
122 .fieldYawConfig =
123 {
124 .chassisFieldYawConfig = {.yawError = -37_deg},
125 .counterYawConfig = {.correctionScale = 1.0},
126 .moddedCascadeConfig = kYawMotorPidConfig
127 }
128};
129
130static const turret::PierceFieldGimbal::Config kGimbalSubsystemConfig
131{
132 .pitchSystemConfig = kPitchSystemConfig,
133 .yawSystemConfig = kYawSystemConfig
134};
135}
CascadeMotor::Config Config
Definition dual_cascade_position.hpp:39
static constexpr DjiMotorOutput kMaxOutput
Definition dji_gm6020.hpp:30
Definition base_robot.cpp:4
@ MOTOR1
Definition dji_motor_ids.hpp:39
@ MOTOR2
Definition dji_motor_ids.hpp:40
Motor::Config motorConfig
Definition dual_cascade_gm6020.hpp:28
Radians pitchError
Definition basic_field_pitch_system.hpp:30
Motor::Config motorConfig
Definition gm6020_cascade_field_pitch.hpp:15
Motor::Config motorConfig
Definition gm6020_counter_chassis_field_yaw.hpp:22
PitchSystem::Config pitchSystemConfig
Definition pierce_field_gimbal.hpp:19
Definition smooth_pid.hpp:36
float kp
Definition smooth_pid.hpp:37
Definition dji_motor.hpp:28
tap::motor::MotorId motorId
Definition dji_motor.hpp:29