blob: 652fcf4cf37e550373c12a026c227e4e795669ac [file] [log] [blame]
Austin Schuh085eab92020-11-26 13:54:51 -08001#!/usr/bin/python3
Diana Vandenberg223703d2017-01-28 17:39:53 -08002
Austin Schuhce7e03d2020-11-20 22:32:44 -08003from __future__ import print_function
Campbell Crowley33e0e3d2017-12-27 17:55:40 -08004from frc971.control_loops.python import drivetrain
Diana Vandenberg223703d2017-01-28 17:39:53 -08005import sys
Diana Vandenberg223703d2017-01-28 17:39:53 -08006
7import gflags
8import glog
9
10FLAGS = gflags.FLAGS
11
12gflags.DEFINE_bool('plot', False, 'If true, plot the loop response.')
13
Austin Schuhecc92a02019-01-20 17:42:19 -080014kDrivetrain = drivetrain.DrivetrainParams(
15 J=6.0,
16 mass=52,
17 robot_radius=0.59055 / 2.0,
18 wheel_radius=0.08255 / 2.0,
19 G=11.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,
24 has_imu=False)
Diana Vandenberg223703d2017-01-28 17:39:53 -080025
26def main(argv):
Austin Schuhecc92a02019-01-20 17:42:19 -080027 argv = FLAGS(argv)
28 glog.init()
Diana Vandenberg223703d2017-01-28 17:39:53 -080029
Austin Schuhecc92a02019-01-20 17:42:19 -080030 if FLAGS.plot:
31 drivetrain.PlotDrivetrainMotions(kDrivetrain)
32 elif len(argv) != 5:
Austin Schuhce7e03d2020-11-20 22:32:44 -080033 print("Expected .h file name and .cc file name")
Austin Schuhecc92a02019-01-20 17:42:19 -080034 else:
35 # Write the generated constants out to a file.
36 drivetrain.WriteDrivetrain(argv[1:3], argv[3:5], 'y2017', kDrivetrain)
Diana Vandenberg223703d2017-01-28 17:39:53 -080037
38if __name__ == '__main__':
Austin Schuhecc92a02019-01-20 17:42:19 -080039 sys.exit(main(sys.argv))