blob: b5d05e0770d646b3383badf8ebb6771077a6a648 [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
Ravago Jones5127ccc2022-07-31 16:32:45 -070014kDrivetrain = drivetrain.DrivetrainParams(J=6.0,
15 mass=52,
16 robot_radius=0.59055 / 2.0,
17 wheel_radius=0.08255 / 2.0,
18 G=11.0 / 60.0,
19 q_pos_low=0.12,
20 q_pos_high=0.14,
21 q_vel_low=1.0,
22 q_vel_high=0.95,
23 has_imu=False)
24
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)
James Kuszmauleeb98e92024-01-14 22:15:32 -080032 elif len(argv) != 7:
33 print("Expected .h, .cc, and .json filenames")
Austin Schuhecc92a02019-01-20 17:42:19 -080034 else:
35 # Write the generated constants out to a file.
James Kuszmauleeb98e92024-01-14 22:15:32 -080036 drivetrain.WriteDrivetrain(argv[1:4], argv[4:7], 'y2017', kDrivetrain)
Diana Vandenberg223703d2017-01-28 17:39:53 -080037
Ravago Jones5127ccc2022-07-31 16:32:45 -070038
Diana Vandenberg223703d2017-01-28 17:39:53 -080039if __name__ == '__main__':
Austin Schuhecc92a02019-01-20 17:42:19 -080040 sys.exit(main(sys.argv))