Laelaps  2.3.5
RoadNarrows Robotics Small Outdoor Mobile Robot Project
Laelaps Motors

Classes

class  laelaps::LaeMotorCtlrChipSelect
 RoboClaw motor controller chip select class. More...
 

Functions

 laelaps::LaeMotorCtlrChipSelect::LaeMotorCtlrChipSelect ()
 Default constructor.
 
virtual laelaps::LaeMotorCtlrChipSelect::~LaeMotorCtlrChipSelect ()
 Destructor.
 
virtual int laelaps::LaeMotorCtlrChipSelect::open (int pinGpio)
 Open GPIO pin interface. More...
 
virtual int laelaps::LaeMotorCtlrChipSelect::close ()
 Close GPIO pin interface. More...
 
virtual bool laelaps::LaeMotorCtlrChipSelect::isOpen ()
 Test if connection is open. More...
 
virtual void laelaps::LaeMotorCtlrChipSelect::select (int fd, byte_t addrSel)
 Motor controller select function. More...
 

Variables

static const char *const laelaps::LaeKeyFront = "front"
 front
 
static const char *const laelaps::LaeKeyRear = "rear"
 rear
 
static const char *const laelaps::LaeKeyLeftFront = "left_front"
 left front
 
static const char *const laelaps::LaeKeyRightFront = "right_front"
 right front
 
static const char *const laelaps::LaeKeyLeftRear = "left_rear"
 left rear
 
static const char *const laelaps::LaeKeyRightRear = "right_rear"
 right rear
 
static const int laelaps::LaeMotorIdNone = -1
 no motor id
 
static const int laelaps::LaeMotorIdLF = 0
 left front
 
static const int laelaps::LaeMotorIdRF = 1
 right front
 
static const int laelaps::LaeMotorIdLR = 2
 left rear
 
static const int laelaps::LaeMotorIdRR = 3
 right rear
 
static const int laelaps::LaeMotorsNumOf = 4
 number of motors
 
static const int laelaps::LaeMotorCtlrIdNone = -1
 no motor controller id
 
static const int laelaps::LaeMotorCtlrIdFront = 0
 front motor controller
 
static const int laelaps::LaeMotorCtlrIdRear = 1
 rear motor controller
 
static const int laelaps::LaeNumMotorCtlrs = 2
 number of motor controllers
 
static const byte_t laelaps::LaeMotorCtlrAddrFront = motor::roboclaw::AddrMin
 front motor controller address
 
static const byte_t laelaps::LaeMotorCtlrAddrRear = motor::roboclaw::AddrMin + 1
 rear motor controller address
 
static const int laelaps::LaeMotorLeft = motor::roboclaw::Motor1
 left motors
 
static const int laelaps::LaeMotorRight = motor::roboclaw::Motor2
 right motors
 
static const int laelaps::LaeNumMotorsPerCtlr = motor::roboclaw::NumMotors
 number of motors/controller
 
static const int laelaps::LaeMotorDirNormal = motor::roboclaw::MotorDirNormal
 normal
 
static const int laelaps::LaeMotorDirReverse = motor::roboclaw::MotorDirReverse
 reverse
 
static const int laelaps::LaeMotorAlarmNone = 0x00
 no alarms
 
static const int laelaps::LaeMotorAlarmCurrent = 0x01
 under/over current
 
static const int laelaps::LaeMotorAlarmVoltage = 0x02
 under/over voltage
 
static const int laelaps::LaeMotorAlarmEStop = 0x04
 emergency stopped
 
static const int laelaps::LaeMotorAlarmTemp = 0x08
 over temperature
 
static const int laelaps::LaeMotorAlarmFault = 0x10
 motor drive fault
 
static const int laelaps::LaeMotorWarnNone = 0x00
 no warnings
 
static const int laelaps::LaeMotorWarnCurrent = 0x01
 over current
 
static const int laelaps::LaeMotorWarnTemp = 0x02
 over temperature
 
static const int laelaps::LaeMotorWarnVoltage = 0x04
 under/over voltage
 
static const int laelaps::LaeQuadPulsesPerRev = 64
 pulses/motor revolution
 
static const double laelaps::LaeMotorGearRatio = 30.0
 gear ratio
 
static const double laelaps::LaeMotorRatedMaxRpm = 350.0
 max output shaft rpm
 
static const double laelaps::LaeMotorStallTorque = 0.776771
 stall torque (N-m) @5A
 
static const double laelaps::LaeMotorRatedAmps = 5.0
 motor rated max amps.
 
static const double laelaps::LaeMotorMaxAmps = 30.0
 max amp limit/motor
 
static const double laelaps::LaeMotorMaxAmps_2_0 = 2.5
 max amp limit/motor
 
static const double laelaps::LaeMotorMaxAmps_2_1 = 5.0
 max amp limit/motor
 
static const byte_t laelaps::LaeMotorCtlrChipSelect::LaeMotorCtlrCsHigh = LaeMotorCtlrAddrFront
 motor controller address associated with high signal
 
static const byte_t laelaps::LaeMotorCtlrChipSelect::LaeMotorCtlrCsLow = LaeMotorCtlrAddrRear
 motor controller address associated with low signal
 
int laelaps::LaeMotorCtlrChipSelect::m_pinGpio
 
int laelaps::LaeMotorCtlrChipSelect::m_fdGpio
 

Detailed Description

Laelaps motors, encoders, and controllers.

The Laelaps currently uses Ion Motion Control's RoboClaw 30A motor controllers. The motors are...

The Laelaps two motor controllers control two motors each. The motors are attached to the internal side of the body and drive independent wheel-tire assemblies. The front controller controls the left-front and right-front wheels, while the back controller controls the left-rear and right-rear wheels.

The left side motors are mounted to the body such that they have normal sense of rotation. The right side motors have reverse sense.

Function Documentation

int LaeMotorCtlrChipSelect::close ( )
virtual

Close GPIO pin interface.

Returns
On success, OK(0) is returned.
On error, RC_ERROR(-1) is returned.

Definition at line 98 of file laeMotor.cxx.

Referenced by Laelaps.WatchDog.WatchDog::attach(), and Laelaps.WatchDog.WatchDog::open().

99 {
100  int rc;
101 
102  if( m_fdGpio >= 0 )
103  {
104  rc = gpioClose(m_fdGpio);
105  }
106 
107  m_pinGpio = -1;
108  m_fdGpio = -1;
109 
110  return rc == OK? LAE_OK: -LAE_ECODE_IO;
111 }
static const int LAE_ECODE_IO
I/O error.
Definition: laelaps.h:98
static const int LAE_OK
not an error, success
Definition: laelaps.h:71
int LaeMotorCtlrChipSelect::open ( int  pinGpio)
virtual

Open GPIO pin interface.

Parameters
pinGpioThe sysfs exported GPIO number.
Returns
On success, OK(0) is returned.
On error, RC_ERROR(-1) is returned.

Definition at line 83 of file laeMotor.cxx.

84 {
85  if( (m_fdGpio = gpioOpen(pinGpio)) < 0 )
86  {
87  LOGERROR("Failed to open motor controllers chip select on GPIO pin %d.",
88  pinGpio);
89 
90  return -LAE_ECODE_NO_RSRC;
91  }
92 
93  m_pinGpio = pinGpio;
94 
95  return LAE_OK;
96 }
static const int LAE_ECODE_NO_RSRC
no resource available error
Definition: laelaps.h:83
static const int LAE_OK
not an error, success
Definition: laelaps.h:71
void LaeMotorCtlrChipSelect::select ( int  fd,
byte_t  addrSel 
)
virtual

Motor controller select function.

The motor controllers are on a multi-drop serial bus. Serial does not support multiple tx drivers on the same bus. Since there are two motor controllers, each with a transmit line (odroid receive), the select function disconnects one tx while connects the target tx.

Parameters
fdOpen serial file descriptor.
addrSelTarget motor controller to be selected. Controllers are identified by their address.

Reimplemented from motor::roboclaw::RoboClawChipSelect.

Definition at line 113 of file laeMotor.cxx.

Referenced by laelaps::LaeMotorCtlrChipSelect::isOpen().

114 {
115  int value;
116 
117  if( addrSel != m_addrLast )
118  {
119  value = addrSel == LaeMotorCtlrCsHigh? 1: 0;
120  if( gpioQuickWrite(m_fdGpio, value) < 0 )
121  {
122  LOGWARN("Failed to select motor controller 0x%02x.", addrSel);
123  }
124  usleep(100);
125 
126  RoboClawChipSelect::select(fd, addrSel);
127  }
128 }
byte_t m_addrLast
last selected motor controller, id&#39;d by address
Definition: RoboClaw.h:472
static const byte_t LaeMotorCtlrCsHigh
motor controller address associated with high signal
Definition: laeMotor.h:194