diff --git a/cpp/MotionMagic/src/main/cpp/Robot.cpp b/cpp/MotionMagic/src/main/cpp/Robot.cpp index eeac5868..b98fdcaa 100644 --- a/cpp/MotionMagic/src/main/cpp/Robot.cpp +++ b/cpp/MotionMagic/src/main/cpp/Robot.cpp @@ -19,12 +19,13 @@ void Robot::SimulationPeriodic() { void Robot::RobotInit() { configs::TalonFXConfiguration cfg{}; + /* Configure gear ratio */ configs::FeedbackConfigs &fdb = cfg.Feedback; - fdb.SensorToMechanismRatio = 12.8; + fdb.SensorToMechanismRatio = 12.8; // 12.8 rotor rotations per mechanism rotation /* Configure Motion Magic */ configs::MotionMagicConfigs &mm = cfg.MotionMagic; - mm.MotionMagicCruiseVelocity = 5; // 5 rotations per second cruise + mm.MotionMagicCruiseVelocity = 5; // 5 (mechanism) rotations per second cruise mm.MotionMagicAcceleration = 10; // Take approximately 0.5 seconds to reach max vel // Take approximately 0.1 seconds to reach max accel mm.MotionMagicJerk = 100; diff --git a/java/MotionMagic/src/main/java/frc/robot/Robot.java b/java/MotionMagic/src/main/java/frc/robot/Robot.java index b8f79fa1..d284f444 100644 --- a/java/MotionMagic/src/main/java/frc/robot/Robot.java +++ b/java/MotionMagic/src/main/java/frc/robot/Robot.java @@ -49,12 +49,13 @@ public void simulationPeriodic() { public void robotInit() { TalonFXConfiguration cfg = new TalonFXConfiguration(); + /* Configure gear ratio */ FeedbackConfigs fdb = cfg.Feedback; - fdb.SensorToMechanismRatio = 12.8; + fdb.SensorToMechanismRatio = 12.8; // 12.8 rotor rotations per mechanism rotation /* Configure Motion Magic */ MotionMagicConfigs mm = cfg.MotionMagic; - mm.MotionMagicCruiseVelocity = 5; // 5 rotations per second cruise + mm.MotionMagicCruiseVelocity = 5; // 5 (mechanism) rotations per second cruise mm.MotionMagicAcceleration = 10; // Take approximately 0.5 seconds to reach max vel // Take approximately 0.1 seconds to reach max accel mm.MotionMagicJerk = 100; diff --git a/python/MotionMagic/robot.py b/python/MotionMagic/robot.py index 6b5569da..db756faa 100644 --- a/python/MotionMagic/robot.py +++ b/python/MotionMagic/robot.py @@ -23,12 +23,13 @@ def robotInit(self): cfg = configs.TalonFXConfiguration() + # Configure gear ratio fdb = cfg.feedback - fdb.sensor_to_mechanism_ratio = 12.8 + fdb.sensor_to_mechanism_ratio = 12.8 # 12.8 rotor rotations per mechanism rotation # Configure Motion Magic mm = cfg.motion_magic - mm.motion_magic_cruise_velocity = 5 # 5 rotations per second cruise + mm.motion_magic_cruise_velocity = 5 # 5 (mechanism) rotations per second cruise mm.motion_magic_acceleration = 10 # Take approximately 0.5 seconds to reach max vel # Take apprximately 0.1 seconds to reach max accel mm.motion_magic_jerk = 100