blob: 67134f5d88fda01b58157b40c3d5132c2b661cc9 [file] [log] [blame]
Alex Perrycb7da4b2019-08-28 19:35:56 -07001include "frc971/control_loops/control_loops.fbs";
2
3namespace frc971.control_loops.drivetrain;
4
5// For logging information about what the code is doing with the shifters.
6table GearLogging {
7 // Which controller is being used.
8 controller_index:byte;
9
10 // Whether each loop for the drivetrain sides is the high-gear one.
11 left_loop_high:bool;
12 right_loop_high:bool;
13
14 // The states of each drivetrain shifter.
15 left_state:byte;
16 right_state:byte;
17}
18
19// For logging information about the state of the shifters.
20table CIMLogging {
21 // Whether the code thinks each drivetrain side is currently in gear.
22 left_in_gear:bool;
23 right_in_gear:bool;
24
25 // The angular velocities (in rad/s, positive forward) the code thinks motors
26 // on each side of the drivetrain are moving at.
27 left_motor_speed:double;
28 right_motor_speed:double;
29
30 // The velocity estimates for each drivetrain side of the robot (in m/s,
31 // positive forward) that can be used for shifting.
32 left_velocity:double;
33 right_velocity:double;
34}
35
36enum PlanningState : byte {
37 NO_PLAN,
38 BUILDING_TRAJECTORY,
39 PLANNING_TRAJECTORY,
40 PLANNED,
41}
42
43// For logging information about the state of the trajectory planning.
44table TrajectoryLogging {
45 // state of planning the trajectory.
46 planning_state:PlanningState;
47
48 // State of the spline execution.
49 is_executing:bool;
50 // Whether we have finished the spline specified by current_spline_idx.
51 is_executed:bool;
52
53 // The handle of the goal spline. 0 means stop requested.
54 goal_spline_handle:int;
55 // Handle of the executing spline. -1 means none requested. If there was no
56 // spline executing when a spline finished optimizing, it will become the
57 // current spline even if we aren't ready to start yet.
58 current_spline_idx:int;
59 // Handle of the spline that is being optimized and staged.
60 planning_spline_idx:int;
61
62 // Expected position and velocity on the spline
63 x:float;
64 y:float;
65 theta:float;
66 left_velocity:float;
67 right_velocity:float;
68 distance_remaining:float;
69}
70
71// For logging state of the line follower.
72table LineFollowLogging {
73 // Whether we are currently freezing target choice.
74 frozen:bool;
75 // Whether we currently have a target.
76 have_target:bool;
77 // Absolute position of the current goal.
78 x:float;
79 y:float;
80 theta:float;
81 // Current lateral offset from line pointing straight out of the target.
82 offset:float;
83 // Current distance from the plane of the target, in meters.
84 distance_to_target:float;
85 // Current goal heading.
86 goal_theta:float;
87 // Current relative heading.
88 rel_theta:float;
89}
90
91table Status {
92 // Estimated speed of the center of the robot in m/s (positive forwards).
93 robot_speed:double;
94
95 // Estimated relative position of each drivetrain side (in meters).
96 estimated_left_position:double;
97 estimated_right_position:double;
98
99 // Estimated velocity of each drivetrain side (in m/s).
100 estimated_left_velocity:double;
101 estimated_right_velocity:double;
102
103 // The voltage we wanted to send to each drivetrain side last cycle.
104 uncapped_left_voltage:double;
105 uncapped_right_voltage:double;
106
107 // The voltage error for the left and right sides.
108 left_voltage_error:double;
109 right_voltage_error:double;
110
111 // The profiled goal states.
112 profiled_left_position_goal:double;
113 profiled_right_position_goal:double;
114 profiled_left_velocity_goal:double;
115 profiled_right_velocity_goal:double;
116
117 // The KF offset
118 estimated_angular_velocity_error:double;
119 // The KF estimated heading.
120 estimated_heading:double;
121
122 // xytheta of the robot.
123 x:double;
124 y:double;
125 theta:double;
126
127 // True if the output voltage was capped last cycle.
128 output_was_capped:bool;
129
130 // The angle of the robot relative to the ground.
131 ground_angle:double;
132
133 // Information about shifting logic and curent gear, for logging purposes
134 gear_logging:GearLogging;
135 cim_logging:CIMLogging;
136 trajectory_logging:TrajectoryLogging;
137 line_follow_logging:LineFollowLogging;
138}
139
140root_type Status;