blob: 6b5ea65cbcd312fe19505bef905f6db6f9e62b6e [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,
23 q_vel_high = 0.95)
Sabina Davis5ae0c7c2017-10-21 20:51:55 -070024
25def main(argv):
26 argv = FLAGS(argv)
27 glog.init()
28
Sabina Davis5ae0c7c2017-10-21 20:51:55 -070029 if FLAGS.plot:
Campbell Crowley0160eef2017-12-28 16:58:39 -080030 drivetrain.PlotDrivetrainMotions(kDrivetrain)
31 elif len(argv) != 5:
Sabina Davis5ae0c7c2017-10-21 20:51:55 -070032 print "Expected .h file name and .cc file name"
33 else:
Campbell Crowley0160eef2017-12-28 16:58:39 -080034 # Write the generated constants out to a file.
35 drivetrain.WriteDrivetrain(argv[1:3], argv[3:5], 'y2017_bot3', kDrivetrain)
Sabina Davis5ae0c7c2017-10-21 20:51:55 -070036
37if __name__ == '__main__':
38 sys.exit(main(sys.argv))