001/* 002 * Copyright (C) Cross The Road Electronics. All rights reserved. 003 * License information can be found in CTRE_LICENSE.txt 004 * For support and suggestions contact support@ctr-electronics.com or file 005 * an issue tracker at https://github.com/CrossTheRoadElec/Phoenix-Releases 006 */ 007package com.ctre.phoenix6.hardware.traits; 008 009import com.ctre.phoenix6.StatusCode; 010import com.ctre.phoenix6.controls.*; 011import com.ctre.phoenix6.controls.compound.*; 012 013/** 014 * Requires Phoenix Pro; Contains all FOC-exclusive control functions available 015 * for devices that support FOC. 016 */ 017public interface SupportsFOC extends CommonDevice 018{ 019 020 021 /** 022 * Request a specified motor current (field oriented control). 023 * <p> 024 * This control request will drive the motor to the requested motor 025 * (stator) current value. This leverages field oriented control 026 * (FOC), which means greater peak power than what is documented. 027 * This scales to torque based on Motor's kT constant. 028 * <ul> 029 * <li> <b>TorqueCurrentFOC Parameters:</b> 030 * <ul> 031 * <li> <b>Output:</b> Amount of motor current in Amperes 032 * <li> <b>MaxAbsDutyCycle:</b> The maximum absolute motor output that can 033 * be applied, which effectively limits the 034 * velocity. For example, 0.50 means no more 035 * than 50% output in either direction. This 036 * is useful for preventing the motor from 037 * spinning to its terminal velocity when there 038 * is no external torque applied unto the 039 * rotor. Note this is absolute maximum, so 040 * the value should be between zero and one. 041 * <li> <b>Deadband:</b> Deadband in Amperes. If torque request is within 042 * deadband, the bridge output is neutral. If deadband 043 * is set to zero then there is effectively no 044 * deadband. Note if deadband is zero, a free spinning 045 * motor will spin for quite a while as the firmware 046 * attempts to hold the motor's bemf. If user expects 047 * motor to cease spinning quickly with a demand of 048 * zero, we recommend a deadband of one Ampere. This 049 * value will be converted to an integral value of 050 * amps. 051 * <li> <b>OverrideCoastDurNeutral:</b> Set to true to coast the rotor when 052 * output is zero (or within deadband). 053 * Set to false to use the NeutralMode 054 * configuration setting (default). 055 * This flag exists to provide the 056 * fundamental behavior of this control 057 * when output is zero, which is to 058 * provide 0A (zero torque). 059 * <li> <b>LimitForwardMotion:</b> Set to true to force forward limiting. 060 * This allows users to use other limit 061 * switch sensors connected to robot 062 * controller. This also allows use of 063 * active sensors that require external 064 * power. 065 * <li> <b>LimitReverseMotion:</b> Set to true to force reverse limiting. 066 * This allows users to use other limit 067 * switch sensors connected to robot 068 * controller. This also allows use of 069 * active sensors that require external 070 * power. 071 * <li> <b>IgnoreHardwareLimits:</b> Set to true to ignore hardware limit 072 * switches and the LimitForwardMotion and 073 * LimitReverseMotion parameters, instead 074 * allowing motion. 075 * <p> 076 * This can be useful on mechanisms such 077 * as an intake/feeder, where a limit 078 * switch stops motion while intaking but 079 * should be ignored when feeding to a 080 * shooter. 081 * <p> 082 * The hardware limit faults and 083 * Forward/ReverseLimit signals will still 084 * report the values of the limit switches 085 * regardless of this parameter. 086 * <li> <b>IgnoreSoftwareLimits:</b> Set to true to ignore software limits, 087 * instead allowing motion. 088 * <p> 089 * This can be useful when calibrating the 090 * zero point of a mechanism such as an 091 * elevator. 092 * <p> 093 * The software limit faults will still 094 * report the values of the software 095 * limits regardless of this parameter. 096 * <li> <b>UseTimesync:</b> Set to true to delay applying this control 097 * request until a timesync boundary (requires 098 * Phoenix Pro and CANivore). This eliminates the 099 * impact of nondeterministic network delays in 100 * exchange for a larger but deterministic control 101 * latency. 102 * <p> 103 * This requires setting the ControlTimesyncFreqHz 104 * config in MotorOutputConfigs. Additionally, when 105 * this is enabled, the UpdateFreqHz of this 106 * request should be set to 0 Hz. 107 * </ul> 108 * </ul> 109 * 110 * @param request Control object to request of the device 111 * @return Code response of the request 112 */ 113 StatusCode setControl(TorqueCurrentFOC request); 114 115 /** 116 * Request PID to target position with torque current feedforward. 117 * <p> 118 * This control mode will set the motor's position setpoint to the 119 * position specified by the user. In addition, it will apply an 120 * additional torque current as an arbitrary feedforward value. 121 * <ul> 122 * <li> <b>PositionTorqueCurrentFOC Parameters:</b> 123 * <ul> 124 * <li> <b>Position:</b> Position to drive toward in rotations. 125 * <li> <b>Velocity:</b> Velocity to drive toward in rotations per second. 126 * This is typically used for motion profiles 127 * generated by the robot program. 128 * <li> <b>FeedForward:</b> Feedforward to apply in torque current in 129 * Amperes. This is added to the output of the 130 * onboard feedforward terms. 131 * <p> 132 * User can use motor's kT to scale Newton-meter to 133 * Amperes. 134 * <li> <b>Slot:</b> Select which gains are applied by selecting the slot. 135 * Use the configuration api to set the gain values for 136 * the selected slot before enabling this feature. Slot 137 * must be within [0,2]. 138 * <li> <b>OverrideCoastDurNeutral:</b> Set to true to coast the rotor when 139 * output is zero (or within deadband). 140 * Set to false to use the NeutralMode 141 * configuration setting (default). 142 * This flag exists to provide the 143 * fundamental behavior of this control 144 * when output is zero, which is to 145 * provide 0A (zero torque). 146 * <li> <b>LimitForwardMotion:</b> Set to true to force forward limiting. 147 * This allows users to use other limit 148 * switch sensors connected to robot 149 * controller. This also allows use of 150 * active sensors that require external 151 * power. 152 * <li> <b>LimitReverseMotion:</b> Set to true to force reverse limiting. 153 * This allows users to use other limit 154 * switch sensors connected to robot 155 * controller. This also allows use of 156 * active sensors that require external 157 * power. 158 * <li> <b>IgnoreHardwareLimits:</b> Set to true to ignore hardware limit 159 * switches and the LimitForwardMotion and 160 * LimitReverseMotion parameters, instead 161 * allowing motion. 162 * <p> 163 * This can be useful on mechanisms such 164 * as an intake/feeder, where a limit 165 * switch stops motion while intaking but 166 * should be ignored when feeding to a 167 * shooter. 168 * <p> 169 * The hardware limit faults and 170 * Forward/ReverseLimit signals will still 171 * report the values of the limit switches 172 * regardless of this parameter. 173 * <li> <b>IgnoreSoftwareLimits:</b> Set to true to ignore software limits, 174 * instead allowing motion. 175 * <p> 176 * This can be useful when calibrating the 177 * zero point of a mechanism such as an 178 * elevator. 179 * <p> 180 * The software limit faults will still 181 * report the values of the software 182 * limits regardless of this parameter. 183 * <li> <b>UseTimesync:</b> Set to true to delay applying this control 184 * request until a timesync boundary (requires 185 * Phoenix Pro and CANivore). This eliminates the 186 * impact of nondeterministic network delays in 187 * exchange for a larger but deterministic control 188 * latency. 189 * <p> 190 * This requires setting the ControlTimesyncFreqHz 191 * config in MotorOutputConfigs. Additionally, when 192 * this is enabled, the UpdateFreqHz of this 193 * request should be set to 0 Hz. 194 * </ul> 195 * </ul> 196 * 197 * @param request Control object to request of the device 198 * @return Code response of the request 199 */ 200 StatusCode setControl(PositionTorqueCurrentFOC request); 201 202 /** 203 * Request PID to target velocity with torque current feedforward. 204 * <p> 205 * This control mode will set the motor's velocity setpoint to the 206 * velocity specified by the user. In addition, it will apply an 207 * additional torque current as an arbitrary feedforward value. 208 * <ul> 209 * <li> <b>VelocityTorqueCurrentFOC Parameters:</b> 210 * <ul> 211 * <li> <b>Velocity:</b> Velocity to drive toward in rotations per second. 212 * <li> <b>Acceleration:</b> Acceleration to drive toward in rotations per 213 * second squared. This is typically used for 214 * motion profiles generated by the robot program. 215 * <li> <b>FeedForward:</b> Feedforward to apply in torque current in 216 * Amperes. This is added to the output of the 217 * onboard feedforward terms. 218 * <p> 219 * User can use motor's kT to scale Newton-meter to 220 * Amperes. 221 * <li> <b>Slot:</b> Select which gains are applied by selecting the slot. 222 * Use the configuration api to set the gain values for 223 * the selected slot before enabling this feature. Slot 224 * must be within [0,2]. 225 * <li> <b>OverrideCoastDurNeutral:</b> Set to true to coast the rotor when 226 * output is zero (or within deadband). 227 * Set to false to use the NeutralMode 228 * configuration setting (default). 229 * This flag exists to provide the 230 * fundamental behavior of this control 231 * when output is zero, which is to 232 * provide 0A (zero torque). 233 * <li> <b>LimitForwardMotion:</b> Set to true to force forward limiting. 234 * This allows users to use other limit 235 * switch sensors connected to robot 236 * controller. This also allows use of 237 * active sensors that require external 238 * power. 239 * <li> <b>LimitReverseMotion:</b> Set to true to force reverse limiting. 240 * This allows users to use other limit 241 * switch sensors connected to robot 242 * controller. This also allows use of 243 * active sensors that require external 244 * power. 245 * <li> <b>IgnoreHardwareLimits:</b> Set to true to ignore hardware limit 246 * switches and the LimitForwardMotion and 247 * LimitReverseMotion parameters, instead 248 * allowing motion. 249 * <p> 250 * This can be useful on mechanisms such 251 * as an intake/feeder, where a limit 252 * switch stops motion while intaking but 253 * should be ignored when feeding to a 254 * shooter. 255 * <p> 256 * The hardware limit faults and 257 * Forward/ReverseLimit signals will still 258 * report the values of the limit switches 259 * regardless of this parameter. 260 * <li> <b>IgnoreSoftwareLimits:</b> Set to true to ignore software limits, 261 * instead allowing motion. 262 * <p> 263 * This can be useful when calibrating the 264 * zero point of a mechanism such as an 265 * elevator. 266 * <p> 267 * The software limit faults will still 268 * report the values of the software 269 * limits regardless of this parameter. 270 * <li> <b>UseTimesync:</b> Set to true to delay applying this control 271 * request until a timesync boundary (requires 272 * Phoenix Pro and CANivore). This eliminates the 273 * impact of nondeterministic network delays in 274 * exchange for a larger but deterministic control 275 * latency. 276 * <p> 277 * This requires setting the ControlTimesyncFreqHz 278 * config in MotorOutputConfigs. Additionally, when 279 * this is enabled, the UpdateFreqHz of this 280 * request should be set to 0 Hz. 281 * </ul> 282 * </ul> 283 * 284 * @param request Control object to request of the device 285 * @return Code response of the request 286 */ 287 StatusCode setControl(VelocityTorqueCurrentFOC request); 288 289 /** 290 * Requests Motion Magic® to target a final position using a motion 291 * profile. Users can optionally provide a torque current 292 * feedforward. 293 * <p> 294 * Motion Magic® produces a motion profile in real-time while 295 * attempting to honor the Cruise Velocity, Acceleration, and 296 * (optional) Jerk specified via the Motion Magic® configuration 297 * values. This control mode does not use the Expo_kV or Expo_kA 298 * configs. 299 * <p> 300 * Target position can be changed on-the-fly and Motion Magic® will do 301 * its best to adjust the profile. This control mode is based on 302 * torque current, so relevant closed-loop gains will use Amperes for 303 * the numerator. 304 * <ul> 305 * <li> <b>MotionMagicTorqueCurrentFOC Parameters:</b> 306 * <ul> 307 * <li> <b>Position:</b> Position to drive toward in rotations. 308 * <li> <b>FeedForward:</b> Feedforward to apply in torque current in 309 * Amperes. This is added to the output of the 310 * onboard feedforward terms. 311 * <p> 312 * User can use motor's kT to scale Newton-meter to 313 * Amperes. 314 * <li> <b>Slot:</b> Select which gains are applied by selecting the slot. 315 * Use the configuration api to set the gain values for 316 * the selected slot before enabling this feature. Slot 317 * must be within [0,2]. 318 * <li> <b>OverrideCoastDurNeutral:</b> Set to true to coast the rotor when 319 * output is zero (or within deadband). 320 * Set to false to use the NeutralMode 321 * configuration setting (default). 322 * This flag exists to provide the 323 * fundamental behavior of this control 324 * when output is zero, which is to 325 * provide 0A (zero torque). 326 * <li> <b>LimitForwardMotion:</b> Set to true to force forward limiting. 327 * This allows users to use other limit 328 * switch sensors connected to robot 329 * controller. This also allows use of 330 * active sensors that require external 331 * power. 332 * <li> <b>LimitReverseMotion:</b> Set to true to force reverse limiting. 333 * This allows users to use other limit 334 * switch sensors connected to robot 335 * controller. This also allows use of 336 * active sensors that require external 337 * power. 338 * <li> <b>IgnoreHardwareLimits:</b> Set to true to ignore hardware limit 339 * switches and the LimitForwardMotion and 340 * LimitReverseMotion parameters, instead 341 * allowing motion. 342 * <p> 343 * This can be useful on mechanisms such 344 * as an intake/feeder, where a limit 345 * switch stops motion while intaking but 346 * should be ignored when feeding to a 347 * shooter. 348 * <p> 349 * The hardware limit faults and 350 * Forward/ReverseLimit signals will still 351 * report the values of the limit switches 352 * regardless of this parameter. 353 * <li> <b>IgnoreSoftwareLimits:</b> Set to true to ignore software limits, 354 * instead allowing motion. 355 * <p> 356 * This can be useful when calibrating the 357 * zero point of a mechanism such as an 358 * elevator. 359 * <p> 360 * The software limit faults will still 361 * report the values of the software 362 * limits regardless of this parameter. 363 * <li> <b>UseTimesync:</b> Set to true to delay applying this control 364 * request until a timesync boundary (requires 365 * Phoenix Pro and CANivore). This eliminates the 366 * impact of nondeterministic network delays in 367 * exchange for a larger but deterministic control 368 * latency. 369 * <p> 370 * This requires setting the ControlTimesyncFreqHz 371 * config in MotorOutputConfigs. Additionally, when 372 * this is enabled, the UpdateFreqHz of this 373 * request should be set to 0 Hz. 374 * </ul> 375 * </ul> 376 * 377 * @param request Control object to request of the device 378 * @return Code response of the request 379 */ 380 StatusCode setControl(MotionMagicTorqueCurrentFOC request); 381 382 /** 383 * Requests Motion Magic® to target a final velocity using a motion 384 * profile. This allows smooth transitions between velocity set 385 * points. Users can optionally provide a torque feedforward. 386 * <p> 387 * Motion Magic® Velocity produces a motion profile in real-time while 388 * attempting to honor the specified Acceleration and (optional) Jerk. 389 * This control mode does not use the CruiseVelocity, Expo_kV, or 390 * Expo_kA configs. 391 * <p> 392 * If the specified acceleration is zero, the Acceleration under 393 * Motion Magic® configuration parameter is used instead. This allows 394 * for runtime adjustment of acceleration for advanced users. Jerk is 395 * also specified in the Motion Magic® persistent configuration 396 * values. If Jerk is set to zero, Motion Magic® will produce a 397 * trapezoidal acceleration profile. 398 * <p> 399 * Target velocity can also be changed on-the-fly and Motion Magic® 400 * will do its best to adjust the profile. This control mode is based 401 * on torque current, so relevant closed-loop gains will use Amperes 402 * for the numerator. 403 * <ul> 404 * <li> <b>MotionMagicVelocityTorqueCurrentFOC Parameters:</b> 405 * <ul> 406 * <li> <b>Velocity:</b> Target velocity to drive toward in rotations per 407 * second. This can be changed on-the fly. 408 * <li> <b>Acceleration:</b> This is the absolute Acceleration to use 409 * generating the profile. If this parameter is 410 * zero, the Acceleration persistent configuration 411 * parameter is used instead. Acceleration is in 412 * rotations per second squared. If nonzero, the 413 * signage does not matter as the absolute value 414 * is used. 415 * <li> <b>EnableFOC:</b> Set to true to use FOC commutation (requires 416 * Phoenix Pro), which increases peak power by ~15% 417 * on supported devices (see {@link SupportsFOC}). 418 * Set to false to use trapezoidal commutation. 419 * <p> 420 * FOC improves motor performance by leveraging 421 * torque (current) control. However, this may be 422 * inconvenient for applications that require 423 * specifying duty cycle or voltage. CTR-Electronics 424 * has developed a hybrid method that combines the 425 * performances gains of FOC while still allowing 426 * applications to provide duty cycle or voltage 427 * demand. This not to be confused with simple 428 * sinusoidal control or phase voltage control which 429 * lacks the performance gains. 430 * <li> <b>FeedForward:</b> Feedforward to apply in torque current in 431 * Amperes. This is added to the output of the 432 * onboard feedforward terms. 433 * <p> 434 * User can use motor's kT to scale Newton-meter to 435 * Amperes. 436 * <li> <b>Slot:</b> Select which gains are applied by selecting the slot. 437 * Use the configuration api to set the gain values for 438 * the selected slot before enabling this feature. Slot 439 * must be within [0,2]. 440 * <li> <b>OverrideCoastDurNeutral:</b> Set to true to coast the rotor when 441 * output is zero (or within deadband). 442 * Set to false to use the NeutralMode 443 * configuration setting (default). 444 * This flag exists to provide the 445 * fundamental behavior of this control 446 * when output is zero, which is to 447 * provide 0A (zero torque). 448 * <li> <b>LimitForwardMotion:</b> Set to true to force forward limiting. 449 * This allows users to use other limit 450 * switch sensors connected to robot 451 * controller. This also allows use of 452 * active sensors that require external 453 * power. 454 * <li> <b>LimitReverseMotion:</b> Set to true to force reverse limiting. 455 * This allows users to use other limit 456 * switch sensors connected to robot 457 * controller. This also allows use of 458 * active sensors that require external 459 * power. 460 * <li> <b>IgnoreHardwareLimits:</b> Set to true to ignore hardware limit 461 * switches and the LimitForwardMotion and 462 * LimitReverseMotion parameters, instead 463 * allowing motion. 464 * <p> 465 * This can be useful on mechanisms such 466 * as an intake/feeder, where a limit 467 * switch stops motion while intaking but 468 * should be ignored when feeding to a 469 * shooter. 470 * <p> 471 * The hardware limit faults and 472 * Forward/ReverseLimit signals will still 473 * report the values of the limit switches 474 * regardless of this parameter. 475 * <li> <b>IgnoreSoftwareLimits:</b> Set to true to ignore software limits, 476 * instead allowing motion. 477 * <p> 478 * This can be useful when calibrating the 479 * zero point of a mechanism such as an 480 * elevator. 481 * <p> 482 * The software limit faults will still 483 * report the values of the software 484 * limits regardless of this parameter. 485 * <li> <b>UseTimesync:</b> Set to true to delay applying this control 486 * request until a timesync boundary (requires 487 * Phoenix Pro and CANivore). This eliminates the 488 * impact of nondeterministic network delays in 489 * exchange for a larger but deterministic control 490 * latency. 491 * <p> 492 * This requires setting the ControlTimesyncFreqHz 493 * config in MotorOutputConfigs. Additionally, when 494 * this is enabled, the UpdateFreqHz of this 495 * request should be set to 0 Hz. 496 * </ul> 497 * </ul> 498 * 499 * @param request Control object to request of the device 500 * @return Code response of the request 501 */ 502 StatusCode setControl(MotionMagicVelocityTorqueCurrentFOC request); 503 504 /** 505 * Requests Motion Magic® to target a final position using an 506 * exponential motion profile. Users can optionally provide a torque 507 * current feedforward. 508 * <p> 509 * Motion Magic® Expo produces a motion profile in real-time while 510 * attempting to honor the Cruise Velocity (optional) and the 511 * mechanism kV and kA, specified via the Motion Magic® configuration 512 * values. Note that unlike the slot gains, the Expo_kV and Expo_kA 513 * configs are always in output units of Volts. 514 * <p> 515 * Setting Cruise Velocity to 0 will allow the profile to run to the 516 * max possible velocity based on Expo_kV. This control mode does not 517 * use the Acceleration or Jerk configs. 518 * <p> 519 * Target position can be changed on-the-fly and Motion Magic® will do 520 * its best to adjust the profile. This control mode is based on 521 * torque current, so relevant closed-loop gains will use Amperes for 522 * the numerator. 523 * <ul> 524 * <li> <b>MotionMagicExpoTorqueCurrentFOC Parameters:</b> 525 * <ul> 526 * <li> <b>Position:</b> Position to drive toward in rotations. 527 * <li> <b>FeedForward:</b> Feedforward to apply in torque current in 528 * Amperes. This is added to the output of the 529 * onboard feedforward terms. 530 * <p> 531 * User can use motor's kT to scale Newton-meter to 532 * Amperes. 533 * <li> <b>Slot:</b> Select which gains are applied by selecting the slot. 534 * Use the configuration api to set the gain values for 535 * the selected slot before enabling this feature. Slot 536 * must be within [0,2]. 537 * <li> <b>OverrideCoastDurNeutral:</b> Set to true to coast the rotor when 538 * output is zero (or within deadband). 539 * Set to false to use the NeutralMode 540 * configuration setting (default). 541 * This flag exists to provide the 542 * fundamental behavior of this control 543 * when output is zero, which is to 544 * provide 0A (zero torque). 545 * <li> <b>LimitForwardMotion:</b> Set to true to force forward limiting. 546 * This allows users to use other limit 547 * switch sensors connected to robot 548 * controller. This also allows use of 549 * active sensors that require external 550 * power. 551 * <li> <b>LimitReverseMotion:</b> Set to true to force reverse limiting. 552 * This allows users to use other limit 553 * switch sensors connected to robot 554 * controller. This also allows use of 555 * active sensors that require external 556 * power. 557 * <li> <b>IgnoreHardwareLimits:</b> Set to true to ignore hardware limit 558 * switches and the LimitForwardMotion and 559 * LimitReverseMotion parameters, instead 560 * allowing motion. 561 * <p> 562 * This can be useful on mechanisms such 563 * as an intake/feeder, where a limit 564 * switch stops motion while intaking but 565 * should be ignored when feeding to a 566 * shooter. 567 * <p> 568 * The hardware limit faults and 569 * Forward/ReverseLimit signals will still 570 * report the values of the limit switches 571 * regardless of this parameter. 572 * <li> <b>IgnoreSoftwareLimits:</b> Set to true to ignore software limits, 573 * instead allowing motion. 574 * <p> 575 * This can be useful when calibrating the 576 * zero point of a mechanism such as an 577 * elevator. 578 * <p> 579 * The software limit faults will still 580 * report the values of the software 581 * limits regardless of this parameter. 582 * <li> <b>UseTimesync:</b> Set to true to delay applying this control 583 * request until a timesync boundary (requires 584 * Phoenix Pro and CANivore). This eliminates the 585 * impact of nondeterministic network delays in 586 * exchange for a larger but deterministic control 587 * latency. 588 * <p> 589 * This requires setting the ControlTimesyncFreqHz 590 * config in MotorOutputConfigs. Additionally, when 591 * this is enabled, the UpdateFreqHz of this 592 * request should be set to 0 Hz. 593 * </ul> 594 * </ul> 595 * 596 * @param request Control object to request of the device 597 * @return Code response of the request 598 */ 599 StatusCode setControl(MotionMagicExpoTorqueCurrentFOC request); 600 601 /** 602 * Requests Motion Magic® to target a final position using a motion 603 * profile. This dynamic request allows runtime changes to Cruise 604 * Velocity, Acceleration, and (optional) Jerk. Users can optionally 605 * provide a torque current feedforward. 606 * <p> 607 * Motion Magic® produces a motion profile in real-time while 608 * attempting to honor the specified Cruise Velocity, Acceleration, 609 * and (optional) Jerk. This control mode does not use the Expo_kV or 610 * Expo_kA configs. 611 * <p> 612 * Target position can be changed on-the-fly and Motion Magic® will do 613 * its best to adjust the profile. This control mode is based on 614 * torque current, so relevant closed-loop gains will use Amperes for 615 * the numerator. 616 * <ul> 617 * <li> <b>DynamicMotionMagicTorqueCurrentFOC Parameters:</b> 618 * <ul> 619 * <li> <b>Position:</b> Position to drive toward in rotations. 620 * <li> <b>Velocity:</b> Cruise velocity for profiling. The signage does 621 * not matter as the device will use the absolute 622 * value for profile generation. 623 * <li> <b>Acceleration:</b> Acceleration for profiling. The signage does 624 * not matter as the device will use the absolute 625 * value for profile generation. 626 * <li> <b>Jerk:</b> Jerk for profiling. The signage does not matter as the 627 * device will use the absolute value for profile 628 * generation. 629 * <p> 630 * Jerk is optional; if this is set to zero, then Motion 631 * Magic® will not apply a Jerk limit. 632 * <li> <b>FeedForward:</b> Feedforward to apply in torque current in 633 * Amperes. This is added to the output of the 634 * onboard feedforward terms. 635 * <p> 636 * User can use motor's kT to scale Newton-meter to 637 * Amperes. 638 * <li> <b>Slot:</b> Select which gains are applied by selecting the slot. 639 * Use the configuration api to set the gain values for 640 * the selected slot before enabling this feature. Slot 641 * must be within [0,2]. 642 * <li> <b>OverrideCoastDurNeutral:</b> Set to true to coast the rotor when 643 * output is zero (or within deadband). 644 * Set to false to use the NeutralMode 645 * configuration setting (default). 646 * This flag exists to provide the 647 * fundamental behavior of this control 648 * when output is zero, which is to 649 * provide 0A (zero torque). 650 * <li> <b>LimitForwardMotion:</b> Set to true to force forward limiting. 651 * This allows users to use other limit 652 * switch sensors connected to robot 653 * controller. This also allows use of 654 * active sensors that require external 655 * power. 656 * <li> <b>LimitReverseMotion:</b> Set to true to force reverse limiting. 657 * This allows users to use other limit 658 * switch sensors connected to robot 659 * controller. This also allows use of 660 * active sensors that require external 661 * power. 662 * <li> <b>IgnoreHardwareLimits:</b> Set to true to ignore hardware limit 663 * switches and the LimitForwardMotion and 664 * LimitReverseMotion parameters, instead 665 * allowing motion. 666 * <p> 667 * This can be useful on mechanisms such 668 * as an intake/feeder, where a limit 669 * switch stops motion while intaking but 670 * should be ignored when feeding to a 671 * shooter. 672 * <p> 673 * The hardware limit faults and 674 * Forward/ReverseLimit signals will still 675 * report the values of the limit switches 676 * regardless of this parameter. 677 * <li> <b>IgnoreSoftwareLimits:</b> Set to true to ignore software limits, 678 * instead allowing motion. 679 * <p> 680 * This can be useful when calibrating the 681 * zero point of a mechanism such as an 682 * elevator. 683 * <p> 684 * The software limit faults will still 685 * report the values of the software 686 * limits regardless of this parameter. 687 * <li> <b>UseTimesync:</b> Set to true to delay applying this control 688 * request until a timesync boundary (requires 689 * Phoenix Pro and CANivore). This eliminates the 690 * impact of nondeterministic network delays in 691 * exchange for a larger but deterministic control 692 * latency. 693 * <p> 694 * This requires setting the ControlTimesyncFreqHz 695 * config in MotorOutputConfigs. Additionally, when 696 * this is enabled, the UpdateFreqHz of this 697 * request should be set to 0 Hz. 698 * </ul> 699 * </ul> 700 * 701 * @param request Control object to request of the device 702 * @return Code response of the request 703 */ 704 StatusCode setControl(DynamicMotionMagicTorqueCurrentFOC request); 705 706 /** 707 * Requests Motion Magic® Expo to target a final position using an 708 * exponential motion profile. This dynamic request allows runtime 709 * changes to the profile kV, kA, and (optional) Cruise Velocity. 710 * Users can optionally provide a torque current feedforward. 711 * <p> 712 * Motion Magic® Expo produces a motion profile in real-time while 713 * attempting to honor the specified Cruise Velocity (optional) and 714 * the mechanism kV and kA. Note that unlike the slot gains, the 715 * Expo_kV and Expo_kA parameters are always in output units of Volts. 716 * <p> 717 * Setting the Cruise Velocity to 0 will allow the profile to run to 718 * the max possible velocity based on Expo_kV. This control mode does 719 * not use the Acceleration or Jerk configs. 720 * <p> 721 * Target position can be changed on-the-fly and Motion Magic® will do 722 * its best to adjust the profile. This control mode is based on 723 * torque current, so relevant closed-loop gains will use Amperes for 724 * the numerator. 725 * <ul> 726 * <li> <b>DynamicMotionMagicExpoTorqueCurrentFOC Parameters:</b> 727 * <ul> 728 * <li> <b>Position:</b> Position to drive toward in rotations. 729 * <li> <b>kV:</b> Mechanism kV for profiling. Unlike the kV slot gain, 730 * this is always in units of V/rps. 731 * <p> 732 * This represents the amount of voltage necessary to hold a 733 * velocity. In terms of the Motion Magic® Expo profile, a 734 * higher kV results in a slower maximum velocity. 735 * <li> <b>kA:</b> Mechanism kA for profiling. Unlike the kA slot gain, 736 * this is always in units of V/rps². 737 * <p> 738 * This represents the amount of voltage necessary to 739 * achieve an acceleration. In terms of the Motion Magic® 740 * Expo profile, a higher kA results in a slower 741 * acceleration. 742 * <li> <b>Velocity:</b> Cruise velocity for profiling. The signage does 743 * not matter as the device will use the absolute 744 * value for profile generation. Setting this to 0 745 * will allow the profile to run to the max possible 746 * velocity based on Expo_kV. 747 * <li> <b>FeedForward:</b> Feedforward to apply in torque current in 748 * Amperes. This is added to the output of the 749 * onboard feedforward terms. 750 * <p> 751 * User can use motor's kT to scale Newton-meter to 752 * Amperes. 753 * <li> <b>Slot:</b> Select which gains are applied by selecting the slot. 754 * Use the configuration api to set the gain values for 755 * the selected slot before enabling this feature. Slot 756 * must be within [0,2]. 757 * <li> <b>OverrideCoastDurNeutral:</b> Set to true to coast the rotor when 758 * output is zero (or within deadband). 759 * Set to false to use the NeutralMode 760 * configuration setting (default). 761 * This flag exists to provide the 762 * fundamental behavior of this control 763 * when output is zero, which is to 764 * provide 0A (zero torque). 765 * <li> <b>LimitForwardMotion:</b> Set to true to force forward limiting. 766 * This allows users to use other limit 767 * switch sensors connected to robot 768 * controller. This also allows use of 769 * active sensors that require external 770 * power. 771 * <li> <b>LimitReverseMotion:</b> Set to true to force reverse limiting. 772 * This allows users to use other limit 773 * switch sensors connected to robot 774 * controller. This also allows use of 775 * active sensors that require external 776 * power. 777 * <li> <b>IgnoreHardwareLimits:</b> Set to true to ignore hardware limit 778 * switches and the LimitForwardMotion and 779 * LimitReverseMotion parameters, instead 780 * allowing motion. 781 * <p> 782 * This can be useful on mechanisms such 783 * as an intake/feeder, where a limit 784 * switch stops motion while intaking but 785 * should be ignored when feeding to a 786 * shooter. 787 * <p> 788 * The hardware limit faults and 789 * Forward/ReverseLimit signals will still 790 * report the values of the limit switches 791 * regardless of this parameter. 792 * <li> <b>IgnoreSoftwareLimits:</b> Set to true to ignore software limits, 793 * instead allowing motion. 794 * <p> 795 * This can be useful when calibrating the 796 * zero point of a mechanism such as an 797 * elevator. 798 * <p> 799 * The software limit faults will still 800 * report the values of the software 801 * limits regardless of this parameter. 802 * <li> <b>UseTimesync:</b> Set to true to delay applying this control 803 * request until a timesync boundary (requires 804 * Phoenix Pro and CANivore). This eliminates the 805 * impact of nondeterministic network delays in 806 * exchange for a larger but deterministic control 807 * latency. 808 * <p> 809 * This requires setting the ControlTimesyncFreqHz 810 * config in MotorOutputConfigs. Additionally, when 811 * this is enabled, the UpdateFreqHz of this 812 * request should be set to 0 Hz. 813 * </ul> 814 * </ul> 815 * 816 * @param request Control object to request of the device 817 * @return Code response of the request 818 */ 819 StatusCode setControl(DynamicMotionMagicExpoTorqueCurrentFOC request); 820 821 /** 822 * Differential control with torque current average target and 823 * position difference target. 824 * <ul> 825 * <li> <b>Diff_TorqueCurrentFOC_Position Parameters:</b> 826 * <ul> 827 * <li> <b>AverageRequest:</b> Average TorqueCurrentFOC request of the 828 * mechanism. 829 * <li> <b>DifferentialRequest:</b> Differential PositionTorqueCurrentFOC 830 * request of the mechanism. 831 * </ul> 832 * </ul> 833 * 834 * @param request Control object to request of the device 835 * @return Code response of the request 836 */ 837 StatusCode setControl(Diff_TorqueCurrentFOC_Position request); 838 839 /** 840 * Differential control with position average target and position 841 * difference target using torque current control. 842 * <ul> 843 * <li> <b>Diff_PositionTorqueCurrentFOC_Position Parameters:</b> 844 * <ul> 845 * <li> <b>AverageRequest:</b> Average PositionTorqueCurrentFOC request of 846 * the mechanism. 847 * <li> <b>DifferentialRequest:</b> Differential PositionTorqueCurrentFOC 848 * request of the mechanism. 849 * </ul> 850 * </ul> 851 * 852 * @param request Control object to request of the device 853 * @return Code response of the request 854 */ 855 StatusCode setControl(Diff_PositionTorqueCurrentFOC_Position request); 856 857 /** 858 * Differential control with velocity average target and position 859 * difference target using torque current control. 860 * <ul> 861 * <li> <b>Diff_VelocityTorqueCurrentFOC_Position Parameters:</b> 862 * <ul> 863 * <li> <b>AverageRequest:</b> Average VelocityTorqueCurrentFOC request of 864 * the mechanism. 865 * <li> <b>DifferentialRequest:</b> Differential PositionTorqueCurrentFOC 866 * request of the mechanism. 867 * </ul> 868 * </ul> 869 * 870 * @param request Control object to request of the device 871 * @return Code response of the request 872 */ 873 StatusCode setControl(Diff_VelocityTorqueCurrentFOC_Position request); 874 875 /** 876 * Differential control with Motion Magic® average target and position 877 * difference target using torque current control. 878 * <ul> 879 * <li> <b>Diff_MotionMagicTorqueCurrentFOC_Position Parameters:</b> 880 * <ul> 881 * <li> <b>AverageRequest:</b> Average MotionMagicTorqueCurrentFOC request 882 * of the mechanism. 883 * <li> <b>DifferentialRequest:</b> Differential PositionTorqueCurrentFOC 884 * request of the mechanism. 885 * </ul> 886 * </ul> 887 * 888 * @param request Control object to request of the device 889 * @return Code response of the request 890 */ 891 StatusCode setControl(Diff_MotionMagicTorqueCurrentFOC_Position request); 892 893 /** 894 * Differential control with Motion Magic® Expo average target and 895 * position difference target using torque current control. 896 * <ul> 897 * <li> <b>Diff_MotionMagicExpoTorqueCurrentFOC_Position Parameters:</b> 898 * <ul> 899 * <li> <b>AverageRequest:</b> Average MotionMagicExpoTorqueCurrentFOC 900 * request of the mechanism. 901 * <li> <b>DifferentialRequest:</b> Differential PositionTorqueCurrentFOC 902 * request of the mechanism. 903 * </ul> 904 * </ul> 905 * 906 * @param request Control object to request of the device 907 * @return Code response of the request 908 */ 909 StatusCode setControl(Diff_MotionMagicExpoTorqueCurrentFOC_Position request); 910 911 /** 912 * Differential control with Motion Magic® Velocity average target and 913 * position difference target using torque current control. 914 * <ul> 915 * <li> <b>Diff_MotionMagicVelocityTorqueCurrentFOC_Position Parameters:</b> 916 * <ul> 917 * <li> <b>AverageRequest:</b> Average MotionMagicVelocityTorqueCurrentFOC 918 * request of the mechanism. 919 * <li> <b>DifferentialRequest:</b> Differential PositionTorqueCurrentFOC 920 * request of the mechanism. 921 * </ul> 922 * </ul> 923 * 924 * @param request Control object to request of the device 925 * @return Code response of the request 926 */ 927 StatusCode setControl(Diff_MotionMagicVelocityTorqueCurrentFOC_Position request); 928 929 /** 930 * Differential control with torque current average target and 931 * velocity difference target. 932 * <ul> 933 * <li> <b>Diff_TorqueCurrentFOC_Velocity Parameters:</b> 934 * <ul> 935 * <li> <b>AverageRequest:</b> Average TorqueCurrentFOC request of the 936 * mechanism. 937 * <li> <b>DifferentialRequest:</b> Differential VelocityTorqueCurrentFOC 938 * request of the mechanism. 939 * </ul> 940 * </ul> 941 * 942 * @param request Control object to request of the device 943 * @return Code response of the request 944 */ 945 StatusCode setControl(Diff_TorqueCurrentFOC_Velocity request); 946 947 /** 948 * Differential control with position average target and velocity 949 * difference target using torque current control. 950 * <ul> 951 * <li> <b>Diff_PositionTorqueCurrentFOC_Velocity Parameters:</b> 952 * <ul> 953 * <li> <b>AverageRequest:</b> Average PositionTorqueCurrentFOC request of 954 * the mechanism. 955 * <li> <b>DifferentialRequest:</b> Differential VelocityTorqueCurrentFOC 956 * request of the mechanism. 957 * </ul> 958 * </ul> 959 * 960 * @param request Control object to request of the device 961 * @return Code response of the request 962 */ 963 StatusCode setControl(Diff_PositionTorqueCurrentFOC_Velocity request); 964 965 /** 966 * Differential control with velocity average target and velocity 967 * difference target using torque current control. 968 * <ul> 969 * <li> <b>Diff_VelocityTorqueCurrentFOC_Velocity Parameters:</b> 970 * <ul> 971 * <li> <b>AverageRequest:</b> Average VelocityTorqueCurrentFOC request of 972 * the mechanism. 973 * <li> <b>DifferentialRequest:</b> Differential VelocityTorqueCurrentFOC 974 * request of the mechanism. 975 * </ul> 976 * </ul> 977 * 978 * @param request Control object to request of the device 979 * @return Code response of the request 980 */ 981 StatusCode setControl(Diff_VelocityTorqueCurrentFOC_Velocity request); 982 983 /** 984 * Differential control with Motion Magic® average target and velocity 985 * difference target using torque current control. 986 * <ul> 987 * <li> <b>Diff_MotionMagicTorqueCurrentFOC_Velocity Parameters:</b> 988 * <ul> 989 * <li> <b>AverageRequest:</b> Average MotionMagicTorqueCurrentFOC request 990 * of the mechanism. 991 * <li> <b>DifferentialRequest:</b> Differential VelocityTorqueCurrentFOC 992 * request of the mechanism. 993 * </ul> 994 * </ul> 995 * 996 * @param request Control object to request of the device 997 * @return Code response of the request 998 */ 999 StatusCode setControl(Diff_MotionMagicTorqueCurrentFOC_Velocity request); 1000 1001 /** 1002 * Differential control with Motion Magic® Expo average target and 1003 * velocity difference target using torque current control. 1004 * <ul> 1005 * <li> <b>Diff_MotionMagicExpoTorqueCurrentFOC_Velocity Parameters:</b> 1006 * <ul> 1007 * <li> <b>AverageRequest:</b> Average MotionMagicExpoTorqueCurrentFOC 1008 * request of the mechanism. 1009 * <li> <b>DifferentialRequest:</b> Differential VelocityTorqueCurrentFOC 1010 * request of the mechanism. 1011 * </ul> 1012 * </ul> 1013 * 1014 * @param request Control object to request of the device 1015 * @return Code response of the request 1016 */ 1017 StatusCode setControl(Diff_MotionMagicExpoTorqueCurrentFOC_Velocity request); 1018 1019 /** 1020 * Differential control with Motion Magic® Velocity average target and 1021 * velocity difference target using torque current control. 1022 * <ul> 1023 * <li> <b>Diff_MotionMagicVelocityTorqueCurrentFOC_Velocity Parameters:</b> 1024 * <ul> 1025 * <li> <b>AverageRequest:</b> Average MotionMagicVelocityTorqueCurrentFOC 1026 * request of the mechanism. 1027 * <li> <b>DifferentialRequest:</b> Differential VelocityTorqueCurrentFOC 1028 * request of the mechanism. 1029 * </ul> 1030 * </ul> 1031 * 1032 * @param request Control object to request of the device 1033 * @return Code response of the request 1034 */ 1035 StatusCode setControl(Diff_MotionMagicVelocityTorqueCurrentFOC_Velocity request); 1036 1037 /** 1038 * Differential control with torque current average target and torque 1039 * current difference target. 1040 * <ul> 1041 * <li> <b>Diff_TorqueCurrentFOC_Open Parameters:</b> 1042 * <ul> 1043 * <li> <b>AverageRequest:</b> Average TorqueCurrentFOC request of the 1044 * mechanism. 1045 * <li> <b>DifferentialRequest:</b> Differential TorqueCurrentFOC request of 1046 * the mechanism. 1047 * </ul> 1048 * </ul> 1049 * 1050 * @param request Control object to request of the device 1051 * @return Code response of the request 1052 */ 1053 StatusCode setControl(Diff_TorqueCurrentFOC_Open request); 1054 1055 /** 1056 * Differential control with position average target and torque 1057 * current difference target. 1058 * <ul> 1059 * <li> <b>Diff_PositionTorqueCurrentFOC_Open Parameters:</b> 1060 * <ul> 1061 * <li> <b>AverageRequest:</b> Average PositionTorqueCurrentFOC request of 1062 * the mechanism. 1063 * <li> <b>DifferentialRequest:</b> Differential TorqueCurrentFOC request of 1064 * the mechanism. 1065 * </ul> 1066 * </ul> 1067 * 1068 * @param request Control object to request of the device 1069 * @return Code response of the request 1070 */ 1071 StatusCode setControl(Diff_PositionTorqueCurrentFOC_Open request); 1072 1073 /** 1074 * Differential control with velocity average target and torque 1075 * current difference target. 1076 * <ul> 1077 * <li> <b>Diff_VelocityTorqueCurrentFOC_Open Parameters:</b> 1078 * <ul> 1079 * <li> <b>AverageRequest:</b> Average VelocityTorqueCurrentFOC request of 1080 * the mechanism. 1081 * <li> <b>DifferentialRequest:</b> Differential TorqueCurrentFOC request of 1082 * the mechanism. 1083 * </ul> 1084 * </ul> 1085 * 1086 * @param request Control object to request of the device 1087 * @return Code response of the request 1088 */ 1089 StatusCode setControl(Diff_VelocityTorqueCurrentFOC_Open request); 1090 1091 /** 1092 * Differential control with Motion Magic® average target and torque 1093 * current difference target. 1094 * <ul> 1095 * <li> <b>Diff_MotionMagicTorqueCurrentFOC_Open Parameters:</b> 1096 * <ul> 1097 * <li> <b>AverageRequest:</b> Average MotionMagicTorqueCurrentFOC request 1098 * of the mechanism. 1099 * <li> <b>DifferentialRequest:</b> Differential TorqueCurrentFOC request of 1100 * the mechanism. 1101 * </ul> 1102 * </ul> 1103 * 1104 * @param request Control object to request of the device 1105 * @return Code response of the request 1106 */ 1107 StatusCode setControl(Diff_MotionMagicTorqueCurrentFOC_Open request); 1108 1109 /** 1110 * Differential control with Motion Magic® Expo average target and 1111 * torque current difference target. 1112 * <ul> 1113 * <li> <b>Diff_MotionMagicExpoTorqueCurrentFOC_Open Parameters:</b> 1114 * <ul> 1115 * <li> <b>AverageRequest:</b> Average MotionMagicExpoTorqueCurrentFOC 1116 * request of the mechanism. 1117 * <li> <b>DifferentialRequest:</b> Differential TorqueCurrentFOC request of 1118 * the mechanism. 1119 * </ul> 1120 * </ul> 1121 * 1122 * @param request Control object to request of the device 1123 * @return Code response of the request 1124 */ 1125 StatusCode setControl(Diff_MotionMagicExpoTorqueCurrentFOC_Open request); 1126 1127 /** 1128 * Differential control with Motion Magic® Velocity average target and 1129 * torque current difference target. 1130 * <ul> 1131 * <li> <b>Diff_MotionMagicVelocityTorqueCurrentFOC_Open Parameters:</b> 1132 * <ul> 1133 * <li> <b>AverageRequest:</b> Average MotionMagicVelocityTorqueCurrentFOC 1134 * request of the mechanism. 1135 * <li> <b>DifferentialRequest:</b> Differential TorqueCurrentFOC request of 1136 * the mechanism. 1137 * </ul> 1138 * </ul> 1139 * 1140 * @param request Control object to request of the device 1141 * @return Code response of the request 1142 */ 1143 StatusCode setControl(Diff_MotionMagicVelocityTorqueCurrentFOC_Open request); 1144 1145 /** 1146 * Control device with generic control request object. 1147 * <p> 1148 * User must make sure the specified object is castable to a valid control request, 1149 * otherwise this function will fail at run-time and return the NotSupported StatusCode 1150 * 1151 * @param request Control object to request of the device 1152 * @return Status Code of the request, 0 is OK 1153 */ 1154 StatusCode setControl(ControlRequest request); 1155 1156} 1157