void SimplexParameters::update(double y, const MnAlgebraicVector& p) { theSimplexParameters[jh()] = std::pair<double, MnAlgebraicVector>(y, p); if(y < theSimplexParameters[jl()].first) theJLow = jh(); unsigned int jh = 0; for(unsigned int i = 1; i < theSimplexParameters.size(); i++) { if(theSimplexParameters[i].first > theSimplexParameters[jh].first) jh = i; } theJHigh = jh; return; }
void Print(ostream& os, const VarValue& v) override { JsonHandle jh(CopyToJsonT(v)); size_t flags = (Indent ? JSON_INDENT(Indent) : 0) | (Compact ? JSON_COMPACT : 0); if ((os.flags() & ios::adjustfield) == ios::left) flags |= JSON_COMPACT; if (char *s = json_dumps(jh, flags)) { os << s; FreeWrap(s); } else os << "null"; }
std::wstring JRE::getJREpathOnce() { wchar_t buf[MAX_PATH]; if (::GetEnvironmentVariable( _T("JAVA_HOME"), buf, MAX_PATH )) { std::wstring jh(buf); if ( !jh.empty() ) { std::wstring path = jh + _T("\\jre\\bin\\client\\jvm.dll"); if ( mol::Path::exists(path) ) return path; path = jh + _T("\\jre\\bin\\server\\jvm.dll"); if ( mol::Path::exists(path) ) return path; } } mol::RegKey key(HKEY_LOCAL_MACHINE, KEY_READ); mol::RegKey soft = key.open(_T("SOFTWARE"),KEY_READ); mol::RegKey java; try { java = soft.open(_T("JavaSoft"),KEY_READ); } catch(...) { mol::RegKey wow = soft.open(_T("Wow6432Node"),KEY_READ); java = wow.open(_T("JavaSoft"),KEY_READ); } mol::RegKey jre = java.open(_T("Java Runtime Environment"),KEY_READ); mol::RegKey ver; try { try { ver = jre.open(_T("1.8"),KEY_READ); } catch(...) { ver = jre.open(_T("1.7"),KEY_READ); } } catch(...) { ver = jre.open(_T("1.6"),KEY_READ); } std::wstring path = ver.get(_T("RuntimeLib")); return path; }
/** *@brief サインスマート製4自由度ロボットアーム制御クラスのコンストラクタ */ RobotArm::RobotArm() { jl = new Vector3d[4]; pl = new Vector3d[4]; l[0] = ArmLength0; l[1] = ArmLength1; l[2] = ArmLength2; l[3] = ArmLength3; lh = HandLength; lf = FingerLength; m[0] = ArmMath0; m[1] = ArmMath1; m[2] = ArmMath2; m[3] = ArmMath3; mh = HandMath; mf = FingerMath; wi = ArmWidth; wf = FingerWidth; hi = ArmHeight; hf = FingerHeight; rh = HandRadius; jl[0](0) = 0; jl[0](1) = 0; jl[0](2) = 0; pl[0](0) = jl[0](0); pl[0](1) = jl[0](1); pl[0](2) = jl[0](2)+l[0]/2; jl[1](0) = pl[0](0); jl[1](1) = pl[0](1); jl[1](2) = pl[0](2)+l[0]/2; pl[1](0) = jl[1](0); pl[1](1) = jl[1](1); pl[1](2) = jl[1](2)+l[1]/2; jl[2](0) = pl[1](0); jl[2](1) = pl[1](1); jl[2](2) = pl[1](2)+l[1]/2; pl[2](0) = jl[2](0); pl[2](1) = jl[2](1); pl[2](2) = jl[2](2)+l[2]/2; jl[3](0) = pl[2](0); jl[3](1) = pl[2](1); jl[3](2) = pl[2](2)+l[2]/2; pl[3](0) = jl[3](0); pl[3](1) = jl[3](1)+l[3]/2; pl[3](2) = jl[3](2); jh(0) = pl[3](0); jh(1) = pl[3](1)+l[3]/2; jh(2) = pl[3](2); ph(0) = jh(0); //pyh = jyh+lh/2; ph(1) = jh(1); ph(2) = jh(2); jf(0) = ph(0); //jyf = pyh+lh/2; jf(1) = ph(1); jf(2) = ph(2); pf(0) = jf(0); pf(1) = jf(1); pf(2) = jf(2)-lf/2; hw = 0.02; setAngle(0, 0, 0, 0); dt = 0.01; //endTime = -1; //time = 0; /*targetPoint(0) = 0; targetPoint(1) = 0; targetPoint(2) = 0; startPoint(0) = 0; startPoint(1) = 0; startPoint(2) = 0;*/ setOffset(0,0,0,0); Kp = 10; Kjp = 10; openGripper(); maxSpeedCartesian = Vector3d(1000, 1000, 1000); maxSpeedJoint[0] = 1000; maxSpeedJoint[1] = 1000; maxSpeedJoint[2] = 1000; maxSpeedJoint[3] = 1000; softUpperLimitCartesian = Vector3d(1000, 1000, 1000); softLowerLimitCartesian = Vector3d(-1000, -1000, -1000); pauseFalg = false; stopFalg = false; //homePosition = Vector3d(0, 0, 0); softUpperLimitJoint[0] = MOTOR_UPPER__LIMIT_0; softUpperLimitJoint[1] = MOTOR_UPPER__LIMIT_1; softUpperLimitJoint[2] = MOTOR_UPPER__LIMIT_2; softUpperLimitJoint[3] = MOTOR_UPPER__LIMIT_3; softLowerLimitJoint[0] = MOTOR_LOWER__LIMIT_0; softLowerLimitJoint[1] = MOTOR_LOWER__LIMIT_1; softLowerLimitJoint[2] = MOTOR_LOWER__LIMIT_2; softLowerLimitJoint[3] = MOTOR_LOWER__LIMIT_3; serbo = true; manifactur = "SainSmart"; type = "DIY 4-Axis Servos Control Palletizing Robot Arm"; axisNum = 4; cmdCycle = 50; isGripper = false; //speedPoint = 10; //speedJointPos = 1; MaxSpeedJoint[0] = 2; MaxSpeedJoint[1] = 2; MaxSpeedJoint[2] = 2; MaxSpeedJoint[3] = 2; MaxSpeedCartesianTrans = 0.5; MaxSpeedCartesianRot = 2; MinTime = dt; jointOffset[0] = MOTOR_OFFSET_0; jointOffset[1] = MOTOR_OFFSET_1; jointOffset[2] = MOTOR_OFFSET_2; jointOffset[3] = MOTOR_OFFSET_3; }