Go to the documentation of this file.00001
00002
00003
00004
00005
00006 #ifndef __DYNAMIXELCONFIG_H_INCLUDED__
00007 #define __DYNAMIXELCONFIG_H_INCLUDED__
00008
00009 #include "CDxlGeneric.h"
00010 #include "dynamixel/DynamixelSpecs.h"
00011 #include "CDxlGroup.h"
00012
00013
00014 #include <threemxl/platform/io/configuration/Configuration.h>
00015 #include <threemxl/platform/io/configuration/OptionVars.h>
00016
00017 #define DXLCONFIG_NUM_CALIBPOINTS 301
00018
00019
00020 #define DXL_NUM_POSITIONS DXL_RX28_NUM_POSITIONS
00021 #define DXL_MAX_POSITION DXL_RX28_MAX_POSITION
00022 #define DXL_SPEED_TO_RAD_S DXL_RX28_SPEED_TO_RAD_S
00023 #define DXL_STEPS_TO_RAD DXL_RX28_STEPS_TO_RAD
00024 #define DXL_TORQUE_TO_RATIO DXL_RX28_TORQUE_TO_RATIO
00025
00026
00027 #define DXL_MAX_RAD_S_SPEED (DXL_MAX_POSITION*DXL_SPEED_TO_RAD_S)
00028 #define DXL_MAX_RAD_ANGLE (DXL_MAX_POSITION*DXL_STEPS_TO_RAD)
00029
00030 #define MOTOR_CONSTANT_MULTIPLIER 10000
00031
00032 enum EDxlCalibType
00033 {
00034 dxlCtNone,
00035 dxlCtAuto,
00036 dxlCtManual
00037 };
00038
00039
00040 class CDxlGeneric;
00041
00045 class CDxlConfig
00046 {
00047 public:
00048
00049 COptionInt mID;
00050 std::string mDxlTypeStr;
00051 COptionInt mReturnDelay;
00052 COptionDouble mAngleLowerLimit;
00053 COptionDouble mAngleUpperLimit;
00054 COptionBool mClockwiseIsPositive;
00055
00056
00057 COptionDouble mVoltageLowerLimit;
00058 COptionDouble mVoltageUpperLimit;
00059 COptionChar mAlarmLED;
00060 COptionChar mAlarmShutdown;
00061 COptionByte mComplianceMargin;
00062 COptionByte mComplianceSlope;
00063 COptionInt mTempLimit;
00064 COptionBool mLED;
00065 COptionDouble mTorqueLimit;
00066 COptionDouble mNullAngle;
00067 COptionWord mPunch;
00068
00069
00070
00071 EDxlCalibType mCalibType;
00072 double mCalibData[DXLCONFIG_NUM_CALIBPOINTS];
00073 double mAngleLUT[DXL_NUM_POSITIONS];
00074
00075
00076 COptionByte m3mxlMode;
00077 COptionByte mWatchdogMode;
00078 COptionByte mWatchdogTime;
00079 COptionByte mWatchdogMult;
00080 COptionByte mStatusReturnLevel;
00081 COptionDouble mMotorConstant;
00082 COptionDouble mGearboxRatioMotor;
00083 COptionDouble mGearboxRatioJoint;
00084 COptionWord mEncoderCountMotor;
00085 COptionDouble mOffsetMotor;
00086 COptionDouble mMaxUninitialisedMotorCurrent;
00087 COptionDouble mMaxMotorCurrent;
00088 COptionWord mEncoderCountJoint;
00089 COptionDouble mOffsetJoint;
00090
00091
00092 COptionDouble mZeroLengthSpring;
00093 COptionDouble mSpringStiffness;
00094 COptionBool mJointClockWiseIsPositive;
00095 COptionDouble mAcceleration;
00096
00097 COptionDouble mMaxPeakMotorCurrent;
00098 COptionDouble mMaxContinuousMotorCurrent;
00099 COptionDouble mMotorWindingTimeConstant;
00100 COptionByte mEncoderIndexLevelMotor;
00101 COptionDouble mWheelDiameter;
00102
00103 COptionDouble mPCurrent, mICurrent, mDCurrent, mILCurrent;
00104 COptionDouble mPPosition, mIPosition, mDPosition, mILPosition;
00105 COptionDouble mPSpeed, mISpeed, mDSpeed, mILSpeed;
00106 COptionDouble mPEnergy, mIEnergy, mDEnergy, mILEnergy;
00107 COptionDouble mPTorque, mITorque, mDTorque, mILTorque;
00108
00109
00110 CDxlConfig();
00111 ~CDxlConfig();
00112
00113 CDxlConfig* setID(const int ID);
00114 bool readConfig(const CConfigSection &configNode);
00115 int configureDynamixel(CDxlGeneric* dxl);
00116 };
00117
00123 class CDxlGroupConfig
00124 {
00125 protected:
00126 CDxlConfig mDxlConfigs[MAX_NUM_DYNAMIXELS];
00127 int mNumDynamixels;
00128 public:
00129 CDxlGroupConfig() {mNumDynamixels=0;}
00130 int getNumDynamixels() {return mNumDynamixels;}
00131 CDxlConfig* getDynamixelConfig(const int index) {return &mDxlConfigs[index];}
00132
00133
00134 bool readFromXML(const std::string &filename);
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144 int addDynamixel(CDxlConfig* config)
00145 {
00146 mDxlConfigs[mNumDynamixels] = *config;
00147 return mNumDynamixels++;
00148 }
00149 };
00150
00151
00152 #endif //__DYNAMIXELCONFIG_H_INCLUDED__