![]() |
Laelaps
2.3.5
RoadNarrows Robotics Small Outdoor Mobile Robot Project
|
RoboClaw 2 motor controller class. More...
#include <RoboClaw.h>
Public Member Functions | |
RoboClaw (RoboClawComm &comm, const byte_t address=AddrDft, const std::string &strNameId="RoboClaw") | |
Initialization constructor. More... | |
virtual | ~RoboClaw () |
Destructor. | |
virtual bool | probe (byte_t address) |
Probe address of motor controller. More... | |
RoboClawComm & | getComm () |
Get RoboClaw's bound communication object. More... | |
bool | isOpen () const |
Test if connection is open. More... | |
byte_t | getAddress () const |
Get the controller address associated with this class instance. More... | |
void | setAddress (byte_t address) |
Set class instance address. More... | |
std::string | getNameId () const |
Get class instance name identifier. More... | |
void | setNameId (const std::string &strNameId) |
Set class instance name identifier. More... | |
virtual byte_t | getMotorDir (int motor) const |
Get the direction of motor rotation. More... | |
virtual void | setMotorDir (int motor, int motorDir) |
set the direction of motor rotation. More... | |
void | getMainBattCutoffRange (double &minmin, double &maxmax) const |
Get the RoboClaw's main battery minimum and maximum voltage cutoff settable range. More... | |
void | getLogicCutoffRange (double &minmin, double &maxmax) const |
Get the RoboClaw's logic minimum and maximum voltage cutoff settable range. More... | |
virtual int | cmdReadFwVersion (std::string &strFwVer) |
Read the RoboClaw's firmware version. More... | |
virtual int | cmdReadMainBattVoltage (double &volts) |
Read the RoboClaw's main battery input voltage. More... | |
virtual int | cmdReadMainBattCutoffs (double &min, double &max) |
Read the RoboClaw's main battery minimum and maximum voltage cutoff settings. More... | |
virtual int | cmdSetMainBattCutoffs (const double min, const double max) |
Set the RoboClaw's main battery minimum and maximum voltage cutoff settings. More... | |
virtual int | cmdReadLogicVoltage (double &volts) |
Read the RoboClaw's LB-/LB+ terminals input voltage powered by and optional logic dedicated battery. More... | |
virtual int | cmdReadLogicCutoffs (double &min, double &max) |
Read the RoboClaw's optional logic dedicated battery minimum and maximum voltage cutoff settings. The battery is connected to the LB-/LB+ terminals. More... | |
virtual int | cmdSetLogicCutoffs (const double min, const double max) |
Set the RoboClaw's optional logic dedicated battery minimum and maximum voltage cutoff settings. The battery is connected to the LB-/LB+ terminals. More... | |
virtual int | cmdReadVelocityPidConst (int motor, u32_t &Kp, u32_t &Ki, u32_t &Kd, u32_t &qpps) |
Read motor's velocity PID constants. More... | |
virtual int | cmdSetVelocityPidConst (int motor, const u32_t Kp, const u32_t Ki, const u32_t Kd, const u32_t qpps) |
Set motor's velocity PID constants. More... | |
virtual int | cmdReadMotorCurrentDraw (double &s1, double &s2) |
Read the motors ampere draw. More... | |
virtual int | cmdReadMotorMaxCurrentLimit (int motor, double &maxAmps) |
Read a motor's maximum current limit. More... | |
virtual int | cmdSetMotorMaxCurrentLimit (int motor, const double maxAmps) |
Set a motor's maximum current limit. More... | |
virtual int | cmdReadBoardTemperature (double &temp) |
Read RoboClaw board's temperature. More... | |
virtual int | cmdReadStatus (uint_t &status) |
Read RoboClaw board's status bits. More... | |
virtual int | cmdReadCmdBufLengths (uint_t &len1, uint_t &len2) |
Read RoboClaw board's temperature. More... | |
virtual int | cmdReadEncoderMode (byte_t &mode1, byte_t &mode2) |
Read encoder mode. More... | |
virtual int | cmdSetEncoderMode (int motor, byte_t mode) |
Set a motor's encoder mode. More... | |
virtual int | cmdSetEncoderMode2 (byte_t mode1, byte_t mode2) |
Set both motors' encoder mode. More... | |
virtual int | cmdResetQEncoders () |
Reset both motors' encoders. More... | |
virtual int | cmdReadQEncoder (int motor, s64_t &encoder) |
Read motor's encoder. More... | |
virtual int | cmdDutyDrive2 (double duty1, double duty2) |
Drive both motors at the given duty cycle. More... | |
virtual int | cmdReadQSpeed (int motor, s32_t &speed) |
Read motor's speed. More... | |
virtual int | cmdQDrive (int motor, s32_t speed) |
Drive a motor at the given speed. More... | |
virtual int | cmdQDrive2 (s32_t speed1, s32_t speed2) |
Drive both motors at the given speeds. More... | |
virtual int | cmdQDriveWithAccel (int motor, s32_t speed, u32_t accel) |
Drive a motor at the given speed and with the given acceleration. More... | |
virtual int | cmdQDriveWithAccel (s32_t speed1, u32_t accel1, s32_t speed2, u32_t accel2) |
Drive both motors at the given speeds and with the given accelerations. More... | |
virtual int | cmdQDriveForDist (int motor, s32_t speed, u32_t dist, bool bQueue=true) |
Drive a motor at the given speed for a given distance. More... | |
virtual int | cmdQDriveForDist (s32_t speed1, u32_t dist1, s32_t speed2, u32_t dist2, bool bQueue=true) |
Drive both motors at the given speeds for a given distances. More... | |
virtual int | cmdQDriveWithAccelForDist (int motor, s32_t speed, u32_t accel, u32_t dist, bool bQueue=true) |
Drive a motor at the given speed with the given acceleration for the given distance. More... | |
virtual int | cmdQDriveWithAccelForDist (s32_t speed1, u32_t accel1, u32_t dist1, s32_t speed2, u32_t accel2, u32_t dist2, bool bQueue=true) |
Drive both motors at the given speeds with the given accelerations for the given distances. More... | |
virtual int | cmdQDriveWithProfileToPos (int motor, s32_t speed, u32_t accel, u32_t deccel, s32_t pos, bool bQueue=true) |
Drive a motor at the given speed with the given acceleration/ decceleration profile to the given absolute position. More... | |
virtual int | cmdQDriveWithProfileToPos (s32_t speed1, u32_t accel1, u32_t deccel1, s32_t pos1, s32_t speed2, u32_t accel2, u32_t deccel2, s32_t pos2, bool bQueue=true) |
Drive both motors at the given speeds with the given acceleration/decceleration profile to the given absolute position. More... | |
virtual int | cmdQStop () |
Stop both motors. More... | |
virtual int | cmdSDrive (int motor, int speed) |
Drive a motor at the given speed. More... | |
virtual int | cmdSDrive2 (int speed1, int speed2) |
Drive both motors at the given speeds. More... | |
virtual int | cmdStop (int motor) |
Stop a motor. More... | |
virtual int | cmdStopWithDecel (int motor, u32_t decel) |
Stop a motor with the given maximum decelerations. More... | |
virtual int | cmdStop () |
Stop all motors. More... | |
virtual int | cmdStopWithDecel (u32_t decel) |
Stop both motors with the given maximum decelerations. More... | |
virtual int | cmdEStop () |
Emergency stop all motors. More... | |
virtual int | cmdWriteSettingsToEEPROM () |
Write all settings to EEPROM. More... | |
Protected Member Functions | |
virtual bool | isValidMotor (int motor) const |
Test if motor index is a valid index. More... | |
Static Protected Member Functions | |
static int | abs (int a) |
Integer absolute value. More... | |
static int | cap (int a, int min, int max) |
Cap value within limits [min, max]. More... | |
static double | fcap (double a, double min, double max) |
Cap FPN value within limits [min, max]. More... | |
Protected Attributes | |
RoboClawComm & | m_comm |
bound communication object | |
byte_t | m_address |
assigned controller address | |
std::string | m_strNameId |
controller name identifier | |
int | m_nMotorDir [NumMotors] |
motor rotation direction sense | |
s64_t | m_nEncPrev [NumMotors] |
encoder prevous values | |
s64_t | m_nEncoder [NumMotors] |
64-bit encoder shadow values | |
RoboClaw 2 motor controller class.
RoboClaw by Ion Motion Control.
Definition at line 808 of file RoboClaw.h.
RoboClaw::RoboClaw | ( | RoboClawComm & | comm, |
const byte_t | address = AddrDft , |
||
const std::string & | strNameId = "RoboClaw" |
||
) |
Initialization constructor.
comm | Bound controller communication object. |
address | Motor controller address. |
strNameId | Motor controller name identifier. |
Definition at line 567 of file RoboClaw.cxx.
|
inlinestaticprotected |
Integer absolute value.
a | Integer value. |
Definition at line 1683 of file RoboClaw.h.
|
inlinestaticprotected |
Cap value within limits [min, max].
a | Value. |
min | Minimum. |
max | Maximum. |
Definition at line 1697 of file RoboClaw.h.
|
virtual |
Drive both motors at the given duty cycle.
Motor quadrature encoders are ignored.
Command Numbers: 34
duty1 | Motor1 normalized duty cycle [-1.0, 1.0]. Sign indicates direction. |
duty2 | Motor2 normalized duty cycle [-1.0, 1.0]. Sign indicates direction. |
Definition at line 1297 of file RoboClaw.cxx.
References ROBOCLAW_TRY_MOTOR.
Referenced by laelaps::LaeKinActionDutyCycle::execute(), and laelaps::LaeKinActionDutyCycle::terminate().
|
virtual |
Emergency stop all motors.
Command Numbers: 37
Definition at line 1729 of file RoboClaw.cxx.
References motor::roboclaw::CmdWriteEEPROM.
|
virtual |
Drive a motor at the given speed.
Movement is controlled using quadrature encoders.
Command Numbers: 35, 36
motor | Motor index Motor1(0) or Motor2(1). |
speed | Motor speed in quad pulses per second. Sign indicates direction. |
Definition at line 1356 of file RoboClaw.cxx.
References motor::roboclaw::CmdDriveQ.
|
virtual |
Drive both motors at the given speeds.
Movement is controlled using quadrature encoders.
Command Numbers: 37
speed1 | Motor1 speed in quad pulses per second. Sign indicates direction. |
speed2 | Motor2 speed in quad pulses per second. Sign indicates direction. |
Definition at line 1378 of file RoboClaw.cxx.
References motor::roboclaw::CmdDriveQAccelMot1, motor::roboclaw::CmdDriveQAccelMot2, and ROBOCLAW_TRY_MOTOR.
|
virtual |
Drive a motor at the given speed for a given distance.
Movement is controlled using quadrature encoders.
This is a buffered command. Commands execute immediatly if no commands are already in the motor drive queue or if the queue paramter is false. Otherwise, the command is placed at end of the command buffer execution queue.
Command Numbers: 41, 42
motor | Motor index Motor1(0) or Motor2(1). |
speed | Motor speed in quad pulses per second. Sign indicates direction. |
dist | Distance from current position (quad pulses). |
bQueue | Do [not] queue the command. If false, the motor drive queue is flushed and any existing command is preempted by this command. |
Definition at line 1449 of file RoboClaw.cxx.
|
virtual |
Drive both motors at the given speeds for a given distances.
Movement is controlled using quadrature encoders.
This is a buffered command. Commands execute immediatly if no commands are already in the motor drive queue or if the queue paramter is false. Otherwise, the command is placed at end of the command buffer execution queue.
Command Numbers: 43
speed1 | Motor1 speed in quad pulses per second. Sign indicates direction. |
dist1 | Motor1 distance from current position (quad pulses). |
speed2 | Motor2 speed in quad pulses per second. Sign indicates direction. |
dist2 | Motor2 distance from current position (quad pulses). |
bQueue | Do [not] queue the command. If false, the motor drive queue is flushed and any existing command is preempted by this command. |
Definition at line 1473 of file RoboClaw.cxx.
References motor::roboclaw::CmdBufDriveQDist, and ROBOCLAW_TRY_MOTOR.
|
virtual |
Drive a motor at the given speed and with the given acceleration.
Movement is controlled using quadrature encoders.
Command Numbers: 38, 39
motor | Motor index Motor1(0) or Motor2(1). |
speed | Motor speed in quad pulses per second. Sign indicates direction. |
accel | Acceleration (qpps/s). |
Definition at line 1399 of file RoboClaw.cxx.
References motor::roboclaw::CmdDriveQAccel2.
Referenced by laelaps::LaeKinActionVelocity::execute(), and laelaps::LaeKinActionTwist::execute().
|
virtual |
Drive both motors at the given speeds and with the given accelerations.
Movement is controlled using quadrature encoders.
Command Numbers: 50
speed1 | Motor1 speed in quad pulses per second. Sign indicates direction. |
accel1 | Motor1 acceleration (qpps/s). |
speed2 | Motor2 speed in quad pulses per second. Sign indicates direction. |
accel2 | Motor2 acceleration (qpps/s). |
Definition at line 1421 of file RoboClaw.cxx.
References motor::roboclaw::CmdBufDriveQDistMot1, motor::roboclaw::CmdBufDriveQDistMot2, and ROBOCLAW_TRY_MOTOR.
|
virtual |
Drive a motor at the given speed with the given acceleration for the given distance.
Movement is controlled using quadrature encoders.
This is a buffered command. Commands execute immediatly if no commands are already in the motor drive queue or if the queue paramter is false. Otherwise, the command is placed at end of the command buffer execution queue.
Command Numbers: 44, 45
motor | Motor index Motor1(0) or Motor2(1). |
speed | Speed in quad pulses per second. Sign indicates direction. |
accel | Acceleration (qpps/s). |
dist | Distance from current position (quad pulses). |
bQueue | Do [not] queue the command. If false, the motor drive queue is flushed and any existing command is preempted by this command. |
Definition at line 1504 of file RoboClaw.cxx.
References motor::roboclaw::CmdBufDriveQAccelDistMot1, and motor::roboclaw::CmdBufDriveQAccelDistMot2.
|
virtual |
Drive both motors at the given speeds with the given accelerations for the given distances.
Movement is controlled using quadrature encoders.
This is a buffered command. Commands execute immediatly if no commands are already in the motor drive queue or if the queue paramter is false. Otherwise, the command is placed at end of the command buffer execution queue.
Command Numbers: 51
speed1 | Motor1 peed in quad pulses per second. Sign indicates direction. |
accel1 | Motor1 acceleration (qpps/s). |
dist1 | Motor1 distance from current position (quad pulses). |
speed2 | Motor2 peed in quad pulses per second. Sign indicates direction. |
accel2 | Motor2 acceleration (qpps/s). |
dist2 | Motor2 distance from current position (quad pulses). |
bQueue | Do [not] queue the command. If false, the motor drive queue is flushed and any existing command is preempted by this command. |
Definition at line 1536 of file RoboClaw.cxx.
References ROBOCLAW_TRY_MOTOR.
|
virtual |
Drive a motor at the given speed with the given acceleration/ decceleration profile to the given absolute position.
Movement is controlled using quadrature encoders.
This is a buffered command. Commands execute immediatly if no commands are already in the motor drive queue or if the queue paramter is false. Otherwise, the command is placed at end of the command buffer execution queue.
Command Numbers: 65, 66
motor | Motor index Motor1(0) or Motor2(1). |
speed | Speed in quad pulses per second. Sign indicates direction. |
accel | Acceleration (qpps/s). |
deccel | Decceleration (qpps/s). |
pos | Goal absolute position (quad pulses). |
bQueue | Do [not] queue the command. If false, the motor drive queue is flushed and any existing command is preempted by this command. |
Definition at line 1577 of file RoboClaw.cxx.
References motor::roboclaw::CmdBufDriveQProfPosMot1, and motor::roboclaw::CmdBufDriveQProfPosMot2.
|
virtual |
Drive both motors at the given speeds with the given acceleration/decceleration profile to the given absolute position.
Movement is controlled using quadrature encoders.
This is a buffered command. Commands execute immediatly if no commands are already in the motor drive queue or if the queue paramter is false. Otherwise, the command is placed at end of the command buffer execution queue.
Command Numbers: 67
speed1 | Motor1 speed in quad pulses per second. Sign indicates direction. |
accel1 | Motor1 acceleration (qpps/s). |
deccel1 | Motor1 decceleration (qpps/s). |
pos1 | Motor1 goal absolute position (quad pulses). |
speed2 | Motor2 speed in quad pulses per second. Sign indicates direction. |
accel2 | Motor2 acceleration (qpps/s). |
deccel2 | Motor2 decceleration (qpps/s). |
pos2 | Motor2 goal absolute position (quad pulses). |
bQueue | Do [not] queue the command. If false, the motor drive queue is flushed and any existing command is preempted by this command. |
Definition at line 1613 of file RoboClaw.cxx.
References laelaps::cap(), motor::roboclaw::CmdBufDriveQProfPos, and ROBOCLAW_TRY_MOTOR.
|
inlinevirtual |
Stop both motors.
Movement is controlled using quadrature encoders, with 0 being stop.
Command Numbers: 37
Definition at line 1543 of file RoboClaw.h.
|
virtual |
Read RoboClaw board's temperature.
Command Numbers: 82
[out] | temp | Board temperature (C) |
Definition at line 1034 of file RoboClaw.cxx.
References motor::roboclaw::CmdReadStatus.
|
virtual |
Read RoboClaw board's temperature.
Command Numbers: 47
[out] | len1 | Motor1 command buffer length. |
[out] | len2 | Motor2 command buffer length. |
Definition at line 1075 of file RoboClaw.cxx.
References motor::roboclaw::CmdReadEncoderMode.
|
virtual |
Read encoder mode.
Command Numbers: 91
[out] | mode1 | Motor1 encoder mode. |
[out] | mode2 | Motor2 encoder mode. |
Definition at line 1100 of file RoboClaw.cxx.
References motor::roboclaw::CmdSetEncoderModeMot1, motor::roboclaw::CmdSetEncoderModeMot2, and ROBOCLAW_TRY_MOTOR.
|
virtual |
Read the RoboClaw's firmware version.
Command Numbers: 21
[out] | strFwVer | Read version string. |
Definition at line 608 of file RoboClaw.cxx.
References motor::roboclaw::CmdReadMainBattVolt.
|
virtual |
Read the RoboClaw's optional logic dedicated battery minimum and maximum voltage cutoff settings. The battery is connected to the LB-/LB+ terminals.
Command Numbers: 60
[out] | min | Minimum voltage (V). |
[out] | max | Maximum voltage (V). |
Definition at line 900 of file RoboClaw.cxx.
References laelaps::fcap(), and ROBOCLAW_DBG.
|
virtual |
Read the RoboClaw's LB-/LB+ terminals input voltage powered by and optional logic dedicated battery.
Command Numbers: 25
[out] | volts | Voltage (V). |
Definition at line 873 of file RoboClaw.cxx.
|
virtual |
Read the RoboClaw's main battery minimum and maximum voltage cutoff settings.
Command Numbers: 59
[out] | min | Minimum voltage (V). |
[out] | max | Maximum voltage (V). |
Definition at line 694 of file RoboClaw.cxx.
References laelaps::fcap(), and ROBOCLAW_DBG.
|
virtual |
Read the RoboClaw's main battery input voltage.
Command Numbers: 24
[out] | volts | Voltage (V). |
Definition at line 667 of file RoboClaw.cxx.
|
virtual |
Read the motors ampere draw.
Command Numbers: 49
[out] | amps1 | Motor1 current draw (amperes) |
[out] | amps2 | Motor2 current draw (amperes) |
Definition at line 761 of file RoboClaw.cxx.
References motor::roboclaw::CmdReadMaxCurrentMot1, and motor::roboclaw::CmdReadMaxCurrentMot2.
|
virtual |
Read a motor's maximum current limit.
Command Numbers: 136, 137
motor | Motor index Motor1(0) or Motor2(1). | |
[out] | maxAmps | Motor maximum current limit (amperes) |
Definition at line 793 of file RoboClaw.cxx.
|
virtual |
Read motor's encoder.
Command Numbers: 16, 17
motor | Motor index Motor1(0) or Motor2(1). | |
[out] | encoder | Unsigned encoder value (quad pulses). |
[out] | status | Status bits indicating sign, and over/under flow. |
Definition at line 1174 of file RoboClaw.cxx.
References motor::roboclaw::CmdDriveDuty, motor::roboclaw::CmdReadEncoderMot1, and motor::roboclaw::CmdReadEncoderMot2.
|
virtual |
Read motor's speed.
Command Numbers: 18, 19
motor | Motor index Motor1(0) or Motor2(1). | |
[out] | speed | Signed speed value (qpps). |
Definition at line 1323 of file RoboClaw.cxx.
References motor::roboclaw::CmdDriveQMot1, motor::roboclaw::CmdDriveQMot2, motor::roboclaw::CmdReadSpeedMot1, motor::roboclaw::CmdReadSpeedMot2, ROBOCLAW_DBG_MSG, and ROBOCLAW_TRY_MOTOR.
|
virtual |
Read RoboClaw board's status bits.
Command Numbers: 90
[out] | status | Board status bits. |
Definition at line 1055 of file RoboClaw.cxx.
References motor::roboclaw::CmdReadBufLen.
|
virtual |
Read motor's velocity PID constants.
Command Numbers: 55, 56
motor | Motor index Motor1(0) or Motor2(1). | |
[out] | Kp | Velocity PID proportional constant. |
[out] | Ki | Velocity PID intergral constant. |
[out] | Kd | Velocity PID derivative constant. |
[out] | qpps | Maximum speed of motor. |
Definition at line 958 of file RoboClaw.cxx.
References motor::roboclaw::CmdReadVelPidMot1, motor::roboclaw::CmdReadVelPidMot2, and ROBOCLAW_DBG.
|
virtual |
Reset both motors' encoders.
Command Numbers: 20
Definition at line 1152 of file RoboClaw.cxx.
|
virtual |
Drive a motor at the given speed.
Speeds are scaled from [-max, max] with 0 being stop.
Command Numbers: 0, 1, 4, 5
motor | Motor index Motor1(0) or Motor2(1). |
speed | Scaled speed [MotorSpeedMaxBackward(-127),MotorSpeedMaxForward(127)]. Sign indicates direction. |
Definition at line 1662 of file RoboClaw.cxx.
References motor::roboclaw::CmdDriveBackwardMot1, motor::roboclaw::CmdDriveBackwardMot2, motor::roboclaw::CmdDriveForwardMot1, motor::roboclaw::CmdDriveForwardMot2, and motor::roboclaw::MsgWithCrc.
|
virtual |
Drive both motors at the given speeds.
Compatibility command. Speeds are scaled from [-max, max] with < 0, 0, > 0 being backwards, stop, and forwards, respectively.
Command Numbers: 0, 1, 4, 5
speed1 | Motor1 scaled speed [MotorSpeedMaxBackward(-127),MotorSpeedMaxForward(127)]. Sign indicates direction. |
speed2 | Motor2 scaled speed [MotorSpeedMaxBackward(-127),MotorSpeedMaxForward(127)]. Sign indicates direction. |
Definition at line 1689 of file RoboClaw.cxx.
|
virtual |
Set a motor's encoder mode.
The new values are set in volatile memory only. To save to non-volatile memory, issue a write settings to EEPROM command.
Command Numbers: 92, 93
motor | Motor index Motor1(0) or Motor2(1). |
mode | Motor encoder mode. |
Definition at line 1123 of file RoboClaw.cxx.
|
virtual |
Set both motors' encoder mode.
The new values are set in volatile memory only. To save to non-volatile memory, issue a write settings to EEPROM command.
Command Numbers: 92, 93
mode1 | Motor1 encoder mode. |
mode2 | Motor2 encoder mode. |
Definition at line 1139 of file RoboClaw.cxx.
References motor::roboclaw::CmdResetEncoderCntrs, and motor::roboclaw::MsgWithCrc.
|
virtual |
Set the RoboClaw's optional logic dedicated battery minimum and maximum voltage cutoff settings. The battery is connected to the LB-/LB+ terminals.
Note: The minimum value is always set to 0 (6.0V) on power-up. RDK: The documention is conflicted here. 3.0V or 6.0V?
The new values are set in volatile memory only. To save to non-volatile memory, issue a write settings to EEPROM command.
Command Numbers: 58
[in] | min | Minimum voltage (V). |
[in] | max | Maximum voltage (V). |
Definition at line 927 of file RoboClaw.cxx.
References motor::roboclaw::CmdSetLogicCutoffs.
|
virtual |
Set the RoboClaw's main battery minimum and maximum voltage cutoff settings.
Note: The minimum value is always set to 0 (6.0V) on power-up.
The new values are set in volatile memory only. To save to non-volatile memory, issue a write settings to EEPROM command.
Command Numbers: 57
[in] | min | Minimum voltage (V). |
[in] | max | Maximum voltage (V). |
Definition at line 721 of file RoboClaw.cxx.
References motor::roboclaw::CmdReadMotorDraw, and motor::roboclaw::CmdSetMainBattCutoffs.
|
virtual |
Set a motor's maximum current limit.
Command Numbers: 134, 135
motor | Motor index Motor1(0) or Motor2(1). |
maxAmps | Motor maximum current limit (amperes) |
Definition at line 832 of file RoboClaw.cxx.
References motor::roboclaw::CmdReadLogicVolt, motor::roboclaw::CmdSetMaxCurrentMot1, and motor::roboclaw::CmdSetMaxCurrentMot2.
|
virtual |
Set motor's velocity PID constants.
The new values are set in volatile memory only. To save to non-volatile memory, issue a write settings to EEPROM command.
Command Numbers: 28, 29
motor | Motor index Motor1(0) or Motor2(1). | |
[in] | Kp | Velocity PID proportional constant. |
[in] | Ki | Velocity PID intergral constant. |
[in] | Kd | Velocity PID derivative constant. |
[in] | qpps | Maximum speed of motor. |
Definition at line 997 of file RoboClaw.cxx.
References motor::roboclaw::CmdReadTemp, motor::roboclaw::CmdSetVelPidMot1, and motor::roboclaw::CmdSetVelPidMot2.
|
virtual |
Stop a motor.
Compatibility command.
Command Numbers: 35, 36
motor | Motor index Motor1(0) or Motor2(1). |
Definition at line 1705 of file RoboClaw.cxx.
|
virtual |
Stop all motors.
Compatibility command.
Command Numbers: 37
Definition at line 1717 of file RoboClaw.cxx.
|
virtual |
Stop a motor with the given maximum decelerations.
Stopping is controlled using velocity PID and quadrature encoders.
Compatibility command.
Command Numbers: 38, 39
motor | Motor index Motor1(0) or Motor2(1). |
decel | Deceleration (qpps/s). |
Definition at line 1711 of file RoboClaw.cxx.
Referenced by laelaps::LaeKinActionVelocity::terminate(), and laelaps::LaeKinActionTwist::terminate().
|
virtual |
Stop both motors with the given maximum decelerations.
Stopping is controlled using velocity PID and quadrature encoders.
Compatibility command.
Command Numbers: 50
decel | Deceleration (qpps/s). |
Definition at line 1723 of file RoboClaw.cxx.
|
virtual |
|
inlinestaticprotected |
Cap FPN value within limits [min, max].
a | Value. |
min | Minimum. |
max | Maximum. |
Definition at line 1711 of file RoboClaw.h.
|
inline |
Get the controller address associated with this class instance.
Definition at line 872 of file RoboClaw.h.
|
inline |
Get RoboClaw's bound communication object.
Definition at line 852 of file RoboClaw.h.
void RoboClaw::getLogicCutoffRange | ( | double & | minmin, |
double & | maxmax | ||
) | const |
Get the RoboClaw's logic minimum and maximum voltage cutoff settable range.
[out] | minmin | Minimum minimum voltage (V). |
[out] | maxmax | Maximum maximum voltage (V). |
Definition at line 893 of file RoboClaw.cxx.
References motor::roboclaw::CmdReadLogicCutoffs.
void RoboClaw::getMainBattCutoffRange | ( | double & | minmin, |
double & | maxmax | ||
) | const |
Get the RoboClaw's main battery minimum and maximum voltage cutoff settable range.
[out] | minmin | Minimum minimum voltage (V). |
[out] | maxmax | Maximum maximum voltage (V). |
Definition at line 687 of file RoboClaw.cxx.
References motor::roboclaw::CmdReadMainBattCutoffs.
|
inlinevirtual |
Get the direction of motor rotation.
The motor direction is a software construct to apply a normal or reverse the sense of forward/backward rotation.
motor | Motor index Motor1(0) or Motor2(1). |
Definition at line 921 of file RoboClaw.h.
|
inline |
Get class instance name identifier.
Definition at line 895 of file RoboClaw.h.
|
inline |
Test if connection is open.
Definition at line 862 of file RoboClaw.h.
Referenced by Laelaps.WatchDog.WatchDog::cmdConfigDPin(), Laelaps.WatchDog.WatchDog::cmdEnableAuxPort5V(), Laelaps.WatchDog.WatchDog::cmdEnableAuxPortBatt(), Laelaps.WatchDog.WatchDog::cmdEnableMotorCtlrs(), Laelaps.WatchDog.WatchDog::cmdGetFwVersion(), Laelaps.WatchDog.WatchDog::cmdPetTheDog(), Laelaps.WatchDog.WatchDog::cmdReadAPin(), Laelaps.WatchDog.WatchDog::cmdReadDPin(), Laelaps.WatchDog.WatchDog::cmdReadEnables(), Laelaps.WatchDog.WatchDog::cmdReadVoltages(), Laelaps.WatchDog.WatchDog::cmdResetRgbLed(), Laelaps.WatchDog.WatchDog::cmdSetAlarms(), Laelaps.WatchDog.WatchDog::cmdSetBatterySoC(), Laelaps.WatchDog.WatchDog::cmdSetRgbLed(), and Laelaps.WatchDog.WatchDog::cmdWriteDPin().
|
inlineprotectedvirtual |
Test if motor index is a valid index.
motor | Motor index Motor1(0) or Motor2(1). |
Definition at line 1671 of file RoboClaw.h.
|
virtual |
Probe address of motor controller.
A weakness of the RoboClaw controller firmware is that there is no way to fetch its assigned address. The probe function uses a read-only command to determine, by proxy, whether the address is the controller's address. A false outcome is assumed if no response is received.
address | Motor controller address to test. |
Definition at line 588 of file RoboClaw.cxx.
References motor::roboclaw::CmdReadFwVersion.
|
inline |
Set class instance address.
address | Motor controller address. |
Definition at line 885 of file RoboClaw.h.
|
inlinevirtual |
set the direction of motor rotation.
The motor direction is a software construct to apply a normal or reverse the sense of forward/backward rotation.
motor | Motor index Motor1(0) or Motor2(1). |
motorDir | Motor direction MotorDirNormal(1) or MotorDirReverse(-1). |
Definition at line 943 of file RoboClaw.h.
|
inline |
Set class instance name identifier.
strNameId | Motor controller name identifier. |
Definition at line 905 of file RoboClaw.h.