blob: 14f8210f7a9b3904363dd0d470c52c72bedd40c7 [file] [log] [blame]
Austin Schuh085eab92020-11-26 13:54:51 -08001#!/usr/bin/python3
Comran Morshed9a9948c2016-01-16 15:58:04 +00002
Austin Schuhce7e03d2020-11-20 22:32:44 -08003from __future__ import print_function
Campbell Crowleyd86a2162017-12-28 16:04:43 -08004from frc971.control_loops.python import drivetrain
Comran Morshed9a9948c2016-01-16 15:58:04 +00005import sys
Comran Morshed9a9948c2016-01-16 15:58:04 +00006
7import gflags
8import glog
9
10FLAGS = gflags.FLAGS
11
12gflags.DEFINE_bool('plot', False, 'If true, plot the loop response.')
13
Ravago Jones5127ccc2022-07-31 16:32:45 -070014kDrivetrain = drivetrain.DrivetrainParams(
15 J=2.0,
16 mass=68,
17 robot_radius=0.601 / 2.0,
18 wheel_radius=0.097155 * 0.9811158901447808 / 118.0 * 115.75,
19 G_high=14.0 / 48.0 * 28.0 / 50.0 * 18.0 / 36.0,
20 G_low=14.0 / 48.0 * 18.0 / 60.0 * 18.0 / 36.0,
21 q_pos_low=0.12,
22 q_pos_high=0.14,
23 q_vel_low=1.0,
24 q_vel_high=0.95,
25 has_imu=False,
26 dt=0.005,
27 controller_poles=[0.67, 0.67])
28
Comran Morshed9a9948c2016-01-16 15:58:04 +000029
30def main(argv):
Ravago Jones5127ccc2022-07-31 16:32:45 -070031 argv = FLAGS(argv)
32 glog.init()
Comran Morshed9a9948c2016-01-16 15:58:04 +000033
Ravago Jones5127ccc2022-07-31 16:32:45 -070034 if FLAGS.plot:
35 drivetrain.PlotDrivetrainMotions(kDrivetrain)
James Kuszmauleeb98e92024-01-14 22:15:32 -080036 elif len(argv) != 7:
37 print("Expected .h, .cc, and .json filenames")
Ravago Jones5127ccc2022-07-31 16:32:45 -070038 else:
39 # Write the generated constants out to a file.
James Kuszmauleeb98e92024-01-14 22:15:32 -080040 drivetrain.WriteDrivetrain(argv[1:4], argv[4:7], 'y2016', kDrivetrain)
Ravago Jones5127ccc2022-07-31 16:32:45 -070041
Comran Morshed9a9948c2016-01-16 15:58:04 +000042
43if __name__ == '__main__':
Ravago Jones5127ccc2022-07-31 16:32:45 -070044 sys.exit(main(sys.argv))