103 std::cout <<
"Can not read Serial Number from FTS!" << std::endl;
108 std::cout <<
"Can not read Firmware version from FTS!" << std::endl;
113 std::cout <<
"Can not read Counts Per Unit from FTS!" << std::endl;
118 std::cout <<
"Can not read Unit Codes from FTS!" << std::endl;
127 std::cout <<
"CAN initialisation unsuccessful!" << std::endl;
157 std::cout <<
"\n\n*********FTSerialNumber**********" << std::endl;
167 replyMsg.
set(0, 0, 0, 0, 0, 0, 0, 0);
173 std::cout <<
"reply ID: \t" << std::hex << replyMsg.
getID() << std::endl;
174 std::cout <<
"reply Length: \t" << replyMsg.
getLength() << std::endl;
179 std::cout <<
"Reading Serial Number Succeeded!" << std::endl;
180 std::cout <<
"reply Data: \t" << (char)replyMsg.
getAt(0) <<
" " << (char)replyMsg.
getAt(1) <<
" " 181 << (char)replyMsg.
getAt(2) <<
" " << (char)replyMsg.
getAt(3) <<
" " << (char)replyMsg.
getAt(4) <<
" " 182 << (char)replyMsg.
getAt(5) <<
" " << (char)replyMsg.
getAt(6) <<
" " << (char)replyMsg.
getAt(7)
189 std::cout <<
"Error: Received wrong opcode!" << std::endl;
197 std::cout <<
"ForceTorqueCtrl::ReadFTSerialNumber(): Can not read message!" << std::endl;
204 std::cout <<
"ForceTorqueCtrl::ReadFTSerialNumber(): Can not transmit message!" << std::endl;
214 std::cout <<
"\n\n*********Read Counts Per Unit**********" << std::endl;
217 float countsPerForce = 0, countsPerTorque = 0;
232 std::cout <<
"reply ID: \t" << std::hex << replyMsg.
getID() << std::endl;
233 std::cout <<
"reply Length: \t" << replyMsg.
getLength() << std::endl;
238 std::cout <<
"Reading Counts Per Unit Succeeded!" << std::endl;
239 std::cout <<
"reply Data: \t" << (char)replyMsg.
getAt(0) <<
" " << (char)replyMsg.
getAt(1) <<
" " 240 << (char)replyMsg.
getAt(2) <<
" " << (char)replyMsg.
getAt(3) <<
" " << (char)replyMsg.
getAt(4) <<
" " 241 << (char)replyMsg.
getAt(5) <<
" " << (char)replyMsg.
getAt(6) <<
" " << (char)replyMsg.
getAt(7)
248 std::cout <<
"Error: Received wrong opcode!" << std::endl;
257 countsPerForce =
intbBuf.value;
263 countsPerTorque =
intbBuf.value;
267 std::cout <<
"ForceTorqueCtrl::ReadCountsPerUnit(): Can not read message!" << std::endl;
272 std::cout <<
"ForceTorqueCtrl::ReadCountsPerUnit(): Can not transmit message!" << std::endl;
275 std::cout <<
"CountsPerforce: " << countsPerForce <<
" CountsPerTorque: " << countsPerTorque << std::endl;
283 std::cout <<
"\n\n*********Read Unit Codes**********" << std::endl;
300 std::cout <<
"reply ID: \t" << std::hex << replyMsg.
getID() << std::endl;
301 std::cout <<
"reply Length: \t" << replyMsg.
getLength() << std::endl;
306 std::cout <<
"Reading Unit codes Succeed!" << std::endl;
307 std::cout <<
"reply Data: \t" << replyMsg.
getAt(0) <<
" " << replyMsg.
getAt(1) << std::endl;
313 std::cout <<
"ForceTorqueCtrl::ReadUnitCodes(): Can not read message!" << std::endl;
318 std::cout <<
"ForceTorqueCtrl::ReadUnitCodes(): Can not transmit message!" << std::endl;
328 std::cout <<
"\n\n*******Read Diagnostic ADC Voltages on index: " << index <<
"********" << std::endl;
335 CMsg.
setAt(index, 0);
346 std::cout <<
"reply ID: \t" << std::hex << replyMsg.
getID() << std::endl;
347 std::cout <<
"reply Length: \t" << replyMsg.
getLength() << std::endl;
352 std::cout <<
"Reading Diagnostic ADC Voltage succeed!" << std::endl;
353 std::cout <<
"ADC Voltage of diagnostic value " << index <<
" : " << replyMsg.
getAt(0) <<
" " 354 << replyMsg.
getAt(1) << std::endl;
362 std::cout <<
"Error: Received wrong opcode!" << std::endl;
365 std::cout <<
"Error: Receiving Message failed!" << std::endl;
369 std::cout <<
"ForceTorqueCtrl::readDiagnosticADCVoltages(byte index): Can not transmit message!" << std::endl;
378 std::cout <<
"\n\n*******Setting Active Calibration Matrix Num to: " << num <<
"********" << std::endl;
395 std::cout <<
"reply ID: \t" << std::hex << replyMsg.
getID() << std::endl;
396 std::cout <<
"reply Length: \t" << replyMsg.
getLength() << std::endl;
401 std::cout <<
"Setting Calibration Matrix succeed!" << std::endl;
402 std::cout <<
"Calibration Matrix: " << replyMsg.
getAt(0) <<
" is Activ!" << std::endl;
408 std::cout <<
"Error: Received wrong opcode!" << std::endl;
415 std::cout <<
"Error: Receiving Message failed!" << std::endl;
421 std::cout <<
"ForceTorqueCtrl::SetActiveCalibrationMatrix(int num): Can not transmit message!" << std::endl;
431 std::cout <<
"\n\n*******Setting Baud Rate value to: " << value <<
"********" << std::endl;
437 CMsg.
setAt(value, 0);
448 std::cout <<
"reply ID: \t" << std::hex << replyMsg.
getID() << std::endl;
449 std::cout <<
"reply Length: \t" << replyMsg.
getLength() << std::endl;
454 std::cout <<
"Send Baud Rate value: " << CMsg.
getAt(0) <<
"!" << std::endl;
455 std::cout <<
"Setting Baud Rate succeed!" << std::endl;
460 std::cout <<
"Error: Received wrong opcode!" << std::endl;
466 std::cout <<
"Error: Receiving Message failed!" << std::endl;
472 std::cout <<
"ForceTorqueCtrl::SetBaudRate(int value): Can not transmit message!" << std::endl;
481 std::cout <<
"\n\n******* Reseting the NETCANOEM ********" << std::endl;
491 std::cout <<
"ForceTorqueCtrl::Reset(): Can not transmit message!" << std::endl;
503 std::cout <<
"\n\n*******Setting Base Identifier value to HEX : " << std::hex << identifier <<
" ********" 510 CMsg.
setAt(identifier, 0);
521 std::cout <<
"reply ID: \t" << std::hex << replyMsg.
getID() << std::endl;
522 std::cout <<
"reply Length: \t" << replyMsg.
getLength() << std::endl;
527 std::cout <<
"Setting Base Identifier succeed!" << std::endl;
528 std::cout <<
"Send Base Identifier value: " << std::hex << CMsg.
getAt(0) <<
"!" << std::endl;
534 std::cout <<
"Error: Received wrong opcode!" << std::endl;
540 std::cout <<
"Error: Receiving Message failed!" << std::endl;
546 std::cout <<
"ForceTorqueCtrl::SetBaseIdentifier(int identifier): Can not transmit message!" << std::endl;
555 Eigen::VectorXf vCoef(6);
586 std::cout <<
"\n\n*******Read Matrix**********" << std::endl;
588 float statusCode = 0, sg0 = 0.0, sg1 = 0.0, sg2 = 0.0, sg3 = 0.0, sg4 = 0.0, sg5 = 0.0;
598 std::cout <<
"Error: Requesting Calibration Matrix!" << std::endl;
607 std::cout <<
"reply ID: \t" << std::hex << replyMsg.
getID() << std::endl;
608 std::cout <<
"reply Length: \t" << replyMsg.
getLength() << std::endl;
613 std::cout <<
"Reading Matrix Succeeded!" << std::endl;
614 std::cout <<
"reply Data: \t" << replyMsg.
getAt(0) <<
" " << replyMsg.
getAt(1) <<
" " << replyMsg.
getAt(2) <<
" " 615 << replyMsg.
getAt(3) <<
" " << replyMsg.
getAt(4) <<
" " << replyMsg.
getAt(5) <<
" " << replyMsg.
getAt(6)
616 <<
" " << replyMsg.
getAt(7) << std::endl;
621 std::cout <<
"Error: Received wrong opcode!" << std::endl;
644 std::cout <<
"reply ID: \t" << std::hex << replyMsg.
getID() << std::endl;
645 std::cout <<
"reply Length: \t" << replyMsg.
getLength() << std::endl;
646 std::cout <<
"reply Data: \t" << replyMsg.
getAt(0) <<
" " << replyMsg.
getAt(1) <<
" " << replyMsg.
getAt(2) <<
" " 647 << replyMsg.
getAt(3) <<
" " << replyMsg.
getAt(4) <<
" " << replyMsg.
getAt(5) <<
" " << replyMsg.
getAt(6)
648 <<
" " << replyMsg.
getAt(7) << std::endl;
670 std::cout <<
"reply ID: \t" << std::hex << replyMsg.
getID() << std::endl;
671 std::cout <<
"reply Length: \t" << replyMsg.
getLength() << std::endl;
672 std::cout <<
"reply Data: \t" << replyMsg.
getAt(0) <<
" " << replyMsg.
getAt(1) <<
" " << replyMsg.
getAt(2) <<
" " 673 << replyMsg.
getAt(3) <<
" " << replyMsg.
getAt(4) <<
" " << replyMsg.
getAt(5) <<
" " << replyMsg.
getAt(6)
674 <<
" " << replyMsg.
getAt(7) << std::endl;
699 std::cout <<
"Matix: SG0: " << sg0 <<
" SG1: " << sg1 <<
" SG2: " << sg2 <<
" SG3: " << sg3 <<
" SG4: " << sg4
700 <<
" SG5: " << sg5 << std::endl;
707 std::cout <<
"\n\n*******Reading Firmware Version*******" << std::endl;
723 std::cout <<
"reply ID: \t" << std::hex << replyMsg.
getID() << std::endl;
724 std::cout <<
"reply Length: \t" << replyMsg.
getLength() << std::endl;
729 std::cout <<
"Reading Firmware Succeed!" << std::endl;
730 std::cout <<
"reply Data: \t" << replyMsg.
getAt(0) <<
" " << replyMsg.
getAt(1) <<
" " << replyMsg.
getAt(2)
731 <<
" " << replyMsg.
getAt(3) << std::endl;
736 std::cout <<
"Error: Received wrong opcode!" << std::endl;
742 std::cout <<
"Error: Receiving Message failed!" << std::endl;
748 std::cout <<
"Error: Transmiting Message failed!" << std::endl;
757 int sg0 = 0, sg1 = 0, sg2 = 0, sg3 = 0, sg4 = 0, sg5 = 0;
766 std::cout <<
"ForceTorqueCtrl::ReadSGData: Error: Transmiting message failed!" << std::endl;
777 std::cout <<
"ForceTorqueCtrl::ReadSGData: Error: Received wrong opcode (Should be 0x200)!" << std::endl;
778 std::cout <<
"reply ID: \t" << std::hex << replyMsg.
getID() << std::endl;
779 std::cout <<
"reply Length: \t" << replyMsg.
getLength() << std::endl;
780 std::cout <<
"reply Data: \t" << replyMsg.
getAt(0) <<
" " << replyMsg.
getAt(1) <<
" " << replyMsg.
getAt(2) <<
" " 781 << replyMsg.
getAt(3) <<
" " << replyMsg.
getAt(4) <<
" " << replyMsg.
getAt(5) <<
" " << replyMsg.
getAt(6)
782 <<
" " << replyMsg.
getAt(7) << std::endl;
786 c[0] = replyMsg.
getAt(0);
787 c[1] = replyMsg.
getAt(1);
788 statusCode = (short)((c[0] << 8) | c[1]);
792 if (statusCode & 0x4000)
794 std::cout <<
"ForceTorqueCtrl::ReadSGData: CAN bus error detected!" << std::endl;
796 std::cout <<
"ForceTorqueCtrl::ReadSGData: FTS reseted!" << std::endl;
800 std::cout <<
"ForceTorqueCtrl::ReadSGData: Error: Something is wrong with sensor!" << std::endl;
801 std::cout << std::hex << statusCode << std::endl;
805 c[0] = replyMsg.
getAt(2);
806 c[1] = replyMsg.
getAt(3);
807 sg0 = (short)((c[0] << 8) | c[1]);
809 c[0] = replyMsg.
getAt(4);
810 c[1] = replyMsg.
getAt(5);
811 sg2 = (short)((c[0] << 8) | c[1]);
813 c[0] = replyMsg.
getAt(6);
814 c[1] = replyMsg.
getAt(7);
815 sg4 = (short)((c[0] << 8) | c[1]);
825 std::cout <<
"ForceTorqueCtrl::ReadSGData: Error: Received wrong opcode (Should be 0x201)!" << std::endl;
826 std::cout <<
"reply ID: \t" << std::hex << replyMsg.
getID() << std::endl;
827 std::cout <<
"reply Length: \t" << replyMsg.
getLength() << std::endl;
828 std::cout <<
"reply Data: \t" << replyMsg.
getAt(0) <<
" " << replyMsg.
getAt(1) <<
" " << replyMsg.
getAt(2) <<
" " 829 << replyMsg.
getAt(3) <<
" " << replyMsg.
getAt(4) <<
" " << replyMsg.
getAt(5) <<
" " << replyMsg.
getAt(6)
830 <<
" " << replyMsg.
getAt(7) << std::endl;
834 c[0] = replyMsg.
getAt(0);
835 c[1] = replyMsg.
getAt(1);
836 sg1 = (short)((c[0] << 8) | c[1]);
838 c[0] = replyMsg.
getAt(2);
839 c[1] = replyMsg.
getAt(3);
840 sg3 = (short)((c[0] << 8) | c[1]);
842 c[0] = replyMsg.
getAt(4);
843 c[1] = replyMsg.
getAt(5);
844 sg5 = (short)((c[0] << 8) | c[1]);
861 Eigen::VectorXf v6SG(6);
862 Eigen::VectorXf v6tmp(6);
863 Eigen::VectorXf
test(6);
877 Eigen::VectorXf tmp(6);
888 Eigen::VectorXf tmp(6);
901 Eigen::VectorXf tmp(6);
913 Eigen::VectorXf tmp(6);
925 Eigen::VectorXf tmp(6);
937 Eigen::VectorXf tmp(6);
949 Eigen::VectorXf tmp(6);
961 Eigen::VectorXf tmp(6);
974 Eigen::MatrixXf tmp(6, 6);
1022 Eigen::MatrixXf tmp(6, 6);
Eigen::VectorXf m_v3GaugeGain
Eigen::MatrixXf m_vForceData
bool ReadFTSerialNumber()
Eigen::VectorXf m_v3FXGain
void ReadCalibrationMatrix()
void SetFYGain(float fyg0, float fyg1, float fyg2, float fyg3, float fyg4, float fyg5)
void SetTYGain(float tyg0, float tyg1, float tyg2, float tyg3, float tyg4, float tyg5)
bool ReadSGData(int statusCode, double &Fx, double &Fy, double &Fz, double &Tx, double &Ty, double &Tz)
Eigen::MatrixXf m_mXCalibMatrix
void SetTZGain(float tzg0, float tzg1, float tzg2, float tzg3, float tzg4, float tzg5)
void setAt(BYTE data, int iNr)
void SetFZGain(float fzg0, float fzg1, float fzg2, float fzg3, float fzg4, float fzg5)
bool readDiagnosticADCVoltages(int index, short int &value)
void SetTXGain(float txg0, float txg1, float txg2, float txg3, float txg4, float txg5)
Eigen::VectorXf m_v3FYGain
bool SetBaudRate(int value)
bool SetActiveCalibrationMatrix(int num)
Eigen::VectorXf m_v3TZGain
void SetFXGain(float fxg0, float fxg1, float fxg2, float fxg3, float fxg4, float fxg5)
void ReadMatrix(int axis, Eigen::VectorXf &vec)
union ForceTorqueCtrl::@3 ibBuf
void SetGaugeOffset(float sg0Off, float sg1Off, float sg2Off, float sg3Off, float sg4Off, float sg5Off)
Eigen::VectorXf m_v3TYGain
virtual bool init_ret()=0
union ForceTorqueCtrl::@4 intbBuf
bool SetBaseIdentifier(int identifier)
Eigen::VectorXf m_v3FZGain
virtual bool receiveMsgRetry(CanMsg *pCMsg, int iNrOfRetry)=0
void set(BYTE Data0=0, BYTE Data1=0, BYTE Data2=0, BYTE Data3=0, BYTE Data4=0, BYTE Data5=0, BYTE Data6=0, BYTE Data7=0)
#define CANITFTYPE_SOCKET_CAN
bool ReadFirmwareVersion()
union ForceTorqueCtrl::@5 fbBuf
Eigen::VectorXf m_v3StrainGaigeOffset
Eigen::VectorXf m_v3TXGain
virtual bool transmitMsg(CanMsg CMsg, bool bBlocking=true)=0
void StrainGaugeToForce(int &sg0, int &sg1, int &sg2, int &sg3, int &sg4, int &sg5)
#define CANITFTYPE_CAN_PEAK_USB
void SetGaugeGain(float gg0, float gg1, float gg2, float gg3, float gg4, float gg5)