00001 /**************************************************************************** 00002 ** ui.h extension file, included from the uic-generated form implementation. 00003 ** 00004 ** If you want to add, delete, or rename functions or slots, use 00005 ** Qt Designer to update this file, preserving your code. 00006 ** 00007 ** You should not define a constructor or destructor in this file. 00008 ** Instead, write your code in functions called init() and destroy(). 00009 ** These will automatically be called by the form's constructor and 00010 ** destructor. 00011 *****************************************************************************/ 00012 00013 00014 void RT100ControlForm::init( ModelManager * mgr, nub::soft_ref<RT100> rt100 ) 00015 { 00016 00017 itsMgr = mgr; 00018 itsRT100 = rt100; 00019 } 00020 00021 00022 void RT100ControlForm::initArm() 00023 { 00024 00025 armStatusMsg->setText(QString("Initalizing arm...")); 00026 itsRT100->init(); 00027 armStatusMsg->setText(QString("Arm initalized")); 00028 00029 00030 } 00031 00032 00033 void RT100ControlForm::homeArm() 00034 { 00035 00036 itsRT100->gotoHomePosition(); 00037 } 00038 00039 00040 void RT100ControlForm::moveArm() 00041 { 00042 LINFO("Moving arm\n"); 00043 itsRT100->moveArm(true); //wait till move is done 00044 LINFO("Done moving arm\n"); 00045 } 00046 00047 00048 void RT100ControlForm::moveZed( int val ) 00049 { 00050 itsRT100->setJointPosition(RT100::ZED, val, moveMode->isChecked()); 00051 } 00052 00053 00054 void RT100ControlForm::moveSholder( int val ) 00055 { 00056 00057 itsRT100->setJointPosition(RT100::SHOLDER, val, moveMode->isChecked()); 00058 } 00059 00060 00061 void RT100ControlForm::moveElbow( int val ) 00062 { 00063 00064 itsRT100->setJointPosition(RT100::ELBOW, val, moveMode->isChecked()); 00065 } 00066 00067 00068 void RT100ControlForm::moveYaw( int val ) 00069 { 00070 00071 itsRT100->setJointPosition(RT100::YAW, val, moveMode->isChecked()); 00072 } 00073 00074 00075 void RT100ControlForm::moveWrist1( int val ) 00076 { 00077 00078 itsRT100->setJointPosition(RT100::WRIST1, val, moveMode->isChecked()); 00079 } 00080 00081 00082 void RT100ControlForm::moveWrist2( int val ) 00083 { 00084 00085 itsRT100->setJointPosition(RT100::WRIST2, val, moveMode->isChecked()); 00086 } 00087 00088 00089 void RT100ControlForm::moveGripper( int val ) 00090 { 00091 00092 itsRT100->setJointPosition(RT100::GRIPPER, val, moveMode->isChecked()); 00093 } 00094 00095 void RT100ControlForm::getCurrentJointPositions() 00096 { 00097 short int val; 00098 00099 itsRT100->getJointPosition(RT100::ZED, &val); 00100 zedVal->setValue(val); 00101 LDEBUG("Zed at %i", val); 00102 00103 itsRT100->getJointPosition(RT100::ELBOW, &val); 00104 elbowVal->setValue(val); 00105 LDEBUG("Elbow at %i", val); 00106 00107 itsRT100->getJointPosition(RT100::SHOLDER, &val); 00108 sholderVal->setValue(val); 00109 LDEBUG("Sholder at %i", val); 00110 00111 00112 itsRT100->getJointPosition(RT100::YAW, &val); 00113 yawVal->setValue(val); 00114 LDEBUG("Yaw at %i", val); 00115 00116 itsRT100->getJointPosition(RT100::GRIPPER, &val); 00117 gripperVal->setValue(val); 00118 LDEBUG("Gripper at %i", val); 00119 00120 00121 int wrist1Pos, wrist2Pos; 00122 itsRT100->getJointPosition(RT100::WRIST1, &val); 00123 wrist1Val->setValue(val); 00124 wrist1Pos = val; 00125 LDEBUG("Wrist1 at %i", val); 00126 00127 itsRT100->getJointPosition(RT100::WRIST2, &val); 00128 wrist2Val->setValue(val); 00129 wrist2Pos = val; 00130 LDEBUG("Wrist2 at %i", val); 00131 00132 00133 } 00134 00135 00136 void RT100ControlForm::wristRoll( int val ) 00137 { 00138 itsRT100->setJointPosition(RT100::ROLL_WRIST, val, moveMode->isChecked()); 00139 } 00140 00141 00142 void RT100ControlForm::wristTilt( int val ) 00143 { 00144 itsRT100->setJointPosition(RT100::TILT_WRIST, val, moveMode->isChecked()); 00145 } 00146 00147 00148 00149 void RT100ControlForm::doInterpolation() 00150 { 00151 00152 00153 std::vector<short int> moveVals(itsRT100->getNumJoints(), 0); 00154 00155 moveVals[RT100::ZED] = zedInterpolation->value(); 00156 moveVals[RT100::SHOLDER] = sholderInterpolation->value(); 00157 moveVals[RT100::ELBOW] = elbowInterpolation->value(); 00158 moveVals[RT100::YAW] = yawInterpolation->value(); 00159 moveVals[RT100::WRIST1] = wrist1Interpolation->value(); 00160 moveVals[RT100::WRIST2] = wrist2Interpolation->value(); 00161 moveVals[RT100::GRIPPER] = gripperInterpolation->value(); 00162 00163 itsRT100->interpolationMove(moveVals); 00164 00165 }