blob: 7417ffbe5a2370193f27c82c39eff9a5c3d616d4 [file] [log] [blame]
Comran Morshed9a9948c2016-01-16 15:58:04 +00001#!/usr/bin/python
2
Campbell Crowleyd86a2162017-12-28 16:04:43 -08003from frc971.control_loops.python import drivetrain
Comran Morshed9a9948c2016-01-16 15:58:04 +00004import sys
Comran Morshed9a9948c2016-01-16 15:58:04 +00005
6import gflags
7import glog
8
9FLAGS = gflags.FLAGS
10
11gflags.DEFINE_bool('plot', False, 'If true, plot the loop response.')
12
Campbell Crowleyd86a2162017-12-28 16:04:43 -080013kDrivetrain = drivetrain.DrivetrainParams(J = 2.0,
14 mass = 68,
15 robot_radius = 0.601 / 2.0,
16 wheel_radius = 0.097155 * 0.9811158901447808 / 118.0 * 115.75,
17 G_high = 14.0 / 48.0 * 28.0 / 50.0 * 18.0 / 36.0,
18 G_low = 14.0 / 48.0 * 18.0 / 60.0 * 18.0 / 36.0,
19 q_pos_low = 0.12,
20 q_pos_high = 0.14,
21 q_vel_low = 1.0,
22 q_vel_high = 0.95,
Diana Burgessd0180f12018-03-21 21:24:17 -070023 has_imu = False,
Campbell Crowleyd86a2162017-12-28 16:04:43 -080024 dt = 0.005,
25 controller_poles = [0.67, 0.67])
Comran Morshed9a9948c2016-01-16 15:58:04 +000026
27def main(argv):
28 argv = FLAGS(argv)
Austin Schuh289ee4f2016-02-05 00:20:52 -080029 glog.init()
Comran Morshed9a9948c2016-01-16 15:58:04 +000030
Comran Morshed9a9948c2016-01-16 15:58:04 +000031 if FLAGS.plot:
Campbell Crowleyd86a2162017-12-28 16:04:43 -080032 drivetrain.PlotDrivetrainMotions(kDrivetrain)
33 elif len(argv) != 5:
Comran Morshed9a9948c2016-01-16 15:58:04 +000034 print "Expected .h file name and .cc file name"
35 else:
Campbell Crowleyd86a2162017-12-28 16:04:43 -080036 # Write the generated constants out to a file.
37 drivetrain.WriteDrivetrain(argv[1:3], argv[3:5], 'y2016', kDrivetrain)
Comran Morshed9a9948c2016-01-16 15:58:04 +000038
39if __name__ == '__main__':
40 sys.exit(main(sys.argv))