blob: 4d4a059413413d32514bb3c5b4c2d0dde2a9e1f2 [file] [log] [blame]
Austin Schuh085eab92020-11-26 13:54:51 -08001#!/usr/bin/python3
Comran Morshede9b12922015-11-04 19:46:48 +00002
Austin Schuhce7e03d2020-11-20 22:32:44 -08003from __future__ import print_function
Campbell Crowley8e8964a2017-12-29 15:56:29 -08004from frc971.control_loops.python import drivetrain
Comran Morshede9b12922015-11-04 19:46:48 +00005import sys
Comran Morshede9b12922015-11-04 19:46:48 +00006
Adam Snaider83eae562016-09-10 16:47:33 -07007import gflags
Campbell Crowley9c3ecfd2015-12-31 17:04:30 -08008import glog
Comran Morshede9b12922015-11-04 19:46:48 +00009
Adam Snaider83eae562016-09-10 16:47:33 -070010FLAGS = 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(J=1.8,
15 mass=37,
16 robot_radius=0.45 / 2.0,
17 wheel_radius=0.04445,
18 G_high=28.0 / 48.0 * 19.0 / 50.0,
19 G_low=28.0 / 60.0 * 19.0 / 50.0,
20 q_pos_low=0.12,
21 q_pos_high=0.14,
22 q_vel_low=1.0,
23 q_vel_high=0.95,
24 has_imu=False,
25 dt=0.005,
26 controller_poles=[0.83, 0.83])
27
Adam Snaider83eae562016-09-10 16:47:33 -070028
Comran Morshede9b12922015-11-04 19:46:48 +000029def main(argv):
Ravago Jones5127ccc2022-07-31 16:32:45 -070030 argv = FLAGS(argv)
31 glog.init()
Adam Snaider83eae562016-09-10 16:47:33 -070032
Ravago Jones5127ccc2022-07-31 16:32:45 -070033 if FLAGS.plot:
34 drivetrain.PlotDrivetrainMotions(kDrivetrain)
James Kuszmauleeb98e92024-01-14 22:15:32 -080035 elif len(argv) != 7:
36 print("Expected .h, .cc, and .json filenames")
Ravago Jones5127ccc2022-07-31 16:32:45 -070037 else:
38 # Write the generated constants out to a file.
James Kuszmauleeb98e92024-01-14 22:15:32 -080039 drivetrain.WriteDrivetrain(argv[1:4], argv[4:7], 'y2014_bot3',
Ravago Jones5127ccc2022-07-31 16:32:45 -070040 kDrivetrain)
41
Adam Snaider83eae562016-09-10 16:47:33 -070042
Comran Morshede9b12922015-11-04 19:46:48 +000043if __name__ == '__main__':
Ravago Jones5127ccc2022-07-31 16:32:45 -070044 sys.exit(main(sys.argv))