blob: 6421379d9c86eabbc7f4082c1694da60f1a09051 [file] [log] [blame]
Sabina Davisf4c5e762018-01-24 10:18: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 Schuhe8a54c02018-03-05 00:25:58 -080017kDrivetrain = drivetrain.DrivetrainParams(
Diana Burgessd0180f12018-03-21 21:24:17 -070018 J=6.0,
Austin Schuhe8a54c02018-03-05 00:25:58 -080019 mass=68.0,
20 robot_radius=0.616 / 2.0,
Diana Burgessd0180f12018-03-21 21:24:17 -070021 wheel_radius=0.127 / 2.0 * 120.0 / 118.0,
Austin Schuhe8a54c02018-03-05 00:25:58 -080022 G_low=46.0 / 60.0 * 20.0 / 48.0 * 14.0 / 62.0,
23 G_high=62.0 / 44.0 * 20.0 / 48.0 * 14.0 / 62.0,
24 q_pos_low=0.12,
25 q_pos_high=0.14,
26 q_vel_low=1.0,
27 q_vel_high=0.95,
Diana Burgessd0180f12018-03-21 21:24:17 -070028 efficiency=0.70,
29 has_imu=True,
30 force=True,
31 kf_q_voltage=13.0,
Austin Schuhe8a54c02018-03-05 00:25:58 -080032 controller_poles=[0.82, 0.82],
Michael Schuh95fbcc52018-03-10 20:57:20 -080033 robot_cg_offset=0.0,
Austin Schuhe8a54c02018-03-05 00:25:58 -080034)
35
Sabina Davisf4c5e762018-01-24 10:18:43 -080036
37def main(argv):
Austin Schuhe8a54c02018-03-05 00:25:58 -080038 argv = FLAGS(argv)
39 glog.init()
Sabina Davisf4c5e762018-01-24 10:18:43 -080040
Austin Schuhe8a54c02018-03-05 00:25:58 -080041 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.
47 drivetrain.WriteDrivetrain(argv[1:3], argv[3:5], 'y2018', kDrivetrain)
Sabina Davisf4c5e762018-01-24 10:18:43 -080048
49if __name__ == '__main__':
Austin Schuhe8a54c02018-03-05 00:25:58 -080050 sys.exit(main(sys.argv))