blob: b4635ee44e9d17e06a984a035c07377f11d7d11f [file] [log] [blame]
Diana Vandenberg223703d2017-01-28 17:39:53 -08001#!/usr/bin/python
2
Campbell Crowley33e0e3d2017-12-27 17:55:40 -08003from frc971.control_loops.python import drivetrain
Diana Vandenberg223703d2017-01-28 17:39:53 -08004import sys
Diana Vandenberg223703d2017-01-28 17:39:53 -08005
6import gflags
7import glog
8
9FLAGS = gflags.FLAGS
10
11gflags.DEFINE_bool('plot', False, 'If true, plot the loop response.')
12
Campbell Crowley33e0e3d2017-12-27 17:55:40 -080013kDrivetrain = drivetrain.DrivetrainParams(J = 6.0,
14 mass = 52,
15 robot_radius = 0.59055 / 2.0,
16 wheel_radius = 0.08255 / 2.0,
17 G_high = 11.0 / 60.0,
18 G_low = 11.0 / 60.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 Vandenberg223703d2017-01-28 17:39:53 -080023
24def main(argv):
25 argv = FLAGS(argv)
26 glog.init()
27
Diana Vandenberg223703d2017-01-28 17:39:53 -080028 if FLAGS.plot:
Campbell Crowley33e0e3d2017-12-27 17:55:40 -080029 drivetrain.PlotDrivetrainMotions(kDrivetrain)
30 elif len(argv) != 5:
Diana Vandenberg223703d2017-01-28 17:39:53 -080031 print "Expected .h file name and .cc file name"
32 else:
Campbell Crowley33e0e3d2017-12-27 17:55:40 -080033 # Write the generated constants out to a file.
34 drivetrain.WriteDrivetrain(argv[1:3], argv[3:5], 'y2017', kDrivetrain)
Diana Vandenberg223703d2017-01-28 17:39:53 -080035
36if __name__ == '__main__':
37 sys.exit(main(sys.argv))