blob: 9d2b006105f32102700cabe15356a2f3c7a8827e [file] [log] [blame]
Maxwell Hendersonad312342023-01-10 12:07:47 -08001#!/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
15kDrivetrain = drivetrain.DrivetrainParams(
Austin Schuhe70cdeb2023-02-23 21:45:00 -080016 J=6.5,
Austin Schuhdd057bc2023-03-22 20:26:44 -070017 mass=68.0,
Maxwell Hendersonad312342023-01-10 12:07:47 -080018 # TODO(austin): Measure radius a bit better.
19 robot_radius=0.39,
20 wheel_radius=2.5 * 0.0254,
21 motor_type=control_loop.Falcon(),
22 num_motors=3,
Austin Schuhdd057bc2023-03-22 20:26:44 -070023 G=(14.0 / 52.0) * (26.0 / 58.0),
Maxwell Hendersonad312342023-01-10 12:07:47 -080024 q_pos=0.24,
25 q_vel=2.5,
Austin Schuhdd057bc2023-03-22 20:26:44 -070026 efficiency=0.92,
27 has_imu=False,
Maxwell Hendersonad312342023-01-10 12:07:47 -080028 force=True,
29 kf_q_voltage=1.0,
30 controller_poles=[0.82, 0.82])
31
32
33def main(argv):
34 argv = FLAGS(argv)
35 glog.init()
36
37 if FLAGS.plot:
38 drivetrain.PlotDrivetrainMotions(kDrivetrain)
39 elif len(argv) != 5:
40 print("Expected .h file name and .cc file name")
41 else:
42 # Write the generated constants out to a file.
43 drivetrain.WriteDrivetrain(argv[1:3], argv[3:5], 'y2023', kDrivetrain)
44
45
46if __name__ == '__main__':
47 sys.exit(main(sys.argv))