blob: e2d6eec7753dba62adc0541f6f32393687f980d5 [file] [log] [blame]
Michael Schuhab42b0a2019-01-07 16:33:43 -08001#!/usr/bin/python
2
3from frc971.control_loops.python import drivetrain
4import sys
5
6import gflags
7import glog
8
9FLAGS = gflags.FLAGS
10
11gflags.DEFINE_bool('plot', False, 'If true, plot the loop response.')
12
13#update mass (120lbs right now)
14#robot radius needs confirming(set as distance of center wheels from each other)
15#J needs updating
16
Austin Schuh378483c2019-01-20 16:36:40 -080017# TODO(austin): wpilib
18# Encoder is on a 24 tooth gear attached to the output gear.
19
Michael Schuhab42b0a2019-01-07 16:33:43 -080020kDrivetrain = drivetrain.DrivetrainParams(
Austin Schuh834302a2019-02-16 15:47:25 -080021 J=1.5,
22 mass=38.5,
Austin Schuh378483c2019-01-20 16:36:40 -080023 # TODO(austin): Measure.
Austin Schuh834302a2019-02-16 15:47:25 -080024 robot_radius=0.45 / 2.0,
Austin Schuh378483c2019-01-20 16:36:40 -080025 wheel_radius=4.0 * 0.0254 / 2.0,
26 G=9.0 / 52.0,
27 q_pos=0.14,
28 q_vel=0.95,
29 efficiency=0.80,
Michael Schuhab42b0a2019-01-07 16:33:43 -080030 has_imu=True,
31 force=True,
32 kf_q_voltage=13.0,
33 controller_poles=[0.82, 0.82],
Austin Schuh378483c2019-01-20 16:36:40 -080034 robot_cg_offset=0.0)
Michael Schuhab42b0a2019-01-07 16:33:43 -080035
36
37def main(argv):
38 argv = FLAGS(argv)
39 glog.init()
40
41 if FLAGS.plot:
42 drivetrain.PlotDrivetrainMotions(kDrivetrain)
43 elif len(argv) != 5:
44 print "Expected .h file name and .cc file name"
45 else:
46 # Write the generated constants out to a file.
Austin Schuh378483c2019-01-20 16:36:40 -080047 drivetrain.WriteDrivetrain(argv[1:3], argv[3:5], 'y2019', kDrivetrain)
Michael Schuhab42b0a2019-01-07 16:33:43 -080048
49if __name__ == '__main__':
50 sys.exit(main(sys.argv))