INTRODUCTION
Overview
Download and Install
Quick Start
Documentation
Publications

NONFRAMEWORK CODE
Driver Interfaces
Drivers
Libraries
Utilities

FRAMEWORK CODE
Interfaces
Components
Libraries
Utilities

Full Software Listings

DEVELOPER
Tutorials
Examples
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

rmpdefs.h

00001 /*
00002  * Orca-Robotics Project: Components for robotics 
00003  *               http://orca-robotics.sf.net/
00004  * Copyright (c) 2004-2009 Alex Brooks, Alexei Makarenko, Tobias Kaupp
00005  *
00006  * This copy of Orca is licensed to you under the terms described in
00007  * the LICENSE file included in this distribution.
00008  *
00009  */
00010 #ifndef ORCA2_SEGWAY_RMP_CONFIGURATION_H
00011 #define ORCA2_SEGWAY_RMP_CONFIGURATION_H
00012 
00013 #include <string>
00014 
00015 // MESSAGE ID'S
00016 
00017 // Segway->CPU messages
00018 // warning: Segway manual refers to them as Message 1-8
00019 // we call them Message 0-7 to synch with 0x0400-407
00020 // 0x0400 = 1024
00021 #define RMP_CAN_ID_MSG0         0x0400
00022 #define RMP_CAN_ID_MSG1         0x0401
00023 #define RMP_CAN_ID_MSG2         0x0402
00024 #define RMP_CAN_ID_MSG3         0x0403
00025 #define RMP_CAN_ID_MSG4         0x0404
00026 #define RMP_CAN_ID_MSG5         0x0405
00027 #define RMP_CAN_ID_MSG6         0x0406
00028 #define RMP_CAN_ID_MSG7         0x0407
00029 
00030 // CPU->Segway message
00031 #define RMP_CAN_ID_SHUTDOWN     0x0412
00032 
00033 // CPU->Segway message
00034 #define RMP_CAN_ID_COMMAND      0x0413
00035 
00036 // CU->UI: CU Status message
00037 #define RMP_CAN_ID_STATUS       0x0680
00038 
00039 // UI->CU: RMP Heartbeat message
00040 #define RMP_CAN_ID_HEARTBEAT    0x0688
00041 
00042 // DATA MASKS
00043 
00044 // Mask for user interface battery voltage in the heartbeat message.
00045 #define RMP_CAN_MASK_HEARTBEAT_UIBAT_VOLTAGE    0x03F0
00046 
00047 // Mask for user interface battery status in the heartbeat message.
00048 #define RMP_CAN_MASK_HEARTBEAT_UIBAT_STATUS     0xC000
00049 
00050 // from table: Bitfield for Reset Integrators, see sec.2.2.2
00051 #define RMP_CAN_RESET_RIGHT           0x01
00052 #define RMP_CAN_RESET_LEFT            0x02
00053 #define RMP_CAN_RESET_YAW             0x04
00054 #define RMP_CAN_RESET_FOREAFT         0x08
00055 #define RMP_CAN_RESET_ALL             (RMP_CAN_RESET_RIGHT | \
00056                                       RMP_CAN_RESET_LEFT | \
00057                                       RMP_CAN_RESET_YAW | \
00058                                       RMP_CAN_RESET_FOREAFT)
00059 
00060 // CU STATUS WORD DEFINITIONS, see sec.2.4.1
00061 #define WORD1_SAFETY_SHUTDOWN_1                 0x0001
00062 #define WORD1_SAFETY_SHUTDOWN_1_STRING          "Safety Shutdown, type 1"
00063 #define WORD1_NOT_USED_0002                     0x0002
00064 #define WORD1_NOT_USED_0002_STRING              "Not Used"
00065 #define WORD1_SAFETY_SHUTDOWN_2                 0x0004
00066 #define WORD1_SAFETY_SHUTDOWN_2_STRING          "Safety Shutdown, type 2"
00067 #define WORD1_DISABLE_RESPONSE                  0x0008
00068 #define WORD1_DISABLE_RESPONSE_STRING           "Disable Response"
00069 #define WORD1_SPEED_LIMIT_4MPH                  0x0010
00070 #define WORD1_SPEED_LIMIT_4MPH_STRING           "Speed Limit to 4 mph"
00071 #define WORD1_SPEED_LIMIT_0MPH                  0x0020
00072 #define WORD1_SPEED_LIMIT_0MPH_STRING           "Speed Limit to 0 mph"
00073 #define WORD1_SYSTEM_INTEGRITY_FAULT            0x0040
00074 #define WORD1_SYSTEM_INTEGRITY_FAULT_STRING     "System Integrity Fault"
00075 #define WORD1_MOTORS_ENABLED                    0x0080
00076 #define WORD1_MOTORS_ENABLED_STRING             "Motors Enabled"
00077 #define WORD1_BALANCE_MODE                      0x0100
00078 #define WORD1_BALANCE_MODE_STRING               "Balance Mode"
00079 #define WORD1_YAW_TRANSIENT_FLAG                0x0200
00080 #define WORD1_YAW_TRANSIENT_FLAG_STRING         "Yaw Transient Flag"
00081 #define WORD1_EMPTY_BATTERY_HAZARD              0x0400
00082 #define WORD1_EMPTY_BATTERY_HAZARD_STRING       "Empty Battery Hazard"
00083 #define WORD1_NOT_USED_0800                     0x0800
00084 #define WORD1_NOT_USED_0800_STRING              "Not Used"
00085 #define WORD1_WHEEL_SLIP_FLAG                   0x1000
00086 #define WORD1_WHEEL_SLIP_FLAG_STRING            "Wheel Slip Flag"
00087 #define WORD1_MOTOR_FEEDBACK_FAULT              0x2000
00088 #define WORD1_MOTOR_FEEDBACK_FAULT_STRING       "Motor Feedback Fault"
00089 #define WORD1_LOW_BATTRY_HAZARD                 0x4000
00090 #define WORD1_LOW_BATTRY_HAZARD_STRING          "Low Battery Hazard"
00091 #define WORD1_NOT_USED_8000                     0x8000
00092 #define WORD1_NOT_USED_8000_STRING              "Not Used"
00093 
00094 
00095 #define WORD2_FOREAFT_PITCH_ANGLE_LIMIT_A       0x0001
00096 #define WORD2_FOREAFT_PITCH_ANGLE_LIMIT_A_STRING "Fore/Aft Pitch Angle Limit Exceeded (A)"
00097 #define WORD2_ESTOP_SWITCH_OPEN_A               0x0002
00098 #define WORD2_ESTOP_SWITCH_OPEN_A_STRING        "E-Stop Switch Open (A)"
00099 #define WORD2_POSITION_ERROR_LIMIT_A            0x0004
00100 #define WORD2_POSITION_ERROR_LIMIT_A_STRING     "Position Error Limit Exceeded (A)"
00101 #define WORD2_MAX_VELOCITY_A                    0x0008
00102 #define WORD2_MAX_VELOCITY_A_STRING             "Maximum Velocity Exceeded (A)"
00103 #define WORD2_BATTERY_EMPTY_A                   0x0010
00104 #define WORD2_BATTERY_EMPTY_A_STRING            "Battery Empty (A)"
00105 #define WORD2_BATTERY_TEMP_LIMIT_A              0x0020
00106 #define WORD2_BATTERY_TEMP_LIMIT_A_STRING       "Battery Temperature Out of Range (A)"
00107 #define WORD2_ROLL_ANGLE_LIMIT_A                0x0040
00108 #define WORD2_ROLL_ANGLE_LIMIT_A_STRING         "Roll Angle Limit Exceeded (A)"
00109 #define WORD2_LOW_BATTERY_BUS_VOLTAGE_A         0x0080
00110 #define WORD2_LOW_BATTERY_BUS_VOLTAGE_A_STRING  "Low Battery Bus Voltage (A)"
00111 #define WORD2_FOREAFT_PITCH_ANGLE_LIMIT_B       0x0100
00112 #define WORD2_FOREAFT_PITCH_ANGLE_LIMIT_B_STRING "Fore/Aft Pitch Angle Limit Exceeded (B)"
00113 #define WORD2_ESTOP_SWITCH_OPEN_B               0x0200
00114 #define WORD2_ESTOP_SWITCH_OPEN_B_STRING        "E-Stop Switch Open (B)"
00115 #define WORD2_POSITION_ERROR_LIMIT_B            0x0400
00116 #define WORD2_POSITION_ERROR_LIMIT_B_STRING     "Position Error Limit Exceeded (B)"
00117 #define WORD2_MAX_VELOCITY_B                    0x0800
00118 #define WORD2_MAX_VELOCITY_B_STRING             "Maximum Velocity Exceeded (B)"
00119 #define WORD2_BATTERY_EMPTY_B                   0x1000
00120 #define WORD2_BATTERY_EMPTY_B_STRING            "Battery Empty (B)"
00121 #define WORD2_BATTERY_TEMP_LIMIT_B              0x2000
00122 #define WORD2_BATTERY_TEMP_LIMIT_B_STRING       "Battery Temperature Out of Range (B)"
00123 #define WORD2_ROLL_ANGLE_LIMIT_B                0x4000
00124 #define WORD2_ROLL_ANGLE_LIMIT_B_STRING         "Roll Angle Limit Exceeded (B)"
00125 #define WORD2_LOW_BATTERY_BUS_VOLTAGE_B         0x8000
00126 #define WORD2_LOW_BATTERY_BUS_VOLTAGE_B_STRING  "Low Battery Bus Voltage (B)"
00127 
00128 // gain schedule for the balance controller
00129 #define RMP_GAIN_SCHEDULE_NORMAL    0
00130 #define RMP_GAIN_SCHEDULE_TALL      1
00131 #define RMP_GAIN_SCHEDULE_HEAVY     2
00132 
00133 // unit conversions from Data Reference, see sec.4
00134 
00135 // different models
00136 #define RMP_COUNT_PER_M_RMP50      40181.0
00137 #define RMP_COUNT_PER_M_RMP100     40181.0
00138 #define RMP_COUNT_PER_M_RMP200     33215.0
00139 #define RMP_COUNT_PER_M_RMP400     33215.0
00140 
00141 #define RMP_COUNT_PER_M_PER_S_RMP50  401.0
00142 #define RMP_COUNT_PER_M_PER_S_RMP100 401.0
00143 #define RMP_COUNT_PER_M_PER_S_RMP200 332.0
00144 #define RMP_COUNT_PER_M_PER_S_RMP400 332.0
00145 
00146 #define RMP_COUNT_PER_DEG          7.8
00147 #define RMP_COUNT_PER_DEG_PER_S    7.8
00148 #define RMP_COUNT_PER_DEG_PER_SS   7.8
00149 #define RMP_COUNT_PER_RAD          446.9071
00150 #define RMP_COUNT_PER_RAD_PER_S    446.9071
00151 #define RMP_COUNT_PER_RAD_PER_SS   446.9071
00152 // This is different from rotation and depends on geometry
00153 #define RMP_COUNT_PER_REV_RMP50    117031.0
00154 #define RMP_COUNT_PER_REV_RMP100   117031.0
00155 #define RMP_COUNT_PER_REV_RMP200   112644.0
00156 #define RMP_COUNT_PER_REV_RMP400   112644.0
00157 
00158 #define RMP_MAX_LATERAL_ACCELERATION 0.5*9.81
00159 #define RMP_MIN_SPEED_COUNTS_FOR_LATERAL_ACCEL_MODEL 518
00160 
00161 // main (CU) battery voltage
00162 #define RMP_BASE_COUNT_PER_VOLT      4.0
00163 
00164 // user interface battery voltage: volts=offset + n*counts
00165 #define RMP_UI_OFFSET               1.4
00166 #define RMP_UI_COEFF                0.0125
00167 // user interface battery status: low battery warning
00168 #define RMP_UI_LOW_WARNING          0x80
00169 // user interface battery status: empty battery shutdown
00170 #define RMP_UI_EMPTY_SHUTDOWN       0x40
00171 
00172 // motor torque
00173 #define RMP_COUNT_PER_NM_RMP50     1463.0
00174 #define RMP_COUNT_PER_NM_RMP100    1463.0
00175 #define RMP_COUNT_PER_NM_RMP200    1094.0
00176 #define RMP_COUNT_PER_NM_RMP400    1094.0
00177 #define RMP_SEC_PER_FRAME          0.01
00178 
00179 // limits
00180 
00181 // from page 7 of the manual  
00182 #define RMP_MAX_TRANS_VEL_COUNT     1176
00183 // This is for the latest ACFR-only firmware version
00184 #define RMP_MAX_ROT_VEL_COUNT       562
00185 // This is for the standard firmware (as of Feb 2008)
00186 // #define RMP_MAX_ROT_VEL_COUNT       1024
00187 
00188 #define RMP_MAX_ROT_VEL_RAD_PER_S   M_PI
00189 #define RMP_COUNT_PER_RAD_PER_S_CMD (RMP_MAX_ROT_VEL_COUNT/RMP_MAX_ROT_VEL_RAD_PER_S)
00190 
00191 // minimum powerbase (CU) battery voltage (V)
00192 #define RMP_BASE_MIN_VOLTAGE          66.0
00193 // minimum user interface (UI) battery voltage (V)
00194 #define RMP_UI_MIN_VOLTAGE          6.0
00195 
00196 // maximum time without incoming commands [s]
00197 #define RMP_COMMAND_TIMEOUT         0.4
00198 
00199 // misc
00200 #define RMP_GEOM_WHEEL_SEP          0.54
00201 
00202 #define RMP_CAN_DROPPED_PACKET      0x5A5A
00203 
00204 namespace segwayrmpacfr {
00205 
00206 enum RmpModel {
00207     RmpModel_50,
00208     RmpModel_100,
00209     RmpModel_200,
00210     RmpModel_400
00211 };
00212 std::string toString( RmpModel model );
00213 
00214 enum OperationalMode {
00215     OperationalModeDisabled=0,
00216     OperationalModeTractor=1,
00217     OperationalModeBalance=2
00218 };
00219 
00220 enum GainSchedule {
00221     GainScheduleNormal=0,
00222     GainScheduleTall=1,
00223     GainScheduleHeavy=2
00224 };
00225 
00226 enum BalanceLockout
00227 {
00228     BalanceAllowed=0,
00229     BalanceNotAllowed=1
00230 };
00231 
00232 enum ConfigurationCommand {
00233     ConfigutationCommandNone=0,
00234     ConfigurationCommandSetMaxVelocityScale=10,
00235     ConfigurationCommandSetMaxAccelerationScale=11,
00236     ConfigurationCommandSetMaxTurnrateScale=12,
00237     ConfigurationCommandSetGainSchedule=13,
00238     ConfigurationCommandSetCurrentLimitScale=14,
00239     ConfigurationCommandSetBalanceModeLockout=15,
00240     ConfigurationCommandSetOperationalMode=16,
00241     ConfigurationCommandResetIntegrators=50
00242 };
00243 std::string toString(ConfigurationCommand c);
00244 
00245 enum StatusFlag {
00246     // General Flags
00247     StatusFlagSafetyShutdownType1,
00248     StatusFlagSafetyShutdownType2,
00249     StatusFlagDisableResponse,
00250     StatusFlagSpeedLimitTo4Mph,
00251     StatusFlagSpeedLimitTo0Mph,
00252     StatusFlagSystemIntegrityFault,
00253     StatusFlagMotorsEnabled,
00254     StatusFlagBalanceMode,
00255     StatusFlagYawTransient,
00256     StatusFlagEmptyBatteryHazard,
00257     StatusFlagWheelSlip,
00258     StatusFlagMotorFeedbackFault,
00259     StatusFlagLowBatteryHazard,
00260 
00261     // Flags for side A
00262     StatusFlagForeAftPitchAngleLimitExceededA,
00263     StatusFlagEStopSwitchOpenA,
00264     StatusFlagPositionErrorLimitExceededA,
00265     StatusFlagMaxVelocityExceededA,
00266     StatusFlagBatteryEmptyA,
00267     StatusFlagBatteryTemperatureOutOfRangeA,
00268     StatusFlagRollAngleLimitExceededA,
00269     StatusFlagLowBatteryBusVoltageA,
00270 
00271     // Flags for side B
00272     StatusFlagForeAftPitchAngleLimitExceededB,
00273     StatusFlagEStopSwitchOpenB,
00274     StatusFlagPositionErrorLimitExceededB,
00275     StatusFlagMaxVelocityExceededB,
00276     StatusFlagBatteryEmptyB,
00277     StatusFlagBatteryTemperatureOutOfRangeB,
00278     StatusFlagRollAngleLimitExceededB,
00279     StatusFlagLowBatteryBusVoltageB
00280 };
00281 std::string toString(StatusFlag s);
00282 
00283 }
00284 
00285 #endif
 

Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)


Generated for Orca Robotics by  doxygen 1.4.5