blob: 095ae98f383eee3b595a86c8cd50a5aaaceb2a95 [file] [log] [blame]
milind-u086d7262022-01-19 20:44:18 -08001#!/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.
Siddhant Kanwar3d917162022-01-23 15:57:03 -080019 robot_radius=0.39,
20 wheel_radius=2.5 * 0.0254,
milind-u086d7262022-01-19 20:44:18 -080021 motor_type=control_loop.Falcon(),
Siddhant Kanwar3d917162022-01-23 15:57:03 -080022 num_motors=3,
23 G=(14.0 / 54.0) * (22.0 / 56.0),
milind-u086d7262022-01-19 20:44:18 -080024 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)
James Kuszmauleeb98e92024-01-14 22:15:32 -080039 elif len(argv) != 7:
40 print("Expected .h, .cc, and .json filenames")
milind-u086d7262022-01-19 20:44:18 -080041 else:
42 # Write the generated constants out to a file.
James Kuszmauleeb98e92024-01-14 22:15:32 -080043 drivetrain.WriteDrivetrain(argv[1:4], argv[4:7], 'y2022', kDrivetrain)
milind-u086d7262022-01-19 20:44:18 -080044
45
46if __name__ == '__main__':
47 sys.exit(main(sys.argv))