blob: 7e672e31cf36090c50a44ca133db6ac19b366aaa [file] [log] [blame]
Brian Silvermanc71537c2016-01-01 13:43:14 -08001#!/usr/bin/python
2
Austin Schuhce7e03d2020-11-20 22:32:44 -08003from __future__ import print_function
Campbell Crowley97963f62017-12-29 15:42:58 -08004from frc971.control_loops.python import drivetrain
Brian Silvermanc71537c2016-01-01 13:43:14 -08005import sys
Brian Silvermanc71537c2016-01-01 13:43:14 -08006
7import gflags
8import glog
9
10FLAGS = gflags.FLAGS
11
12gflags.DEFINE_bool('plot', False, 'If true, plot the loop response.')
13
Campbell Crowley97963f62017-12-29 15:42:58 -080014kDrivetrain = drivetrain.DrivetrainParams(J = 1.5,
15 mass = 30,
16 robot_radius = 0.647998644 / 2.0,
17 wheel_radius = .04445,
18 G_high = 30.0 / 45.0 * 15.0 / 50.0,
19 G_low = 15.0 / 60.0 * 15.0 / 50.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,
Diana Burgessd0180f12018-03-21 21:24:17 -070024 has_imu = False,
Campbell Crowley97963f62017-12-29 15:42:58 -080025 dt = 0.005,
26 controller_poles = [0.8, 0.8])
Brian Silvermanc71537c2016-01-01 13:43:14 -080027
28def main(argv):
29 argv = FLAGS(argv)
Austin Schuh2a671df2016-11-26 15:00:06 -080030 glog.init()
Brian Silvermanc71537c2016-01-01 13:43:14 -080031
Brian Silvermanc71537c2016-01-01 13:43:14 -080032 if FLAGS.plot:
Campbell Crowley97963f62017-12-29 15:42:58 -080033 drivetrain.PlotDrivetrainMotions(kDrivetrain)
34 elif len(argv) != 5:
Austin Schuhce7e03d2020-11-20 22:32:44 -080035 print("Expected .h file name and .cc file name")
Brian Silvermanc71537c2016-01-01 13:43:14 -080036 else:
Campbell Crowley97963f62017-12-29 15:42:58 -080037 # Write the generated constants out to a file.
38 drivetrain.WriteDrivetrain(argv[1:3], argv[3:5], 'y2012', kDrivetrain)
Brian Silvermanc71537c2016-01-01 13:43:14 -080039
40if __name__ == '__main__':
41 sys.exit(main(sys.argv))