18 #include <system_error>
23 #include <linux/can.h>
25 #include <sys/ioctl.h>
26 #include <sys/socket.h>
29 #define RED "\033[31m"
30 #define RESET "\033[0m"
269 std::string interfaceName;
271 struct sockaddr_can addr;
274 std::pair<uint64_t, std::chrono::steady_clock::time_point>>
285 uint32_t arbitrationId, uint8_t dlc,
286 const std::array<uint8_t, 8> &data = std::array<uint8_t, 8>{})
const;
300 void SendControlMessage(
301 std::variant<MotorControl, SystemControl> command, std::string commandName,
float value, std::optional<float> minValue = std::nullopt,
302 std::optional<float> maxValue = std::nullopt)
const;
310 uint64_t ReadPeriodicStatus(
Status period)
const;
328 uint8_t parameterType,
329 std::string parameterName,
330 std::variant<float, uint32_t, uint16_t, uint8_t, bool> value,
331 std::optional<float> minValue = std::nullopt,
332 std::optional<float> maxValue = std::nullopt,
333 std::optional<std::string> customErrorMessage = std::nullopt);
342 std::variant<float, uint32_t, bool> ReadParameter(
Parameter parameterId);
365 SparkBase(
const std::string &interfaceName, uint8_t deviceId);
717 void SetP(uint8_t slot,
float p);
725 void SetI(uint8_t slot,
float i);
733 void SetD(uint8_t slot,
float d);
741 void SetF(uint8_t slot,
float f);
749 void SetIZone(uint8_t slot,
float iZone);
1239 float GetP(uint8_t slot);
1246 float GetI(uint8_t slot);
1253 float GetD(uint8_t slot);
1260 float GetF(uint8_t slot);
constexpr uint8_t PARAM_TYPE_UINT
Parameter type for unsigned integers.
Definition: SparkBase.hpp:32
SystemControl
System control commands for the SPARK controller.
Definition: SparkBase.hpp:41
MotorType
Motor type parameter.
Definition: SparkBase.hpp:223
SensorType
Sensor type parameter.
Definition: SparkBase.hpp:232
CtrlType
Control type parameter.
Definition: SparkBase.hpp:242
constexpr uint8_t PARAM_TYPE_BOOL
Parameter type for boolean values.
Definition: SparkBase.hpp:34
IdleMode
Idle mode parameter.
Definition: SparkBase.hpp:253
Parameter
Parameters for the SPARK controller.
Definition: SparkBase.hpp:81
@ kCompensatedNominalVoltage
@ kLimitSwitchRevPolarity
@ kSmartMotionAccelStrategy_0
@ kSmartMotionAllowedClosedLoopError_3
@ kPositionConversionFactor
@ kDutyCyclePositionFactor
@ kVelocityConversionFactor
@ kAltEncoderPositionFactor
@ kSmartMotionMinVelOutput_2
@ kAltEncoderCountsPerRev
@ kAnalogVelocityConversion
@ kSmartMotionMaxVelocity_3
@ kSmartMotionAccelStrategy_2
@ kSmartMotionMinVelOutput_3
@ kSmartMotionAllowedClosedLoopError_2
@ kSmartMotionMinVelOutput_1
@ kSmartMotionMaxVelocity_2
@ kSmartMotionAllowedClosedLoopError_0
@ kAltEncoderVelocityFactor
@ kSmartMotionMaxVelocity_0
@ kSmartMotionAccelStrategy_3
@ kHallSensorAverageDepth
@ kSmartMotionAccelStrategy_1
@ kSmartCurrentStallLimit
@ kSmartMotionMaxVelocity_1
@ kAltEncoderAverageDepth
@ kSmartMotionMinVelOutput_0
@ kDutyCycleVelocityFactor
@ kAnalogPositionConversion
@ kSmartMotionAllowedClosedLoopError_1
@ kLimitSwitchFwdPolarity
constexpr uint8_t PARAM_TYPE_FLOAT
Parameter type for floating-point numbers.
Definition: SparkBase.hpp:33
Status
Status periods for the SPARK controller.
Definition: SparkBase.hpp:69
MotorControl
Motor control commands for the SPARK controller.
Definition: SparkBase.hpp:54
A base class for controlling REV Robotics SPARK motor controllers via CAN bus.
Definition: SparkBase.hpp:266
void SetAltEncoderPositionFactor(float factor)
Sets the position factor for the alternate encoder.
Definition: SparkBase.cpp:1110
bool GetIdleMode() const
Gets the current idle mode.
Definition: SparkBase.cpp:460
float GetAnalogPosition() const
Gets the current analog position.
Definition: SparkBase.cpp:526
void SetSensorType(SensorType sensor)
Sets the sensor type.
Definition: SparkBase.cpp:555
void SetOutputMax(uint8_t slot, float max)
Sets the output maximum for the specified PID slot.
Definition: SparkBase.cpp:786
float GetRampRate()
Get the ramp rate.
Definition: SparkBase.cpp:1205
uint16_t GetAnalogSampleDelta()
Get the analog sample delta.
Definition: SparkBase.cpp:1895
float GetPosition() const
Gets the current position of the motor.
Definition: SparkBase.cpp:502
void SetAnalogInverted(bool inverted)
Sets whether the analog sensor is inverted.
Definition: SparkBase.cpp:1072
void SetSmartCurrentFreeLimit(uint16_t limit)
Sets the smart current free limit.
Definition: SparkBase.cpp:662
uint8_t GetDataPortConfig()
Get the data port configuration.
Definition: SparkBase.cpp:1905
bool GetLimitSwitchFwdPolarity()
Get the forward limit switch polarity.
Definition: SparkBase.cpp:1531
float GetSmartMotionMinVelOutput(uint8_t slot)
Get the minimum velocity output for Smart Motion in a given slot.
Definition: SparkBase.cpp:1733
float GetOutputMin(uint8_t slot)
Get the output minimum value for a given slot.
Definition: SparkBase.cpp:1479
void SetDutyCyclePositionFactor(float factor)
Sets the position factor for the duty cycle encoder.
Definition: SparkBase.cpp:1122
void SetMotorKv(uint16_t kv)
Sets the motor Kv (velocity constant)
Definition: SparkBase.cpp:584
virtual ~SparkBase()
Destructor for SparkBase.
Definition: SparkBase.cpp:56
float GetDFilter(uint8_t slot)
Get the DFilter value for a given slot.
Definition: SparkBase.cpp:1463
void SetMotorR(uint16_t r)
Sets the motor resistance.
Definition: SparkBase.cpp:589
void SetCtrlType(CtrlType type)
Sets the control type.
Definition: SparkBase.cpp:601
bool GetLimitSwitchRevPolarity()
Get the reverse limit switch polarity.
Definition: SparkBase.cpp:1541
void SetHardLimitFwdEn(bool enable)
Enables or disables the forward hard limit switch.
Definition: SparkBase.cpp:804
void SetAltEncoderSampleDelta(uint8_t delta)
Sets the sample delta for the alternate encoder.
Definition: SparkBase.cpp:1100
void SetDutyCyclePrescalar(uint8_t prescalar)
Sets the prescalar for the duty cycle encoder.
Definition: SparkBase.cpp:1143
float GetAlternateEncoderVelocity() const
Gets the velocity from the alternate encoder.
Definition: SparkBase.cpp:533
bool GetAnalogInverted()
Get the analog inversion state.
Definition: SparkBase.cpp:1885
void SetLimitSwitchFwdPolarity(bool polarity)
Sets the polarity of the forward limit switch.
Definition: SparkBase.cpp:814
uint16_t GetSmartCurrentConfig()
Get the smart current configuration.
Definition: SparkBase.cpp:1373
uint8_t GetAltEncoderAverageDepth()
Get the alternate encoder average depth.
Definition: SparkBase.cpp:1925
uint8_t GetAltEncoderSampleDelta()
Get the alternate encoder sample delta.
Definition: SparkBase.cpp:1935
uint16_t GetSmartCurrentStallLimit()
Get the smart current stall limit.
Definition: SparkBase.cpp:1353
void SetPositionPIDWrapEnable(bool enable)
Enables or disables position PID wrap.
Definition: SparkBase.cpp:623
void SetCurrentChopCycles(uint16_t cycles)
Sets the number of cycles for current chopping.
Definition: SparkBase.cpp:652
void SetSoftLimitFwdEn(bool enable)
Enables or disables the forward soft limit.
Definition: SparkBase.cpp:824
uint8_t GetCtrlType()
Get the control type.
Definition: SparkBase.cpp:1249
void SetSmartMotionMaxVelocity(uint8_t slot, float maxVel)
Sets the maximum velocity for Smart Motion in the specified slot.
Definition: SparkBase.cpp:905
static void Heartbeat()
Sends a heartbeat signal to keep all SPARK controllers active.
Definition: SparkBase.cpp:307
float GetAnalogVelocityConversion()
Get the analog velocity conversion factor.
Definition: SparkBase.cpp:1855
uint16_t GetHallSensorAverageDepth()
Get the Hall sensor average depth.
Definition: SparkBase.cpp:1691
void SetAnalogSampleDelta(uint16_t delta)
Sets the sample delta for analog readings.
Definition: SparkBase.cpp:1077
uint16_t GetAltEncoderCountsPerRev()
Get the alternate encoder counts per revolution.
Definition: SparkBase.cpp:1915
bool GetDutyCycleInverted()
Get the duty cycle inversion state.
Definition: SparkBase.cpp:1995
uint32_t GetFollowerConfig()
Get the follower configuration.
Definition: SparkBase.cpp:1601
void SetClosedLoopVoltageMode(uint8_t mode)
Sets the closed loop voltage mode.
Definition: SparkBase.cpp:612
void SetInputDeadband(float deadband)
Sets the input deadband.
Definition: SparkBase.cpp:567
float GetTemperature() const
Gets the current temperature of the SPARK controller.
Definition: SparkBase.cpp:479
float GetF(uint8_t slot)
Get the feedforward (F) constant for a given slot.
Definition: SparkBase.cpp:1431
uint16_t GetSmartCurrentFreeLimit()
Get the smart current free limit.
Definition: SparkBase.cpp:1363
float GetAltEncoderPositionFactor()
Get the alternate encoder position factor.
Definition: SparkBase.cpp:1955
void SetEncoderInverted(bool inverted)
Sets whether the encoder is inverted.
Definition: SparkBase.cpp:873
float GetCurrentChop()
Get the current chop value.
Definition: SparkBase.cpp:1333
uint8_t GetEncoderAverageDepth()
Get the encoder average depth.
Definition: SparkBase.cpp:1631
void SetPositionPIDMaxInput(float maxInput)
Sets the maximum input for position PID.
Definition: SparkBase.cpp:633
uint8_t GetDutyCyclePrescalar()
Get the duty cycle prescalar.
Definition: SparkBase.cpp:2015
uint16_t GetAnalogAverageDepth()
Get the analog average depth.
Definition: SparkBase.cpp:1865
void SetSmartMotionMinVelOutput(uint8_t slot, float minVel)
Sets the minimum velocity output for Smart Motion in the specified slot.
Definition: SparkBase.cpp:937
void SetEncoderCountsPerRev(uint16_t counts)
Sets the encoder counts per revolution.
Definition: SparkBase.cpp:858
void SetHallSensorAverageDepth(uint16_t depth)
Sets the hall sensor average depth.
Definition: SparkBase.cpp:898
void SetDutyCycleAverageDepth(uint8_t depth)
Sets the average depth for the duty cycle encoder.
Definition: SparkBase.cpp:1137
void SetSoftLimitRev(float limit)
Sets the reverse soft limit.
Definition: SparkBase.cpp:839
void SetAltEncoderCountsPerRev(uint16_t counts)
Sets the counts per revolution for the alternate encoder.
Definition: SparkBase.cpp:1090
float GetPositionConversionFactor()
Get the position conversion factor.
Definition: SparkBase.cpp:1661
void SetVelocity(float velocity)
Sets the motor's velocity.
Definition: SparkBase.cpp:401
void SetCurrentChop(float chop)
Sets the current chop limit.
Definition: SparkBase.cpp:647
void SetD(uint8_t slot, float d)
Sets the derivative gain for the specified PID slot.
Definition: SparkBase.cpp:706
void SetRampRate(float rate)
Sets the ramp rate.
Definition: SparkBase.cpp:577
void FactoryReset()
Performs a factory reset on the SPARK controller.
Definition: SparkBase.cpp:361
float GetDutyCycleZeroOffset()
Get the duty cycle zero offset.
Definition: SparkBase.cpp:2025
void SetClosedLoopRampRate(float rampRate)
Sets the closed loop ramp rate.
Definition: SparkBase.cpp:888
void SetSmartCurrentConfig(uint16_t config)
Sets the smart current configuration.
Definition: SparkBase.cpp:667
float GetIMaxAccum(uint8_t slot)
Get the maximum accumulated I term for Smart Motion in a given slot.
Definition: SparkBase.cpp:1781
void SetSmartMotionAccelStrategy(uint8_t slot, float strategy)
Sets the acceleration strategy for Smart Motion in the specified slot.
Definition: SparkBase.cpp:969
float GetAnalogVelocity() const
Gets the current analog velocity.
Definition: SparkBase.cpp:518
uint8_t GetAnalogSensorMode()
Get the analog sensor mode.
Definition: SparkBase.cpp:1875
float GetCurrent() const
Gets the current drawn by the SPARK controller.
Definition: SparkBase.cpp:493
void ClearStickyFaults()
Clears sticky faults on the SPARK controller.
Definition: SparkBase.cpp:384
float GetPositionPIDMaxInput()
Get the position PID maximum input.
Definition: SparkBase.cpp:1309
bool GetAltEncoderInverted()
Get the alternate encoder inversion state.
Definition: SparkBase.cpp:1945
void SetSmartCurrentStallLimit(uint16_t limit)
Sets the smart current stall limit.
Definition: SparkBase.cpp:657
float GetSoftLimitFwd()
Get the forward soft limit value.
Definition: SparkBase.cpp:1571
void SetAnalogPositionConversion(float factor)
Sets the conversion factor for analog position readings.
Definition: SparkBase.cpp:1051
void SetF(uint8_t slot, float f)
Sets the feedforward gain for the specified PID slot.
Definition: SparkBase.cpp:722
void SetAnalogVelocityConversion(float factor)
Sets the conversion factor for analog velocity readings.
Definition: SparkBase.cpp:1056
void SetInverted(bool inverted)
Sets whether the motor is inverted.
Definition: SparkBase.cpp:572
uint8_t GetMotorType()
Get the motor type.
Definition: SparkBase.cpp:1155
void SetHardLimitRevEn(bool enable)
Enables or disables the reverse hard limit switch.
Definition: SparkBase.cpp:809
void SetSmartMotionAllowedClosedLoopError(uint8_t slot, float error)
Sets the allowed closed loop error for Smart Motion in the specified slot.
Definition: SparkBase.cpp:953
float GetSmartMotionMaxAccel(uint8_t slot)
Get the maximum acceleration for Smart Motion in a given slot.
Definition: SparkBase.cpp:1717
bool GetEncoderInverted()
Get the encoder inversion state.
Definition: SparkBase.cpp:1651
float GetSlot3Placeholder3(uint8_t slot)
Get the value for Slot 3 Placeholder 3 in a given slot.
Definition: SparkBase.cpp:1829
void SetOutputMin(uint8_t slot, float min)
Sets the output minimum for the specified PID slot.
Definition: SparkBase.cpp:770
float GetPositionPIDMinInput()
Get the position PID minimum input.
Definition: SparkBase.cpp:1299
uint16_t GetFeedbackSensorPID0()
Get the feedback sensor PID0 value.
Definition: SparkBase.cpp:1259
void SetFeedbackSensorPID0(uint16_t sensor)
Sets the feedback sensor for PID0.
Definition: SparkBase.cpp:607
uint8_t GetDutyCycleAverageDepth()
Get the duty cycle average depth.
Definition: SparkBase.cpp:2005
float GetSlot3Placeholder2(uint8_t slot)
Get the value for Slot 3 Placeholder 2 in a given slot.
Definition: SparkBase.cpp:1813
bool GetSoftLimitRevEn()
Get the reverse soft limit enable state.
Definition: SparkBase.cpp:1561
void SetPosition(float position)
Sets the motor's position.
Definition: SparkBase.cpp:411
bool GetPositionPIDWrapEnable()
Get the position PID wrap enable state.
Definition: SparkBase.cpp:1289
uint16_t GetMotorR()
Get the motor resistance.
Definition: SparkBase.cpp:1227
float GetVelocityConversionFactor()
Get the velocity conversion factor.
Definition: SparkBase.cpp:1671
uint16_t GetStickyFaults() const
Retrieves the sticky faults.
Definition: SparkBase.cpp:448
void SetDutyCycleInverted(bool inverted)
Sets whether the duty cycle encoder is inverted.
Definition: SparkBase.cpp:1132
float GetCompensatedNominalVoltage()
Get the compensated nominal voltage.
Definition: SparkBase.cpp:1279
void ResetFaults()
Resets all faults on the SPARK controller.
Definition: SparkBase.cpp:379
uint16_t GetMotorKv()
Get the motor Kv rating.
Definition: SparkBase.cpp:1217
uint16_t GetEncoderCountsPerRev()
Get the encoder counts per revolution.
Definition: SparkBase.cpp:1621
void SetInputMode(uint8_t mode)
Sets the input mode.
bool GetInverted() const
Checks if the motor is inverted.
Definition: SparkBase.cpp:454
void SetCurrent(float current)
Sets the motor's current.
Definition: SparkBase.cpp:421
void SetFollowerID(uint32_t id)
Sets the follower ID for this SparkBase.
Definition: SparkBase.cpp:846
void SetAnalogSensorMode(uint8_t mode)
Sets the analog sensor mode.
Definition: SparkBase.cpp:1066
uint16_t GetFaults() const
Retrieves the current faults.
Definition: SparkBase.cpp:442
void SetPositionPIDMinInput(float minInput)
Sets the minimum input for position PID.
Definition: SparkBase.cpp:628
void SetEncoderSampleDelta(uint8_t delta)
Sets the encoder sample delta.
Definition: SparkBase.cpp:868
float GetAnalogVoltage() const
Gets the current analog voltage.
Definition: SparkBase.cpp:510
float GetAltEncoderVelocityFactor()
Get the alternate encoder velocity factor.
Definition: SparkBase.cpp:1965
void SetI(uint8_t slot, float i)
Sets the integral gain for the specified PID slot.
Definition: SparkBase.cpp:690
float GetClosedLoopRampRate()
Get the closed loop ramp rate.
Definition: SparkBase.cpp:1611
bool GetHardLimitRevEn()
Get the reverse hard limit enable state.
Definition: SparkBase.cpp:1521
void SetSlot3Placeholder2(uint8_t slot, float value)
Sets a placeholder value for slot 3 (purpose undefined)
Definition: SparkBase.cpp:1017
void SetDutyCycleZeroOffset(float offset)
Sets the zero offset for the duty cycle encoder.
Definition: SparkBase.cpp:1148
void SetSmartVelocity(float smartVelocity)
Sets the motor's smart velocity.
Definition: SparkBase.cpp:406
void SetPolePairs(uint16_t pairs)
Sets the number of pole pairs for brushless motors.
Definition: SparkBase.cpp:640
bool GetHardLimitFwdEn()
Get the forward hard limit enable state.
Definition: SparkBase.cpp:1511
float GetInputDeadband()
Get the input deadband.
Definition: SparkBase.cpp:1185
void SetMotorL(uint16_t l)
Sets the motor inductance.
Definition: SparkBase.cpp:594
void SetAltEncoderVelocityFactor(float factor)
Sets the velocity factor for the alternate encoder.
Definition: SparkBase.cpp:1115
float GetDutyCycle() const
Retrieves the current applied output.
Definition: SparkBase.cpp:434
void SetSoftLimitFwd(float limit)
Sets the forward soft limit.
Definition: SparkBase.cpp:834
uint16_t GetMotorL()
Get the motor inductance.
Definition: SparkBase.cpp:1237
float GetAnalogPositionConversion()
Get the analog position conversion factor.
Definition: SparkBase.cpp:1845
void SetAltEncoderAverageDepth(uint8_t depth)
Sets the average depth for the alternate encoder.
Definition: SparkBase.cpp:1095
void SetMotorType(MotorType type)
Sets the motor type.
Definition: SparkBase.cpp:549
float GetSmartMotionAccelStrategy(uint8_t slot)
Get the acceleration strategy for Smart Motion in a given slot.
Definition: SparkBase.cpp:1765
uint16_t GetPolePairs()
Get the number of pole pairs.
Definition: SparkBase.cpp:1321
void SetAnalogAverageDepth(uint16_t depth)
Sets the average depth for analog readings.
Definition: SparkBase.cpp:1061
float GetP(uint8_t slot)
Get the proportional (P) constant for a given slot.
Definition: SparkBase.cpp:1383
void SetIZone(uint8_t slot, float iZone)
Sets the integral zone for the specified PID slot.
Definition: SparkBase.cpp:738
void SetSoftLimitRevEn(bool enable)
Enables or disables the reverse soft limit.
Definition: SparkBase.cpp:829
float GetAlternateEncoderPosition() const
Gets the position from the alternate encoder.
Definition: SparkBase.cpp:539
float GetDutyCycleVelocityFactor()
Get the duty cycle velocity factor.
Definition: SparkBase.cpp:1985
void SetVelocityConversionFactor(float factor)
Sets the velocity conversion factor.
Definition: SparkBase.cpp:883
void SetSlot3Placeholder3(uint8_t slot, float value)
Sets a placeholder value for slot 3 (purpose undefined)
Definition: SparkBase.cpp:1033
void SetDFilter(uint8_t slot, float dFilter)
Sets the derivative filter for the specified PID slot.
Definition: SparkBase.cpp:754
void BurnFlash()
Burns the current configuration to the SPARK controller's flash memory.
Definition: SparkBase.cpp:342
float GetSoftLimitRev()
Get the reverse soft limit value.
Definition: SparkBase.cpp:1581
float GetOutputMax(uint8_t slot)
Get the output maximum value for a given slot.
Definition: SparkBase.cpp:1495
void SetIdleMode(IdleMode mode)
Sets the idle mode.
Definition: SparkBase.cpp:561
void SetP(uint8_t slot, float p)
Sets the proportional gain for the specified PID slot.
Definition: SparkBase.cpp:674
float GetSlot3Placeholder1(uint8_t slot)
Get the value for Slot 3 Placeholder 1 in a given slot.
Definition: SparkBase.cpp:1797
float GetD(uint8_t slot)
Get the derivative (D) constant for a given slot.
Definition: SparkBase.cpp:1415
float GetHallSensorSampleRate()
Get the Hall sensor sample rate.
Definition: SparkBase.cpp:1681
uint8_t GetSensorType()
Get the sensor type.
Definition: SparkBase.cpp:1165
void SetFollowerConfig(uint32_t config)
Sets the follower configuration.
Definition: SparkBase.cpp:851
void SetSetpoint(float setpoint)
Sets the value for the currently set control type.
Definition: SparkBase.cpp:391
void SetDutyCycleVelocityFactor(float factor)
Sets the velocity factor for the duty cycle encoder.
Definition: SparkBase.cpp:1127
uint32_t GetFollowerID()
Get the follower ID.
Definition: SparkBase.cpp:1591
void Identify()
Triggers the SPARK controller to identify itself.
Definition: SparkBase.cpp:370
uint8_t GetEncoderSampleDelta()
Get the encoder sample delta.
Definition: SparkBase.cpp:1641
void SetSmartMotion(float smartMotion)
Sets the motor's smart motion.
Definition: SparkBase.cpp:426
void SetEncoderAverageDepth(uint8_t depth)
Sets the encoder average depth.
Definition: SparkBase.cpp:863
float GetDutyCyclePositionFactor()
Get the duty cycle position factor.
Definition: SparkBase.cpp:1975
float GetVoltage() const
Gets the current voltage of the SPARK controller.
Definition: SparkBase.cpp:485
void SetVoltage(float voltage)
Sets the motor's voltage.
Definition: SparkBase.cpp:416
void SetHallSensorSampleRate(float rate)
Sets the hall sensor sample rate.
Definition: SparkBase.cpp:893
float GetIZone(uint8_t slot)
Get the IZone value for a given slot.
Definition: SparkBase.cpp:1447
SparkBase(const std::string &interfaceName, uint8_t deviceId)
Initializes SparkBase with the specified CAN interface and ID.
Definition: SparkBase.cpp:11
void SetIMaxAccum(uint8_t slot, float maxAccum)
Sets the maximum accumulator value for the I term in the specified slot.
Definition: SparkBase.cpp:985
void SetCompensatedNominalVoltage(float voltage)
Sets the compensated nominal voltage.
Definition: SparkBase.cpp:618
void SetAltEncoderInverted(bool inverted)
Sets whether the alternate encoder is inverted.
Definition: SparkBase.cpp:1105
bool GetSoftLimitFwdEn()
Get the forward soft limit enable state.
Definition: SparkBase.cpp:1551
float GetVelocity() const
Gets the current velocity.
Definition: SparkBase.cpp:473
float GetSmartMotionAllowedClosedLoopError(uint8_t slot)
Get the allowed closed-loop error for Smart Motion in a given slot.
Definition: SparkBase.cpp:1749
void SetSlot3Placeholder1(uint8_t slot, float value)
Sets a placeholder value for slot 3 (purpose undefined)
Definition: SparkBase.cpp:1001
void SetSmartMotionMaxAccel(uint8_t slot, float maxAccel)
Sets the maximum acceleration for Smart Motion in the specified slot.
Definition: SparkBase.cpp:921
float GetSmartMotionMaxVelocity(uint8_t slot)
Get the maximum velocity for Smart Motion in a given slot.
Definition: SparkBase.cpp:1701
void SetPositionConversionFactor(float factor)
Sets the position conversion factor.
Definition: SparkBase.cpp:878
uint16_t GetCurrentChopCycles()
Get the current chop cycles.
Definition: SparkBase.cpp:1343
void SetDutyCycle(float dutyCycle)
Sets the motor's applied output.
Definition: SparkBase.cpp:396
float GetI(uint8_t slot)
Get the integral (I) constant for a given slot.
Definition: SparkBase.cpp:1399
uint8_t GetClosedLoopVoltageMode()
Get the closed loop voltage mode.
Definition: SparkBase.cpp:1269
void SetLimitSwitchRevPolarity(bool polarity)
Sets the polarity of the reverse limit switch.
Definition: SparkBase.cpp:819
bool IsFollower() const
Checks if the SPARK controller is in follower mode.
Definition: SparkBase.cpp:466
void FactoryDefaults()
Resets the SPARK controller to factory default settings.
Definition: SparkBase.cpp:351
void SetDataPortConfig(uint8_t config)
Configures the data port.
Definition: SparkBase.cpp:1084