blob: 41fbd271a6aa2c921e98ea3049c01982a350bf58 [file] [log] [blame]
Austin Schuh085eab92020-11-26 13:54:51 -08001#!/usr/bin/python3
Brian Silverman17f503e2015-08-02 18:17:18 -07002
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
Ravago Jones5127ccc2022-07-31 16:32:45 -070014kDrivetrain = 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,
24 has_imu=False,
25 dt=0.005,
26 controller_poles=[0.7, 0.7])
27
Austin Schuh572ff402015-11-08 12:17:50 -080028
Brian Silverman17f503e2015-08-02 18:17:18 -070029def main(argv):
Ravago Jones5127ccc2022-07-31 16:32:45 -070030 argv = FLAGS(argv)
Austin Schuh29659232015-11-26 13:55:30 -080031
Ravago Jones5127ccc2022-07-31 16:32:45 -070032 if FLAGS.plot:
33 drivetrain.PlotDrivetrainMotions(kDrivetrain)
James Kuszmauleeb98e92024-01-14 22:15:32 -080034 elif len(argv) != 7:
35 print("Expected .h, .cc, and .json filenames")
Ravago Jones5127ccc2022-07-31 16:32:45 -070036 else:
37 # Write the generated constants out to a file.
James Kuszmauleeb98e92024-01-14 22:15:32 -080038 drivetrain.WriteDrivetrain(argv[1:4], argv[4:7], 'y2014', kDrivetrain)
Ravago Jones5127ccc2022-07-31 16:32:45 -070039
Austin Schuh572ff402015-11-08 12:17:50 -080040
Brian Silverman17f503e2015-08-02 18:17:18 -070041if __name__ == '__main__':
Ravago Jones5127ccc2022-07-31 16:32:45 -070042 sys.exit(main(sys.argv))