blob: ed108eabba8cbe9c59f1580df54c3219225efe0a [file] [log] [blame]
Comran Morshed9a9948c2016-01-16 15:58:04 +00001#!/usr/bin/python
2
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
Campbell Crowleyd86a2162017-12-28 16:04:43 -080014kDrivetrain = drivetrain.DrivetrainParams(J = 2.0,
15 mass = 68,
16 robot_radius = 0.601 / 2.0,
17 wheel_radius = 0.097155 * 0.9811158901447808 / 118.0 * 115.75,
18 G_high = 14.0 / 48.0 * 28.0 / 50.0 * 18.0 / 36.0,
19 G_low = 14.0 / 48.0 * 18.0 / 60.0 * 18.0 / 36.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,
Diana Burgessd0180f12018-03-21 21:24:17 -070024 has_imu = False,
Campbell Crowleyd86a2162017-12-28 16:04:43 -080025 dt = 0.005,
26 controller_poles = [0.67, 0.67])
Comran Morshed9a9948c2016-01-16 15:58:04 +000027
28def main(argv):
29 argv = FLAGS(argv)
Austin Schuh289ee4f2016-02-05 00:20:52 -080030 glog.init()
Comran Morshed9a9948c2016-01-16 15:58:04 +000031
Comran Morshed9a9948c2016-01-16 15:58:04 +000032 if FLAGS.plot:
Campbell Crowleyd86a2162017-12-28 16:04:43 -080033 drivetrain.PlotDrivetrainMotions(kDrivetrain)
34 elif len(argv) != 5:
Austin Schuhce7e03d2020-11-20 22:32:44 -080035 print("Expected .h file name and .cc file name")
Comran Morshed9a9948c2016-01-16 15:58:04 +000036 else:
Campbell Crowleyd86a2162017-12-28 16:04:43 -080037 # Write the generated constants out to a file.
38 drivetrain.WriteDrivetrain(argv[1:3], argv[3:5], 'y2016', kDrivetrain)
Comran Morshed9a9948c2016-01-16 15:58:04 +000039
40if __name__ == '__main__':
41 sys.exit(main(sys.argv))