blob: 6ae809e83de487faf880e61a00f2cfc8a03d1d3d [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,
Diana Burgessd0180f12018-03-21 21:24:17 -070023 has_imu = False,
Campbell Crowley97963f62017-12-29 15:42:58 -080024 dt = 0.005,
25 controller_poles = [0.8, 0.8])
Brian Silvermanc71537c2016-01-01 13:43:14 -080026
27def main(argv):
28 argv = FLAGS(argv)
Austin Schuh2a671df2016-11-26 15:00:06 -080029 glog.init()
Brian Silvermanc71537c2016-01-01 13:43:14 -080030
Brian Silvermanc71537c2016-01-01 13:43:14 -080031 if FLAGS.plot:
Campbell Crowley97963f62017-12-29 15:42:58 -080032 drivetrain.PlotDrivetrainMotions(kDrivetrain)
33 elif len(argv) != 5:
Brian Silvermanc71537c2016-01-01 13:43:14 -080034 print "Expected .h file name and .cc file name"
35 else:
Campbell Crowley97963f62017-12-29 15:42:58 -080036 # Write the generated constants out to a file.
37 drivetrain.WriteDrivetrain(argv[1:3], argv[3:5], 'y2012', kDrivetrain)
Brian Silvermanc71537c2016-01-01 13:43:14 -080038
39if __name__ == '__main__':
40 sys.exit(main(sys.argv))