blob: 919ce82eb165f02e0bcde178d451b1504aed64f7 [file] [log] [blame]
Brian Silvermanc71537c2016-01-01 13:43:14 -08001#!/usr/bin/python
2
Campbell Crowley97963f62017-12-29 15:42:58 -08003from frc971.control_loops.python import drivetrain
Brian Silvermanc71537c2016-01-01 13:43:14 -08004import sys
Brian Silvermanc71537c2016-01-01 13:43:14 -08005
6import gflags
7import glog
8
9FLAGS = gflags.FLAGS
10
11gflags.DEFINE_bool('plot', False, 'If true, plot the loop response.')
12
Campbell Crowley97963f62017-12-29 15:42:58 -080013kDrivetrain = drivetrain.DrivetrainParams(J = 1.5,
14 mass = 30,
15 robot_radius = 0.647998644 / 2.0,
16 wheel_radius = .04445,
17 G_high = 30.0 / 45.0 * 15.0 / 50.0,
18 G_low = 15.0 / 60.0 * 15.0 / 50.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,
23 dt = 0.005,
24 controller_poles = [0.8, 0.8])
Brian Silvermanc71537c2016-01-01 13:43:14 -080025
26def main(argv):
27 argv = FLAGS(argv)
Austin Schuh2a671df2016-11-26 15:00:06 -080028 glog.init()
Brian Silvermanc71537c2016-01-01 13:43:14 -080029
Brian Silvermanc71537c2016-01-01 13:43:14 -080030 if FLAGS.plot:
Campbell Crowley97963f62017-12-29 15:42:58 -080031 drivetrain.PlotDrivetrainMotions(kDrivetrain)
32 elif len(argv) != 5:
Brian Silvermanc71537c2016-01-01 13:43:14 -080033 print "Expected .h file name and .cc file name"
34 else:
Campbell Crowley97963f62017-12-29 15:42:58 -080035 # Write the generated constants out to a file.
36 drivetrain.WriteDrivetrain(argv[1:3], argv[3:5], 'y2012', kDrivetrain)
Brian Silvermanc71537c2016-01-01 13:43:14 -080037
38if __name__ == '__main__':
39 sys.exit(main(sys.argv))