blob: f3d4682dc915cb8dad1261d93889746bbb2638d0 [file] [log] [blame]
Ravago Jones486de802021-05-19 20:47:55 -07001#!/usr/bin/python3
2
3from __future__ import print_function
4from frc971.control_loops.python import drivetrain
5from frc971.control_loops.python import control_loop
6import sys
7
8import gflags
9import glog
10
11FLAGS = gflags.FLAGS
12
13gflags.DEFINE_bool('plot', False, 'If true, plot the loop response.')
14
15kDrivetrain = drivetrain.DrivetrainParams(
16 J=6.0,
17 mass=58.0,
18 # TODO(austin): Measure radius a bit better.
Ravago Jones5127ccc2022-07-31 16:32:45 -070019 robot_radius=0.39,
20 wheel_radius=3 / 39.37,
Ravago Jones486de802021-05-19 20:47:55 -070021 motor_type=control_loop.Falcon(),
Ravago Jones5127ccc2022-07-31 16:32:45 -070022 num_motors=3,
Vinay Siva6cf36a32021-06-27 14:26:33 -070023 G=8.0 / 80.0,
Ravago Jones486de802021-05-19 20:47:55 -070024 q_pos=0.24,
25 q_vel=2.5,
26 efficiency=0.80,
27 has_imu=True,
28 force=True,
29 kf_q_voltage=1.0,
30 controller_poles=[0.82, 0.82])
31
32
33def main(argv):
34 argv = FLAGS(argv)
35 glog.init()
36
37 if FLAGS.plot:
38 drivetrain.PlotDrivetrainMotions(kDrivetrain)
39 elif len(argv) != 5:
40 print("Expected .h file name and .cc file name")
41 else:
42 # Write the generated constants out to a file.
Ravago Jones5127ccc2022-07-31 16:32:45 -070043 drivetrain.WriteDrivetrain(argv[1:3], argv[3:5], 'y2021_bot3',
44 kDrivetrain)
Ravago Jones486de802021-05-19 20:47:55 -070045
46
47if __name__ == '__main__':
48 sys.exit(main(sys.argv))