blob: 3d4469ba621a82ce3e2c59dcf87d93f98ca6b8c6 [file] [log] [blame]
Ariv Diggi0af59c02023-10-07 13:15:39 -07001#!/usr/bin/python3
2
3from __future__ import print_function
4from frc971.control_loops.python import drivetrain
5from frc971.control_loops.python import control_loop
6import sys
7
8import gflags
9import glog
10
11FLAGS = gflags.FLAGS
12
13gflags.DEFINE_bool('plot', False, 'If true, plot the loop response.')
14
15# TODO(max): Change constants based on robot / CAD
16kDrivetrain = drivetrain.DrivetrainParams(
17 J=6.5,
18 mass=68.0,
19 # TODO(austin): Measure radius a bit better.
20 robot_radius=0.39,
21 wheel_radius=2.5 * 0.0254,
22 motor_type=control_loop.Falcon(),
23 num_motors=3,
24 G=(14.0 / 52.0) * (26.0 / 58.0),
25 q_pos=0.24,
26 q_vel=2.5,
27 efficiency=0.92,
28 has_imu=False,
29 force=True,
30 kf_q_voltage=1.0,
31 controller_poles=[0.82, 0.82])
32
33
34def main(argv):
35 argv = FLAGS(argv)
36 glog.init()
37
38 if FLAGS.plot:
39 drivetrain.PlotDrivetrainMotions(kDrivetrain)
40 elif len(argv) != 5:
41 print("Expected .h file name and .cc file name")
42 else:
43 # Write the generated constants out to a file.
44 drivetrain.WriteDrivetrain(argv[1:3], argv[3:5], 'y2023_bot3',
45 kDrivetrain)
46
47
48if __name__ == '__main__':
49 sys.exit(main(sys.argv))