blob: 696c8a220ffee52387cb7f4d2d7622c0b0475167 [file] [log] [blame]
Stephan Massaltd021f972020-01-05 20:41:23 -08001#!/usr/bin/python
2
3from frc971.control_loops.python import drivetrain
Austin Schuhc1c957a2020-02-20 17:47:58 -08004from frc971.control_loops.python import control_loop
Stephan Massaltd021f972020-01-05 20:41:23 -08005import sys
6
7import gflags
8import glog
9
10FLAGS = gflags.FLAGS
11
12gflags.DEFINE_bool('plot', False, 'If true, plot the loop response.')
13
14kDrivetrain = drivetrain.DrivetrainParams(
Austin Schuhc1c957a2020-02-20 17:47:58 -080015 J=6.0,
16 mass=58.0,
17 # TODO(austin): Measure radius a bit better.
18 robot_radius=0.7 / 2.0,
19 wheel_radius=6.0 * 0.0254 / 2.0,
20 motor_type=control_loop.Falcon(),
21 G=(8.0 / 70.0) * (17.0 / 24.0),
Stephan Massaltd021f972020-01-05 20:41:23 -080022 q_pos=0.14,
23 q_vel=1.30,
24 efficiency=0.80,
25 has_imu=True,
26 force=True,
27 kf_q_voltage=13.0,
28 controller_poles=[0.82, 0.82],
29 robot_cg_offset=0.0)
30
31
32def main(argv):
33 argv = FLAGS(argv)
34 glog.init()
35
36 if FLAGS.plot:
37 drivetrain.PlotDrivetrainMotions(kDrivetrain)
38 elif len(argv) != 5:
39 print "Expected .h file name and .cc file name"
40 else:
41 # Write the generated constants out to a file.
42 drivetrain.WriteDrivetrain(argv[1:3], argv[3:5], 'y2020', kDrivetrain)
43
44if __name__ == '__main__':
45 sys.exit(main(sys.argv))