Skip to content
Permalink
Browse files

Add support for Roboclaw with firmware v4.1.11 or newer.

  • Loading branch information...
ovaltineo committed Dec 29, 2015
1 parent ca9f1ee commit 4a344e8a8202694b7699bc1c8eec47c9651f7614
Showing with 221 additions and 52 deletions.
  1. +4 −4 Bluetooth.ino
  2. +7 −4 Motors.h
  3. +172 −21 Motors.ino
  4. +2 −2 Pushback.h
  5. +3 −0 README.txt
  6. +10 −5 SegwayClone.h
  7. +15 −8 SegwayClone.h.ovaltineo
  8. +8 −8 SegwayClone.ino
@@ -134,7 +134,7 @@ void processBluetooth(void)
}
else if (command=='c') // calibrate
{
#if defined(VOLTAGE_CHECK) || defined(ROBOCLAW_CONTROLLER) || defined(ROBOCLAW_ENCODER_CONTROLLER)
#if defined(VOLTAGE_CHECK) || defined(ROBOCLAW_CONTROLLER) || defined(ROBOCLAW_ENCODER_CONTROLLER) || defined(ROBOCLAW_CRC_CONTROLLER) || defined(ROBOCLAW_CRC_ENCODER_CONTROLLER)
if (Vf < 5 || (motor > -MOTOR_MAX/10 && motor < MOTOR_MAX/10)) // lock only if using USB power or speed is less than 1/10th of MOTOR_MAX
#else
if (motor > -MOTOR_MAX/10 && motor < MOTOR_MAX/10) // lock only if speed is less than 1/10th of MOTOR_MAX
@@ -145,7 +145,7 @@ void processBluetooth(void)
#ifndef POT_STEERING
initSteerSensor(CALIBRATE_YES); // initialize steering tilt sensor and calibrate
#endif
#if defined(VOLTAGE_CHECK) || defined(ROBOCLAW_CONTROLLER) || defined(ROBOCLAW_ENCODER_CONTROLLER)
#if defined(VOLTAGE_CHECK) || defined(ROBOCLAW_CONTROLLER) || defined(ROBOCLAW_ENCODER_CONTROLLER) || defined(ROBOCLAW_CRC_CONTROLLER) || defined(ROBOCLAW_CRC_ENCODER_CONTROLLER)
writeIntToEEPROM(EEPROM_VOLTAGE_REF_ADDR, Vi); // save voltage to EEPROM
writeIntToEEPROM(EEPROM_VOLTAGE_REF_SAVED_ADDR, PD_SAVED); // set save flag in EEPROM

@@ -323,7 +323,7 @@ void processBluetooth(void)
Serial3.write(steer >> 8);
Serial3.write(steer & 0xFF);

#if defined(TEMPERATURE_SENSORS) || defined(ROBOCLAW_CONTROLLER) || defined(ROBOCLAW_ENCODER_CONTROLLER)
#if defined(TEMPERATURE_SENSORS) || defined(ROBOCLAW_CONTROLLER) || defined(ROBOCLAW_ENCODER_CONTROLLER) || defined(ROBOCLAW_CRC_CONTROLLER) || defined(ROBOCLAW_CRC_ENCODER_CONTROLLER)
Serial3.write(temp1 >> 8);
Serial3.write(temp1 & 0xFF);

@@ -361,7 +361,7 @@ void processBluetooth(void)
status = status | 0b00000100;
if (board_angle < MIN_ANGLE || board_angle > MAX_ANGLE )
status = status | 0b00001000;
#if defined(TEMPERATURE_SENSORS) || defined(ROBOCLAW_CONTROLLER) || defined(ROBOCLAW_ENCODER_CONTROLLER)
#if defined(TEMPERATURE_SENSORS) || defined(ROBOCLAW_CONTROLLER) || defined(ROBOCLAW_ENCODER_CONTROLLER) || defined(ROBOCLAW_CRC_CONTROLLER) || defined(ROBOCLAW_CRC_ENCODER_CONTROLLER)
if (temp1 > MAX_TEMP || temp2 > MAX_TEMP)
status = status | 0b00010000;
#endif
@@ -127,9 +127,11 @@
#endif
#endif

#ifdef ROBOCLAW_CONTROLLER
#define MOTOR_MAX 1500
#define MOTOR_MAX_OFF 250 // MOTOR_MAX when rider sensor is OFF
#if defined(ROBOCLAW_CONTROLLER) || defined(ROBOCLAW_CRC_CONTROLLER)
// #define MOTOR_MAX 1500
// #define MOTOR_MAX_OFF 250 // MOTOR_MAX when rider sensor is OFF
#define MOTOR_MAX 32767
#define MOTOR_MAX_OFF 8192 // MOTOR_MAX when rider sensor is OFF

#define ROBOCLAW_ADDRESS 0x80

@@ -151,7 +153,7 @@
#endif
#endif

#ifdef ROBOCLAW_ENCODER_CONTROLLER
#if defined(ROBOCLAW_ENCODER_CONTROLLER) || defined(ROBOCLAW_CRC_ENCODER_CONTROLLER)
// #define MOTOR_MAX 40000
#define MOTOR_MAX 10000
#define MOTOR_MAX_OFF 10000 // MOTOR_MAX when rider sensor is OFF
@@ -163,6 +165,7 @@
#define M2_SPEED 36
#define READ_TEMP 82
#define READ_VOLT 24
#define READ_CURRENTS 49

#ifndef MEGA
// software serial pins for non-mega boards

0 comments on commit 4a344e8

Please sign in to comment.
You can’t perform that action at this time.