blob: 177e9e7f449f6a13a14be98d971381dadda4a445 [file] [log] [blame]
Sabina Davisf4c5e762018-01-24 10:18:43 -08001#!/usr/bin/python
2
Austin Schuhce7e03d2020-11-20 22:32:44 -08003from __future__ import print_function
Sabina Davisf4c5e762018-01-24 10:18:43 -08004from frc971.control_loops.python import drivetrain
5import sys
6
7import gflags
8import glog
9
10FLAGS = gflags.FLAGS
11
12gflags.DEFINE_bool('plot', False, 'If true, plot the loop response.')
13
14#update mass (120lbs right now)
15#robot radius needs confirming(set as distance of center wheels from each other)
16#J needs updating
17
Austin Schuhe8a54c02018-03-05 00:25:58 -080018kDrivetrain = drivetrain.DrivetrainParams(
Diana Burgessd0180f12018-03-21 21:24:17 -070019 J=6.0,
Austin Schuhe8a54c02018-03-05 00:25:58 -080020 mass=68.0,
21 robot_radius=0.616 / 2.0,
Diana Burgessd0180f12018-03-21 21:24:17 -070022 wheel_radius=0.127 / 2.0 * 120.0 / 118.0,
Austin Schuhe8a54c02018-03-05 00:25:58 -080023 G_low=46.0 / 60.0 * 20.0 / 48.0 * 14.0 / 62.0,
24 G_high=62.0 / 44.0 * 20.0 / 48.0 * 14.0 / 62.0,
25 q_pos_low=0.12,
26 q_pos_high=0.14,
27 q_vel_low=1.0,
28 q_vel_high=0.95,
Diana Burgessd0180f12018-03-21 21:24:17 -070029 efficiency=0.70,
30 has_imu=True,
31 force=True,
32 kf_q_voltage=13.0,
Austin Schuhe8a54c02018-03-05 00:25:58 -080033 controller_poles=[0.82, 0.82],
Michael Schuh95fbcc52018-03-10 20:57:20 -080034 robot_cg_offset=0.0,
Austin Schuhe8a54c02018-03-05 00:25:58 -080035)
36
Sabina Davisf4c5e762018-01-24 10:18:43 -080037
38def main(argv):
Austin Schuhe8a54c02018-03-05 00:25:58 -080039 argv = FLAGS(argv)
40 glog.init()
Sabina Davisf4c5e762018-01-24 10:18:43 -080041
Austin Schuhe8a54c02018-03-05 00:25:58 -080042 if FLAGS.plot:
43 drivetrain.PlotDrivetrainMotions(kDrivetrain)
44 elif len(argv) != 5:
Austin Schuhce7e03d2020-11-20 22:32:44 -080045 print("Expected .h file name and .cc file name")
Austin Schuhe8a54c02018-03-05 00:25:58 -080046 else:
47 # Write the generated constants out to a file.
48 drivetrain.WriteDrivetrain(argv[1:3], argv[3:5], 'y2018', kDrivetrain)
Sabina Davisf4c5e762018-01-24 10:18:43 -080049
50if __name__ == '__main__':
Austin Schuhe8a54c02018-03-05 00:25:58 -080051 sys.exit(main(sys.argv))