blob: 0272232b3d9fd1331de0d8dfdfb57b161ab9e98b [file] [log] [blame]
Sabina Davis5ae0c7c2017-10-21 20:51:55 -07001#!/usr/bin/python
2
Campbell Crowley0160eef2017-12-28 16:58:39 -08003from frc971.control_loops.python import drivetrain
Sabina Davis5ae0c7c2017-10-21 20:51:55 -07004import sys
Sabina Davis5ae0c7c2017-10-21 20:51:55 -07005
6import gflags
7import glog
8
9FLAGS = gflags.FLAGS
10
11gflags.DEFINE_bool('plot', False, 'If true, plot the loop response.')
12
Campbell Crowley0160eef2017-12-28 16:58:39 -080013#TODO(Neil): Update robot moment of inertia, mass, and robot radius
14kDrivetrain = drivetrain.DrivetrainParams(J = 6.0,
15 mass = 52,
16 robot_radius = 0.59055 / 2.0,
17 wheel_radius = 4 * 0.0254 / 2,
18 G_high = 14.0 / 40.0 * 34.0 / 50.0 * 52.0 / 60.0,
19 G_low = 14.0 / 40.0 * 24.0 / 60.0 * 52.0 / 60.0,
20 q_pos_low = 0.12,
21 q_pos_high = 0.14,
22 q_vel_low = 1.0,
Diana Burgessd0180f12018-03-21 21:24:17 -070023 q_vel_high = 0.95,
24 has_imu = False)
Sabina Davis5ae0c7c2017-10-21 20:51:55 -070025
26def main(argv):
27 argv = FLAGS(argv)
28 glog.init()
29
Sabina Davis5ae0c7c2017-10-21 20:51:55 -070030 if FLAGS.plot:
Campbell Crowley0160eef2017-12-28 16:58:39 -080031 drivetrain.PlotDrivetrainMotions(kDrivetrain)
32 elif len(argv) != 5:
Sabina Davis5ae0c7c2017-10-21 20:51:55 -070033 print "Expected .h file name and .cc file name"
34 else:
Campbell Crowley0160eef2017-12-28 16:58:39 -080035 # Write the generated constants out to a file.
36 drivetrain.WriteDrivetrain(argv[1:3], argv[3:5], 'y2017_bot3', kDrivetrain)
Sabina Davis5ae0c7c2017-10-21 20:51:55 -070037
38if __name__ == '__main__':
39 sys.exit(main(sys.argv))