Class DynamicMotionMagicExpoVoltage
- All Implemented Interfaces:
ControlRequest,Cloneable
Motion Magic® Expo produces a motion profile in real-time while attempting to honor the specified Cruise Velocity (optional) and the mechanism kV and kA. Note that unlike the slot gains, the Expo_kV and Expo_kA parameters are always in output units of Volts.
Setting the Cruise Velocity to 0 will allow the profile to run to the max possible velocity based on Expo_kV. This control mode does not use the Acceleration or Jerk configs.
Target position can be changed on-the-fly and Motion Magic® will do its best to adjust the profile. This control mode is voltage-based, so relevant closed-loop gains will use Volts for the numerator.
-
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanSet to true to use FOC commutation (requires Phoenix Pro), which increases peak power by ~15% on supported devices (seeSupportsFOC).doubleFeedforward to apply in volts.booleanSet to true to ignore hardware limit switches and the LimitForwardMotion and LimitReverseMotion parameters, instead allowing motion.booleanSet to true to ignore software limits, instead allowing motion.doubleMechanism kA for profiling.doubleMechanism kV for profiling.booleanSet to true to force forward limiting.booleanSet to true to force reverse limiting.booleanSet to true to static-brake the rotor when output is zero (or within deadband).doublePosition to drive toward in rotations.intSelect which gains are applied by selecting the slot.doubleThe frequency at which this control will update.booleanSet to true to delay applying this control request until a timesync boundary (requires Phoenix Pro and CANivore).doubleCruise velocity for profiling. -
Constructor Summary
ConstructorsConstructorDescriptionDynamicMotionMagicExpoVoltage(double Position, double kV, double kA) Requires Phoenix Pro and CANivore; Requests Motion Magic® Expo to target a final position using an exponential motion profile.DynamicMotionMagicExpoVoltage(Angle Position, Per<VoltageUnit, AngularVelocityUnit> kV, Per<VoltageUnit, AngularAccelerationUnit> kA) Requires Phoenix Pro and CANivore; Requests Motion Magic® Expo to target a final position using an exponential motion profile. -
Method Summary
Modifier and TypeMethodDescriptionclone()Gets information about this control request.Helper method to get this Control Request's FeedForward parameter converted to a unit type.Helper method to get this Control Request's kA parameter converted to a unit type.Helper method to get this Control Request's kV parameter converted to a unit type.getName()Gets the name of this control request.Helper method to get this Control Request's Position parameter converted to a unit type.Helper method to get this Control Request's Velocity parameter converted to a unit type.sendRequest(CANBus network, int deviceHash) toString()withEnableFOC(boolean newEnableFOC) Modifies this Control Request's EnableFOC parameter and returns itself for method-chaining and easier to use request API.withFeedForward(double newFeedForward) Modifies this Control Request's FeedForward parameter and returns itself for method-chaining and easier to use request API.withFeedForward(Voltage newFeedForward) Modifies this Control Request's FeedForward parameter and returns itself for method-chaining and easier to use request API.withIgnoreHardwareLimits(boolean newIgnoreHardwareLimits) Modifies this Control Request's IgnoreHardwareLimits parameter and returns itself for method-chaining and easier to use request API.withIgnoreSoftwareLimits(boolean newIgnoreSoftwareLimits) Modifies this Control Request's IgnoreSoftwareLimits parameter and returns itself for method-chaining and easier to use request API.withKA(double newKA) Modifies this Control Request's kA parameter and returns itself for method-chaining and easier to use request API.withKA(Per<VoltageUnit, AngularAccelerationUnit> newKA) Modifies this Control Request's kA parameter and returns itself for method-chaining and easier to use request API.withKV(double newKV) Modifies this Control Request's kV parameter and returns itself for method-chaining and easier to use request API.withKV(Per<VoltageUnit, AngularVelocityUnit> newKV) Modifies this Control Request's kV parameter and returns itself for method-chaining and easier to use request API.withLimitForwardMotion(boolean newLimitForwardMotion) Modifies this Control Request's LimitForwardMotion parameter and returns itself for method-chaining and easier to use request API.withLimitReverseMotion(boolean newLimitReverseMotion) Modifies this Control Request's LimitReverseMotion parameter and returns itself for method-chaining and easier to use request API.withOverrideBrakeDurNeutral(boolean newOverrideBrakeDurNeutral) Modifies this Control Request's OverrideBrakeDurNeutral parameter and returns itself for method-chaining and easier to use request API.withPosition(double newPosition) Modifies this Control Request's Position parameter and returns itself for method-chaining and easier to use request API.withPosition(Angle newPosition) Modifies this Control Request's Position parameter and returns itself for method-chaining and easier to use request API.withSlot(int newSlot) Modifies this Control Request's Slot parameter and returns itself for method-chaining and easier to use request API.withUpdateFreqHz(double newUpdateFreqHz) Sets the frequency at which this control will update.withUpdateFreqHz(Frequency newUpdateFreqHz) Sets the frequency at which this control will update.withUseTimesync(boolean newUseTimesync) Modifies this Control Request's UseTimesync parameter and returns itself for method-chaining and easier to use request API.withVelocity(double newVelocity) Modifies this Control Request's Velocity parameter and returns itself for method-chaining and easier to use request API.withVelocity(AngularVelocity newVelocity) Modifies this Control Request's Velocity parameter and returns itself for method-chaining and easier to use request API.
-
Field Details
-
Position
Position to drive toward in rotations.- Units: rotations
-
kV
Mechanism kV for profiling. Unlike the kV slot gain, this is always in units of V/rps.This represents the amount of voltage necessary to hold a velocity. In terms of the Motion Magic® Expo profile, a higher kV results in a slower maximum velocity.
- Units: V/rps
-
kA
Mechanism kA for profiling. Unlike the kA slot gain, this is always in units of V/rps².This represents the amount of voltage necessary to achieve an acceleration. In terms of the Motion Magic® Expo profile, a higher kA results in a slower acceleration.
- Units: V/rps²
-
Velocity
Cruise velocity for profiling. The signage does not matter as the device will use the absolute value for profile generation. Setting this to 0 will allow the profile to run to the max possible velocity based on Expo_kV.- Units: rotations per second
-
EnableFOC
Set to true to use FOC commutation (requires Phoenix Pro), which increases peak power by ~15% on supported devices (seeSupportsFOC). Set to false to use trapezoidal commutation.FOC improves motor performance by leveraging torque (current) control. However, this may be inconvenient for applications that require specifying duty cycle or voltage. CTR-Electronics has developed a hybrid method that combines the performances gains of FOC while still allowing applications to provide duty cycle or voltage demand. This not to be confused with simple sinusoidal control or phase voltage control which lacks the performance gains.
-
FeedForward
Feedforward to apply in volts. This is added to the output of the onboard feedforward terms.- Units: Volts
-
Slot
Select which gains are applied by selecting the slot. Use the configuration api to set the gain values for the selected slot before enabling this feature. Slot must be within [0,2]. -
OverrideBrakeDurNeutral
Set to true to static-brake the rotor when output is zero (or within deadband). Set to false to use the NeutralMode configuration setting (default). This flag exists to provide the fundamental behavior of this control when output is zero, which is to provide 0V to the motor. -
LimitForwardMotion
Set to true to force forward limiting. This allows users to use other limit switch sensors connected to robot controller. This also allows use of active sensors that require external power. -
LimitReverseMotion
Set to true to force reverse limiting. This allows users to use other limit switch sensors connected to robot controller. This also allows use of active sensors that require external power. -
IgnoreHardwareLimits
Set to true to ignore hardware limit switches and the LimitForwardMotion and LimitReverseMotion parameters, instead allowing motion.This can be useful on mechanisms such as an intake/feeder, where a limit switch stops motion while intaking but should be ignored when feeding to a shooter.
The hardware limit faults and Forward/ReverseLimit signals will still report the values of the limit switches regardless of this parameter.
-
IgnoreSoftwareLimits
Set to true to ignore software limits, instead allowing motion.This can be useful when calibrating the zero point of a mechanism such as an elevator.
The software limit faults will still report the values of the software limits regardless of this parameter.
-
UseTimesync
Set to true to delay applying this control request until a timesync boundary (requires Phoenix Pro and CANivore). This eliminates the impact of nondeterministic network delays in exchange for a larger but deterministic control latency.This requires setting the ControlTimesyncFreqHz config in MotorOutputConfigs. Additionally, when this is enabled, the UpdateFreqHz of this request should be set to 0 Hz.
-
UpdateFreqHz
The frequency at which this control will update. This is designated in Hertz, with a minimum of 20 Hz (every 50 ms) and a maximum of 1000 Hz (every 1 ms). Some update frequencies are not supported and will be promoted up to the next highest supported frequency.If this field is set to 0 Hz, the control request will be sent immediately as a one-shot frame. This may be useful for advanced applications that require outputs to be synchronized with data acquisition. In this case, we recommend not exceeding 50 ms between control calls.
-
-
Constructor Details
-
DynamicMotionMagicExpoVoltage
Requires Phoenix Pro and CANivore; Requests Motion Magic® Expo to target a final position using an exponential motion profile. This dynamic request allows runtime changes to the profile kV, kA, and (optional) Cruise Velocity. Users can optionally provide a voltage feedforward.Motion Magic® Expo produces a motion profile in real-time while attempting to honor the specified Cruise Velocity (optional) and the mechanism kV and kA. Note that unlike the slot gains, the Expo_kV and Expo_kA parameters are always in output units of Volts.
Setting the Cruise Velocity to 0 will allow the profile to run to the max possible velocity based on Expo_kV. This control mode does not use the Acceleration or Jerk configs.
Target position can be changed on-the-fly and Motion Magic® will do its best to adjust the profile. This control mode is voltage-based, so relevant closed-loop gains will use Volts for the numerator.
- Parameters:
Position- Position to drive toward in rotations.kV- Mechanism kV for profiling. Unlike the kV slot gain, this is always in units of V/rps.This represents the amount of voltage necessary to hold a velocity. In terms of the Motion Magic® Expo profile, a higher kV results in a slower maximum velocity.
kA- Mechanism kA for profiling. Unlike the kA slot gain, this is always in units of V/rps².This represents the amount of voltage necessary to achieve an acceleration. In terms of the Motion Magic® Expo profile, a higher kA results in a slower acceleration.
-
DynamicMotionMagicExpoVoltage
public DynamicMotionMagicExpoVoltage(Angle Position, Per<VoltageUnit, AngularVelocityUnit> kV, Per<VoltageUnit, AngularAccelerationUnit> kA) Requires Phoenix Pro and CANivore; Requests Motion Magic® Expo to target a final position using an exponential motion profile. This dynamic request allows runtime changes to the profile kV, kA, and (optional) Cruise Velocity. Users can optionally provide a voltage feedforward.Motion Magic® Expo produces a motion profile in real-time while attempting to honor the specified Cruise Velocity (optional) and the mechanism kV and kA. Note that unlike the slot gains, the Expo_kV and Expo_kA parameters are always in output units of Volts.
Setting the Cruise Velocity to 0 will allow the profile to run to the max possible velocity based on Expo_kV. This control mode does not use the Acceleration or Jerk configs.
Target position can be changed on-the-fly and Motion Magic® will do its best to adjust the profile. This control mode is voltage-based, so relevant closed-loop gains will use Volts for the numerator.
- Parameters:
Position- Position to drive toward in rotations.kV- Mechanism kV for profiling. Unlike the kV slot gain, this is always in units of V/rps.This represents the amount of voltage necessary to hold a velocity. In terms of the Motion Magic® Expo profile, a higher kV results in a slower maximum velocity.
kA- Mechanism kA for profiling. Unlike the kA slot gain, this is always in units of V/rps².This represents the amount of voltage necessary to achieve an acceleration. In terms of the Motion Magic® Expo profile, a higher kA results in a slower acceleration.
-
-
Method Details
-
getName
Description copied from interface:ControlRequestGets the name of this control request.- Specified by:
getNamein interfaceControlRequest- Returns:
- Name of the control request
-
toString
-
sendRequest
- Specified by:
sendRequestin interfaceControlRequest
-
getControlInfo
Gets information about this control request.- Specified by:
getControlInfoin interfaceControlRequest- Returns:
- Map of control parameter names and corresponding applied values
-
withPosition
Modifies this Control Request's Position parameter and returns itself for method-chaining and easier to use request API.Position to drive toward in rotations.
- Units: rotations
- Parameters:
newPosition- Parameter to modify- Returns:
- Itself
-
withPosition
Modifies this Control Request's Position parameter and returns itself for method-chaining and easier to use request API.Position to drive toward in rotations.
- Units: rotations
- Parameters:
newPosition- Parameter to modify- Returns:
- Itself
-
getPositionMeasure
Helper method to get this Control Request's Position parameter converted to a unit type. If not using the Java units library,Positioncan be accessed directly instead.Position to drive toward in rotations.
- Units: rotations
- Returns:
- Position
-
withKV
Modifies this Control Request's kV parameter and returns itself for method-chaining and easier to use request API.Mechanism kV for profiling. Unlike the kV slot gain, this is always in units of V/rps.
This represents the amount of voltage necessary to hold a velocity. In terms of the Motion Magic® Expo profile, a higher kV results in a slower maximum velocity.
- Units: V/rps
- Parameters:
newKV- Parameter to modify- Returns:
- Itself
-
withKV
Modifies this Control Request's kV parameter and returns itself for method-chaining and easier to use request API.Mechanism kV for profiling. Unlike the kV slot gain, this is always in units of V/rps.
This represents the amount of voltage necessary to hold a velocity. In terms of the Motion Magic® Expo profile, a higher kV results in a slower maximum velocity.
- Units: V/rps
- Parameters:
newKV- Parameter to modify- Returns:
- Itself
-
getKVMeasure
Helper method to get this Control Request's kV parameter converted to a unit type. If not using the Java units library,kVcan be accessed directly instead.Mechanism kV for profiling. Unlike the kV slot gain, this is always in units of V/rps.
This represents the amount of voltage necessary to hold a velocity. In terms of the Motion Magic® Expo profile, a higher kV results in a slower maximum velocity.
- Units: V/rps
- Returns:
- kV
-
withKA
Modifies this Control Request's kA parameter and returns itself for method-chaining and easier to use request API.Mechanism kA for profiling. Unlike the kA slot gain, this is always in units of V/rps².
This represents the amount of voltage necessary to achieve an acceleration. In terms of the Motion Magic® Expo profile, a higher kA results in a slower acceleration.
- Units: V/rps²
- Parameters:
newKA- Parameter to modify- Returns:
- Itself
-
withKA
Modifies this Control Request's kA parameter and returns itself for method-chaining and easier to use request API.Mechanism kA for profiling. Unlike the kA slot gain, this is always in units of V/rps².
This represents the amount of voltage necessary to achieve an acceleration. In terms of the Motion Magic® Expo profile, a higher kA results in a slower acceleration.
- Units: V/rps²
- Parameters:
newKA- Parameter to modify- Returns:
- Itself
-
getKAMeasure
Helper method to get this Control Request's kA parameter converted to a unit type. If not using the Java units library,kAcan be accessed directly instead.Mechanism kA for profiling. Unlike the kA slot gain, this is always in units of V/rps².
This represents the amount of voltage necessary to achieve an acceleration. In terms of the Motion Magic® Expo profile, a higher kA results in a slower acceleration.
- Units: V/rps²
- Returns:
- kA
-
withVelocity
Modifies this Control Request's Velocity parameter and returns itself for method-chaining and easier to use request API.Cruise velocity for profiling. The signage does not matter as the device will use the absolute value for profile generation. Setting this to 0 will allow the profile to run to the max possible velocity based on Expo_kV.
- Units: rotations per second
- Parameters:
newVelocity- Parameter to modify- Returns:
- Itself
-
withVelocity
Modifies this Control Request's Velocity parameter and returns itself for method-chaining and easier to use request API.Cruise velocity for profiling. The signage does not matter as the device will use the absolute value for profile generation. Setting this to 0 will allow the profile to run to the max possible velocity based on Expo_kV.
- Units: rotations per second
- Parameters:
newVelocity- Parameter to modify- Returns:
- Itself
-
getVelocityMeasure
Helper method to get this Control Request's Velocity parameter converted to a unit type. If not using the Java units library,Velocitycan be accessed directly instead.Cruise velocity for profiling. The signage does not matter as the device will use the absolute value for profile generation. Setting this to 0 will allow the profile to run to the max possible velocity based on Expo_kV.
- Units: rotations per second
- Returns:
- Velocity
-
withEnableFOC
Modifies this Control Request's EnableFOC parameter and returns itself for method-chaining and easier to use request API.Set to true to use FOC commutation (requires Phoenix Pro), which increases peak power by ~15% on supported devices (see
SupportsFOC). Set to false to use trapezoidal commutation.FOC improves motor performance by leveraging torque (current) control. However, this may be inconvenient for applications that require specifying duty cycle or voltage. CTR-Electronics has developed a hybrid method that combines the performances gains of FOC while still allowing applications to provide duty cycle or voltage demand. This not to be confused with simple sinusoidal control or phase voltage control which lacks the performance gains.
- Parameters:
newEnableFOC- Parameter to modify- Returns:
- Itself
-
withFeedForward
Modifies this Control Request's FeedForward parameter and returns itself for method-chaining and easier to use request API.Feedforward to apply in volts. This is added to the output of the onboard feedforward terms.
- Units: Volts
- Parameters:
newFeedForward- Parameter to modify- Returns:
- Itself
-
withFeedForward
Modifies this Control Request's FeedForward parameter and returns itself for method-chaining and easier to use request API.Feedforward to apply in volts. This is added to the output of the onboard feedforward terms.
- Units: Volts
- Parameters:
newFeedForward- Parameter to modify- Returns:
- Itself
-
getFeedForwardMeasure
Helper method to get this Control Request's FeedForward parameter converted to a unit type. If not using the Java units library,FeedForwardcan be accessed directly instead.Feedforward to apply in volts. This is added to the output of the onboard feedforward terms.
- Units: Volts
- Returns:
- FeedForward
-
withSlot
Modifies this Control Request's Slot parameter and returns itself for method-chaining and easier to use request API.Select which gains are applied by selecting the slot. Use the configuration api to set the gain values for the selected slot before enabling this feature. Slot must be within [0,2].
- Parameters:
newSlot- Parameter to modify- Returns:
- Itself
-
withOverrideBrakeDurNeutral
public DynamicMotionMagicExpoVoltage withOverrideBrakeDurNeutral(boolean newOverrideBrakeDurNeutral) Modifies this Control Request's OverrideBrakeDurNeutral parameter and returns itself for method-chaining and easier to use request API.Set to true to static-brake the rotor when output is zero (or within deadband). Set to false to use the NeutralMode configuration setting (default). This flag exists to provide the fundamental behavior of this control when output is zero, which is to provide 0V to the motor.
- Parameters:
newOverrideBrakeDurNeutral- Parameter to modify- Returns:
- Itself
-
withLimitForwardMotion
Modifies this Control Request's LimitForwardMotion parameter and returns itself for method-chaining and easier to use request API.Set to true to force forward limiting. This allows users to use other limit switch sensors connected to robot controller. This also allows use of active sensors that require external power.
- Parameters:
newLimitForwardMotion- Parameter to modify- Returns:
- Itself
-
withLimitReverseMotion
Modifies this Control Request's LimitReverseMotion parameter and returns itself for method-chaining and easier to use request API.Set to true to force reverse limiting. This allows users to use other limit switch sensors connected to robot controller. This also allows use of active sensors that require external power.
- Parameters:
newLimitReverseMotion- Parameter to modify- Returns:
- Itself
-
withIgnoreHardwareLimits
Modifies this Control Request's IgnoreHardwareLimits parameter and returns itself for method-chaining and easier to use request API.Set to true to ignore hardware limit switches and the LimitForwardMotion and LimitReverseMotion parameters, instead allowing motion.
This can be useful on mechanisms such as an intake/feeder, where a limit switch stops motion while intaking but should be ignored when feeding to a shooter.
The hardware limit faults and Forward/ReverseLimit signals will still report the values of the limit switches regardless of this parameter.
- Parameters:
newIgnoreHardwareLimits- Parameter to modify- Returns:
- Itself
-
withIgnoreSoftwareLimits
Modifies this Control Request's IgnoreSoftwareLimits parameter and returns itself for method-chaining and easier to use request API.Set to true to ignore software limits, instead allowing motion.
This can be useful when calibrating the zero point of a mechanism such as an elevator.
The software limit faults will still report the values of the software limits regardless of this parameter.
- Parameters:
newIgnoreSoftwareLimits- Parameter to modify- Returns:
- Itself
-
withUseTimesync
Modifies this Control Request's UseTimesync parameter and returns itself for method-chaining and easier to use request API.Set to true to delay applying this control request until a timesync boundary (requires Phoenix Pro and CANivore). This eliminates the impact of nondeterministic network delays in exchange for a larger but deterministic control latency.
This requires setting the ControlTimesyncFreqHz config in MotorOutputConfigs. Additionally, when this is enabled, the UpdateFreqHz of this request should be set to 0 Hz.
- Parameters:
newUseTimesync- Parameter to modify- Returns:
- Itself
-
withUpdateFreqHz
Sets the frequency at which this control will update. This is designated in Hertz, with a minimum of 20 Hz (every 50 ms) and a maximum of 1000 Hz (every 1 ms). Some update frequencies are not supported and will be promoted up to the next highest supported frequency.If this field is set to 0 Hz, the control request will be sent immediately as a one-shot frame. This may be useful for advanced applications that require outputs to be synchronized with data acquisition. In this case, we recommend not exceeding 50 ms between control calls.
- Specified by:
withUpdateFreqHzin interfaceControlRequest- Parameters:
newUpdateFreqHz- Parameter to modify- Returns:
- Itself
-
withUpdateFreqHz
Sets the frequency at which this control will update. This is designated in Hertz, with a minimum of 20 Hz (every 50 ms) and a maximum of 1000 Hz (every 1 ms). Some update frequencies are not supported and will be promoted up to the next highest supported frequency.If this field is set to 0 Hz, the control request will be sent immediately as a one-shot frame. This may be useful for advanced applications that require outputs to be synchronized with data acquisition. In this case, we recommend not exceeding 50 ms between control calls.
- Specified by:
withUpdateFreqHzin interfaceControlRequest- Parameters:
newUpdateFreqHz- Parameter to modify- Returns:
- Itself
-
clone
-