![]() |
Laelaps
2.3.5
RoadNarrows Robotics Small Outdoor Mobile Robot Project
|
RobotClaw Motor Controller class. More...
Public Member Functions | |
def | __init__ (self) |
Constructor. | |
def | open (self, device, baudrate, fnChipSelect=None) |
Open connection to motor controller(s). More... | |
def | close (self) |
def | isOpen (self) |
def | noop (self, port, addrSel, addrLast) |
def | execCmdWithAckRsp (self, addr, cmdId, sCmdData, appendCrc=False) |
Execute command with acknowledgement response. More... | |
def | execCmdWithDataRsp (self, addr, cmdId, sCmdData, lenRsp, appendCrc=False) |
Execute command with data response. More... | |
def | packU8 (self, val) |
def | packS8 (self, val) |
def | packU16 (self, val) |
def | packS16 (self, val) |
def | packU32 (self, val) |
def | packS32 (self, val) |
def | unpackU8 (self, s) |
def | unpackS8 (self, s) |
def | unpackU16 (self, s) |
def | unpackS16 (self, s) |
def | unpackU32 (self, s) |
def | unpackS32 (self, s) |
def | crc16 (self, crc, buf) |
def | sendCmdHdr (self, addr, command) |
def | readU8 (self) |
def | readS8 (self) |
def | readU16 (self) |
def | readS16 (self) |
def | readU32 (self) |
def | readS32 (self) |
def | writeU8 (self, val) |
def | writeS8 (self, val) |
def | writeU16 (self, val) |
def | writeS16 (self, val) |
def | writeU32 (self, val) |
def | writeS32 (self, val) |
def | M1Forward (self, addr, val) |
Command: 0. | |
def | M1Backward (self, addr, val) |
Command: 1. | |
def | setMinMainBattery (self, addr, val) |
Command: 2. | |
def | setMaxMainBattery (self, addr, val) |
Command: 3. | |
def | M2Forward (self, addr, val) |
Command: 4. | |
def | M2Backward (self, addr, val) |
Command: 5. | |
def | DriveM1 (self, addr, val) |
Command: 6. | |
def | DriveM2 (self, addr, val) |
Command: 7. | |
def | ForwardMixed (self, addr, val) |
Command: 8. | |
def | BackwardMixed (self, addr, val) |
Command: 9. | |
def | RightMixed (self, addr, val) |
Command: 10. | |
def | LeftMixed (self, addr, val) |
Command: 11. | |
def | DriveMixed (self, addr, val) |
Command: 12. | |
def | TurnMixed (self, addr, val) |
Command: 13. | |
def | readM1Encoder (self, addr) |
Command: 16. | |
def | readM2Encoder (self, addr) |
Command: 17. | |
def | readM1Speed (self, addr) |
Command: 18. | |
def | readM2Speed (self, addr) |
Command: 19. | |
def | resetEncoderCnts (self, addr) |
Command: 20. | |
def | readVersion (self, addr) |
Command: 21. | |
def | readMainBattery (self, addr) |
Command: 24. | |
def | readLogicBattery (self, addr) |
Command: 25. | |
def | setM1Pidq (self, addr, p, i, d, qpps) |
Command: 28. | |
def | setM2Pidq (self, addr, p, i, d, qpps) |
Command: 29. | |
def | readM1instspeed (self, addr) |
Command: 30. | |
def | readM2instspeed (self, addr) |
Command: 31. | |
def | setM1Duty (self, addr, val) |
Command: 32. | |
def | setM2Duty (self, addr, val) |
Command: 33. | |
def | setMixedDuty (self, addr, m1, m2) |
Command: 34. | |
def | setM1Speed (self, addr, val) |
Command: 35. | |
def | setM2Speed (self, addr, val) |
Command: 36. | |
def | setMixedSpeed (self, addr, m1, m2) |
Command: 37. | |
def | setM1SpeedAccel (self, addr, accel, speed) |
Command: 38. | |
def | setM2SpeedAccel (self, addr, accel, speed) |
Command: 39. | |
def | setMixedSpeedAccel (self, addr, accel, speed1, speed2) |
Command: 40. | |
def | setM1SpeedDistance (self, addr, speed, distance, buffered) |
Command: 41. | |
def | setM2SpeedDistance (self, addr, speed, distance, buffered) |
Command: 42. | |
def | setMixedSpeedDistance (self, addr, speed1, distance1, speed2, distance2, buffered) |
Command: 43. | |
def | setM1SpeedAccelDistance (self, addr, accel, speed, distance, buffered) |
Command: 44. | |
def | setM2SpeedAccelDistance (self, addr, accel, speed, distance, buffered) |
Command: 45. | |
def | setMixedSpeedAccelDistance (self, addr, accel, speed1, distance1, speed2, distance2, buffered) |
Command: 46. | |
def | readBufferCnts (self, addr) |
Command: 47. | |
def | readCurrents (self, addr) |
Command: 49 Note: RoboClaw User Manual v5 error. More... | |
def | setMixedSpeedIAccel (self, addr, accel1, speed1, accel2, speed2) |
Command: 50. | |
def | setMixedSpeedIAccelDistance (self, addr, accel1, speed1, distance1, accel2, speed2, distance2, buffered) |
Command: 51. | |
def | setM1DutyAccel (self, addr, accel, duty) |
Command: 52. | |
def | setM2DutyAccel (self, addr, accel, duty) |
Command: 53. | |
def | setMixedDutyAccel (self, addr, accel1, duty1, accel2, duty2) |
Command: 54. | |
def | readM1Pidq (self, addr) |
Command: 55. | |
def | readM2Pidq (self, addr) |
Command: 56. | |
def | setMainBatterySettings (self, addr, minV, maxV) |
Command: 57. | |
def | setLogicBatterySettings (self, addr, minV, maxV) |
Command: 58. | |
def | readMainBatterySettings (self, addr) |
Command: 59. | |
def | readLogicBatterySettings (self, addr) |
Command: 60. | |
def | setM1PositionConstants (self, addr, kp, ki, kd, kimax, deadzone, minP, maxP) |
Command: 61. | |
def | setM2PositionConstants (self, addr, kp, ki, kd, kimax, deadzone, minP, maxP) |
Command: 62. | |
def | readM1PositionConstants (self, addr) |
Command: 63. | |
def | readM2PositionConstants (self, addr) |
Command: 64. | |
def | setM1SpeedAccelDeccelPosition (self, addr, accel, speed, deccel, position, buffered) |
Command: 65. | |
def | setM2SpeedAccelDeccelPosition (self, addr, accel, speed, deccel, position, buffered) |
Command: 66. | |
def | setMixedSpeedAccelDeccelPosition (self, addr, accel1, speed1, deccel1, position1, accel2, speed2, deccel2, position2, buffered) |
Command: 67. | |
def | readTemperature (self, addr) |
Command: 82. | |
def | readStatus (self, addr) |
Command: 90. | |
def | readEncoderMode (self, addr) |
Command: 91. | |
def | setM1EncoderMode (self, addr, mode) |
Command: 92. | |
def | setM2EncoderMode (self, addr, mode) |
Command: 93. | |
def | writeSettings (self, addr) |
Command: 94. | |
def | setM1MaxCurrentLimit (self, addr, maxAmps) |
Command: 133 Note: RoboClass User Manual v5 error. More... | |
def | setM2MaxCurrentLimit (self, addr, maxAmps) |
Command: 134 Note: RoboClass User Manual v5 error. More... | |
def | readM1MaxCurrentLimit (self, addr) |
Command: 135 Note: RoboClass User Manual v5 error. More... | |
def | readM2MaxCurrentLimit (self, addr) |
Command: 136 Note: RoboClass User Manual v5 error. More... | |
Public Attributes | |
m_checksum | |
m_port | |
checksum (deprecated) | |
m_addrLast | |
serial port | |
m_fnChipSelect | |
last address | |
m_isOpen | |
board chip select | |
RobotClaw Motor Controller class.
Definition at line 240 of file RoboClaw.py.
def Laelaps.RoboClaw.RoboClaw.execCmdWithAckRsp | ( | self, | |
addr, | |||
cmdId, | |||
sCmdData, | |||
appendCrc = False |
|||
) |
Execute command with acknowledgement response.
Command: addr cmdId [data] [crc16] Response: ack
Definition at line 296 of file RoboClaw.py.
References Laelaps.RoboClaw.RoboClaw.crc16(), motor::roboclaw::RoboClawComm.crc16(), Laelaps.Imu.Imu.packU16(), Laelaps.RoboClaw.RoboClaw.packU16(), Laelaps.Imu.Imu.unpackU8(), and Laelaps.RoboClaw.RoboClaw.unpackU8().
Referenced by Laelaps.RoboClaw.RoboClaw.BackwardMixed(), Laelaps.RoboClaw.RoboClaw.DriveM1(), Laelaps.RoboClaw.RoboClaw.DriveM2(), Laelaps.RoboClaw.RoboClaw.DriveMixed(), Laelaps.RoboClaw.RoboClaw.ForwardMixed(), Laelaps.RoboClaw.RoboClaw.LeftMixed(), Laelaps.RoboClaw.RoboClaw.M1Backward(), Laelaps.RoboClaw.RoboClaw.M1Forward(), Laelaps.RoboClaw.RoboClaw.M2Backward(), Laelaps.RoboClaw.RoboClaw.M2Forward(), Laelaps.RoboClaw.RoboClaw.resetEncoderCnts(), Laelaps.RoboClaw.RoboClaw.RightMixed(), Laelaps.RoboClaw.RoboClaw.setLogicBatterySettings(), Laelaps.RoboClaw.RoboClaw.setM1Duty(), Laelaps.RoboClaw.RoboClaw.setM1DutyAccel(), Laelaps.RoboClaw.RoboClaw.setM1EncoderMode(), Laelaps.RoboClaw.RoboClaw.setM1MaxCurrentLimit(), Laelaps.RoboClaw.RoboClaw.setM1Pidq(), Laelaps.RoboClaw.RoboClaw.setM1PositionConstants(), Laelaps.RoboClaw.RoboClaw.setM1Speed(), Laelaps.RoboClaw.RoboClaw.setM1SpeedAccel(), Laelaps.RoboClaw.RoboClaw.setM1SpeedAccelDeccelPosition(), Laelaps.RoboClaw.RoboClaw.setM1SpeedAccelDistance(), Laelaps.RoboClaw.RoboClaw.setM1SpeedDistance(), Laelaps.RoboClaw.RoboClaw.setM2Duty(), Laelaps.RoboClaw.RoboClaw.setM2DutyAccel(), Laelaps.RoboClaw.RoboClaw.setM2EncoderMode(), Laelaps.RoboClaw.RoboClaw.setM2MaxCurrentLimit(), Laelaps.RoboClaw.RoboClaw.setM2Pidq(), Laelaps.RoboClaw.RoboClaw.setM2PositionConstants(), Laelaps.RoboClaw.RoboClaw.setM2Speed(), Laelaps.RoboClaw.RoboClaw.setM2SpeedAccel(), Laelaps.RoboClaw.RoboClaw.setM2SpeedAccelDeccelPosition(), Laelaps.RoboClaw.RoboClaw.setM2SpeedAccelDistance(), Laelaps.RoboClaw.RoboClaw.setM2SpeedDistance(), Laelaps.RoboClaw.RoboClaw.setMainBatterySettings(), Laelaps.RoboClaw.RoboClaw.setMaxMainBattery(), Laelaps.RoboClaw.RoboClaw.setMinMainBattery(), Laelaps.RoboClaw.RoboClaw.setMixedDuty(), Laelaps.RoboClaw.RoboClaw.setMixedDutyAccel(), Laelaps.RoboClaw.RoboClaw.setMixedSpeed(), Laelaps.RoboClaw.RoboClaw.setMixedSpeedAccel(), Laelaps.RoboClaw.RoboClaw.setMixedSpeedAccelDeccelPosition(), Laelaps.RoboClaw.RoboClaw.setMixedSpeedAccelDistance(), Laelaps.RoboClaw.RoboClaw.setMixedSpeedDistance(), Laelaps.RoboClaw.RoboClaw.setMixedSpeedIAccel(), Laelaps.RoboClaw.RoboClaw.setMixedSpeedIAccelDistance(), Laelaps.RoboClaw.RoboClaw.TurnMixed(), and Laelaps.RoboClaw.RoboClaw.writeSettings().
def Laelaps.RoboClaw.RoboClaw.execCmdWithDataRsp | ( | self, | |
addr, | |||
cmdId, | |||
sCmdData, | |||
lenRsp, | |||
appendCrc = False |
|||
) |
Execute command with data response.
Command: addr cmdId [data...] [crc16] Response: data... crc16
Definition at line 324 of file RoboClaw.py.
References Laelaps.RoboClaw.RoboClaw.crc16(), motor::roboclaw::RoboClawComm.crc16(), Laelaps.RoboClaw.RoboClaw.m_addrLast, motor::roboclaw::RoboClawChipSelect.m_addrLast, Laelaps.RoboClaw.RoboClaw.m_checksum, Laelaps.RoboClaw.RoboClaw.m_fnChipSelect, Laelaps.Imu.Imu.m_port, Laelaps.RoboClaw.RoboClaw.m_port, Laelaps.Imu.Imu.unpackU16(), and Laelaps.RoboClaw.RoboClaw.unpackU16().
Referenced by Laelaps.RoboClaw.RoboClaw.readBufferCnts(), Laelaps.RoboClaw.RoboClaw.readCurrents(), Laelaps.RoboClaw.RoboClaw.readEncoderMode(), Laelaps.RoboClaw.RoboClaw.readLogicBattery(), Laelaps.RoboClaw.RoboClaw.readLogicBatterySettings(), Laelaps.RoboClaw.RoboClaw.readM1Encoder(), Laelaps.RoboClaw.RoboClaw.readM1instspeed(), Laelaps.RoboClaw.RoboClaw.readM1MaxCurrentLimit(), Laelaps.RoboClaw.RoboClaw.readM1Pidq(), Laelaps.RoboClaw.RoboClaw.readM1PositionConstants(), Laelaps.RoboClaw.RoboClaw.readM1Speed(), Laelaps.RoboClaw.RoboClaw.readM2Encoder(), Laelaps.RoboClaw.RoboClaw.readM2instspeed(), Laelaps.RoboClaw.RoboClaw.readM2MaxCurrentLimit(), Laelaps.RoboClaw.RoboClaw.readM2Pidq(), Laelaps.RoboClaw.RoboClaw.readM2PositionConstants(), Laelaps.RoboClaw.RoboClaw.readM2Speed(), Laelaps.RoboClaw.RoboClaw.readMainBattery(), Laelaps.RoboClaw.RoboClaw.readMainBatterySettings(), Laelaps.RoboClaw.RoboClaw.readStatus(), and Laelaps.RoboClaw.RoboClaw.readTemperature().
def Laelaps.RoboClaw.RoboClaw.open | ( | self, | |
device, | |||
baudrate, | |||
fnChipSelect = None |
|||
) |
Open connection to motor controller(s).
device | Serial device name. |
baudrate | Serial baud rate. |
fnChipSelect | Motor controller selection function. |
Definition at line 259 of file RoboClaw.py.
References Laelaps.RoboClaw.RoboClaw.m_addrLast, motor::roboclaw::RoboClawChipSelect.m_addrLast, Laelaps.RoboClaw.RoboClaw.m_checksum, Laelaps.RoboClaw.RoboClaw.m_fnChipSelect, Laelaps.RoboClaw.RoboClaw.m_isOpen, Laelaps.Imu.Imu.m_port, Laelaps.RoboClaw.RoboClaw.m_port, and Laelaps.RoboClaw.RoboClaw.noop().
def Laelaps.RoboClaw.RoboClaw.readCurrents | ( | self, | |
addr | |||
) |
Command: 49 Note: RoboClaw User Manual v5 error.
Values are signed 16 bits.
Definition at line 827 of file RoboClaw.py.
References Laelaps.RoboClaw.RoboClaw.execCmdWithDataRsp(), motor::roboclaw::RoboClawComm.execCmdWithDataRsp(), Laelaps.Imu.Imu.unpackU16(), and Laelaps.RoboClaw.RoboClaw.unpackU16().
def Laelaps.RoboClaw.RoboClaw.readM1MaxCurrentLimit | ( | self, | |
addr | |||
) |
Command: 135 Note: RoboClass User Manual v5 error.
Values are 32 bits.
Definition at line 1067 of file RoboClaw.py.
References Laelaps.RoboClaw.RoboClaw.execCmdWithDataRsp(), motor::roboclaw::RoboClawComm.execCmdWithDataRsp(), Laelaps.Imu.Imu.unpackU32(), and Laelaps.RoboClaw.RoboClaw.unpackU32().
def Laelaps.RoboClaw.RoboClaw.readM2MaxCurrentLimit | ( | self, | |
addr | |||
) |
Command: 136 Note: RoboClass User Manual v5 error.
Values are 32 bits.
Definition at line 1073 of file RoboClaw.py.
References Laelaps.RoboClaw.RoboClaw.execCmdWithDataRsp(), motor::roboclaw::RoboClawComm.execCmdWithDataRsp(), Laelaps.Imu.Imu.unpackU32(), and Laelaps.RoboClaw.RoboClaw.unpackU32().
def Laelaps.RoboClaw.RoboClaw.setM1MaxCurrentLimit | ( | self, | |
addr, | |||
maxAmps | |||
) |
Command: 133 Note: RoboClass User Manual v5 error.
Values are 32 bits.
Definition at line 1049 of file RoboClaw.py.
References Laelaps.RoboClaw.RoboClaw.execCmdWithAckRsp(), motor::roboclaw::RoboClawComm.execCmdWithAckRsp(), Laelaps.Imu.Imu.packU32(), and Laelaps.RoboClaw.RoboClaw.packU32().
def Laelaps.RoboClaw.RoboClaw.setM2MaxCurrentLimit | ( | self, | |
addr, | |||
maxAmps | |||
) |
Command: 134 Note: RoboClass User Manual v5 error.
Values are 32 bits.
Definition at line 1058 of file RoboClaw.py.
References Laelaps.RoboClaw.RoboClaw.execCmdWithAckRsp(), motor::roboclaw::RoboClawComm.execCmdWithAckRsp(), Laelaps.Imu.Imu.packU32(), and Laelaps.RoboClaw.RoboClaw.packU32().