blob: 74b114d1624f134452ebcc4c57ca3e0808ed5525 [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,
Diana Burgessd0180f12018-03-21 21:24:17 -070022 q_vel_high = 0.95,
23 has_imu = False)
Diana Vandenberg223703d2017-01-28 17:39:53 -080024
25def main(argv):
26 argv = FLAGS(argv)
27 glog.init()
28
Diana Vandenberg223703d2017-01-28 17:39:53 -080029 if FLAGS.plot:
Campbell Crowley33e0e3d2017-12-27 17:55:40 -080030 drivetrain.PlotDrivetrainMotions(kDrivetrain)
31 elif len(argv) != 5:
Diana Vandenberg223703d2017-01-28 17:39:53 -080032 print "Expected .h file name and .cc file name"
33 else:
Campbell Crowley33e0e3d2017-12-27 17:55:40 -080034 # Write the generated constants out to a file.
35 drivetrain.WriteDrivetrain(argv[1:3], argv[3:5], 'y2017', kDrivetrain)
Diana Vandenberg223703d2017-01-28 17:39:53 -080036
37if __name__ == '__main__':
38 sys.exit(main(sys.argv))