00001 00006 #ifndef JOINTCOMMANDSERIESELASTIC_H_ 00007 #define JOINTCOMMANDSERIESELASTIC_H_ 00008 00009 #include "robodyn_mechanisms/JointCommandInterface.h" 00010 #include "robot_instance/StringUtilities.h" 00011 #include "robodyn_utilities/EncoderStateCalculator.h" 00012 #include <boost/make_shared.hpp> 00013 00014 class JointCommandSeriesElastic : public JointCommandInterface 00015 { 00016 public: 00017 JointCommandSeriesElastic(const std::string& mechanism, IoFunctions ioFunctions); 00018 virtual ~JointCommandSeriesElastic(); 00019 00020 sensor_msgs::JointState getSimpleMeasuredState(); 00021 sensor_msgs::JointState getCompleteMeasuredState(); 00022 r2_msgs::JointCommand getCommandedState(); 00023 void setCommand(r2_msgs::JointCommand msg, r2_msgs::JointControlData); 00024 void updateMeasuredState(r2_msgs::JointControlData msg); 00025 void setFaultState(); 00026 00027 r2_msgs::JointCapability getCapability(); 00028 void loadCoeffs(); 00029 00030 protected: 00031 00033 std::string jointPositionStatusElement; 00034 std::string jointVelocityStatusElement; 00035 std::string jointCalculatedEffortElement; 00036 00038 std::string motorPositionStatusElement; 00039 std::string motorVelocityStatusElement; 00040 std::string motorCurrentElement; 00041 00043 std::string encoderPositionStatusElement; 00044 std::string encoderVelocityStatusElement; 00045 00047 std::string jointPositionFilteredStatusElement; 00048 std::string motorPositionFilteredStatusElement; 00049 00051 std::string encoderRawPositionStatusElement; 00052 std::string encoderTimeElement; 00053 std::string encoderTimeoutElement; 00054 00056 std::string hallPositionStatusElement; 00057 std::string hallRawPositionStatusElement; 00058 std::string hallTimeElement; 00059 std::string hallTimeoutElement; 00060 00062 std::string embeddedCommandPositionElement; 00063 std::string embeddedCommandVelocityElement; 00064 std::string embeddedCommandEffortElement; 00065 00066 std::string desiredPositionCommandElement; 00067 std::string desiredPositionVelocityLimitCommandElement; 00068 std::string feedForwardTorqueCommandElement; 00069 std::string proportionalGainCommandElement; 00070 std::string derivativeGainCommandElement; 00071 std::string integralGainCommandElement; 00072 std::string positionLoopTorqueLimitCommandElement; 00073 std::string positionLoopWindupLimitCommandElement; 00074 std::string torqueLoopVelocityLimitCommandElement; 00075 std::string brakePwmCommandElement; 00076 std::string motComLimitCommandElement; 00077 00078 double springConstant; 00079 double gearStiffness; 00080 double combinedStiffness; 00081 double jointKinematicOffset; 00082 double jointKinematicDirection; 00083 double jointGearRatio; 00084 double backEmfConstant; 00085 int32_t incEncNow; 00086 int32_t incEncPrev; 00087 int32_t incEncRef; 00088 double encPosRef; 00089 int32_t hallEncNow; 00090 int32_t hallEncPrev; 00091 int32_t hallEncRef; 00092 double hallPosRef; 00093 ros::Time timeNow; 00094 ros::Time timePrev; 00095 ros::Duration deltaTime; 00096 double deltaTimeSec; 00097 double deltaEncPos; 00098 double commandRate; 00099 00100 std::string motorName; 00101 std::string encoderName; 00102 std::string jointCalculatedName; 00103 std::string encoderCalculatedName; 00104 std::string hallsCalculatedName; 00105 std::string embeddedCommandName; 00106 00107 std::vector<double> positionVals; 00108 std::vector<double> velocityVals; 00109 std::vector<double> effortVals; 00110 00111 bool isInitialized; 00112 unsigned int completeMessageSize; 00113 00114 MotorEncoderStateCalculatorPtr motorEncoderStateCalculator; 00115 HallsEncoderStateCalculatorPtr hallsEncoderStateCalculator; 00116 }; 00117 00118 #endif /* JOINTCOMMANDSERIESELASTIC_H_ */