blob: 54745dd9f7894016d033d580f6bcb7f9be900c96 [file] [log] [blame]
Stephan Massaltd021f972020-01-05 20:41:23 -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
13kDrivetrain = drivetrain.DrivetrainParams(
14 J=1.5,
15 mass=38.5,
16 robot_radius=0.45 / 2.0,
17 wheel_radius=4.0 * 0.0254 / 2.0,
18 G=9.0 / 52.0,
19 q_pos=0.14,
20 q_vel=1.30,
21 efficiency=0.80,
22 has_imu=True,
23 force=True,
24 kf_q_voltage=13.0,
25 controller_poles=[0.82, 0.82],
26 robot_cg_offset=0.0)
27
28
29def main(argv):
30 argv = FLAGS(argv)
31 glog.init()
32
33 if FLAGS.plot:
34 drivetrain.PlotDrivetrainMotions(kDrivetrain)
35 elif len(argv) != 5:
36 print "Expected .h file name and .cc file name"
37 else:
38 # Write the generated constants out to a file.
39 drivetrain.WriteDrivetrain(argv[1:3], argv[3:5], 'y2020', kDrivetrain)
40
41if __name__ == '__main__':
42 sys.exit(main(sys.argv))