blob: 01877d10e31953ce1094888f3be0fae55409b3c5 [file] [log] [blame]
Brian Silverman17f503e2015-08-02 18:17:18 -07001#!/usr/bin/python
2
Austin Schuhce7e03d2020-11-20 22:32:44 -08003from __future__ import print_function
Campbell Crowley73a86772017-12-29 15:17:33 -08004from frc971.control_loops.python import drivetrain
Brian Silverman17f503e2015-08-02 18:17:18 -07005import sys
Brian Silverman17f503e2015-08-02 18:17:18 -07006
Austin Schuhe456f152015-11-27 13:44:39 -08007import gflags
8import glog
9
10FLAGS = gflags.FLAGS
11
12gflags.DEFINE_bool('plot', False, 'If true, plot the loop response.')
Brian Silverman17f503e2015-08-02 18:17:18 -070013
Campbell Crowley73a86772017-12-29 15:17:33 -080014kDrivetrain = drivetrain.DrivetrainParams(J = 2.8,
15 mass = 68,
16 robot_radius = 0.647998644 / 2.0,
17 wheel_radius = .04445,
18 G_high = 28.0 / 50.0 * 18.0 / 50.0,
19 G_low = 18.0 / 60.0 * 18.0 / 50.0,
20 q_pos_low = 0.12,
21 q_pos_high = 0.12,
22 q_vel_low = 1.0,
23 q_vel_high = 1.0,
Diana Burgessd0180f12018-03-21 21:24:17 -070024 has_imu = False,
Campbell Crowley73a86772017-12-29 15:17:33 -080025 dt = 0.005,
26 controller_poles = [0.7, 0.7])
Austin Schuh572ff402015-11-08 12:17:50 -080027
Brian Silverman17f503e2015-08-02 18:17:18 -070028def main(argv):
Austin Schuhe456f152015-11-27 13:44:39 -080029 argv = FLAGS(argv)
Austin Schuh29659232015-11-26 13:55:30 -080030
Austin Schuhe456f152015-11-27 13:44:39 -080031 if FLAGS.plot:
Campbell Crowley73a86772017-12-29 15:17:33 -080032 drivetrain.PlotDrivetrainMotions(kDrivetrain)
33 elif len(argv) != 5:
Austin Schuhce7e03d2020-11-20 22:32:44 -080034 print("Expected .h file name and .cc file name")
Brian Silverman17f503e2015-08-02 18:17:18 -070035 else:
Campbell Crowley73a86772017-12-29 15:17:33 -080036 # Write the generated constants out to a file.
37 drivetrain.WriteDrivetrain(argv[1:3], argv[3:5], 'y2014', kDrivetrain)
Austin Schuh572ff402015-11-08 12:17:50 -080038
Brian Silverman17f503e2015-08-02 18:17:18 -070039if __name__ == '__main__':
40 sys.exit(main(sys.argv))