void PosController::MultiMove(float xPercent, float yPercent, float zPercent) { m_xPercent = xPercent; m_yPercent = yPercent; m_zPercent = zPercent; if (!EqualToZero(zPercent)) { ZMove(); return; } if (!EqualToZero(xPercent) && !EqualToZero(yPercent)) { XYMove(); return; } if(!EqualToZero(xPercent)) { XMove(); return; } if (!EqualToZero(yPercent)) { YMove(); } }
void CCamera::Update (float timestep) { if (fore) ZMove (-2 * timestep); if (back) ZMove (2 * timestep); if (left) XMove (-1 * timestep); if (right) XMove (1 * timestep); if (up) YMove (1 * timestep); if (down) YMove (-1 * timestep); if (headleft) RotateHead (5 * timestep); if (headright) RotateHead (-5 * timestep); if (pitchup) RotatePitch (-2 * timestep); if (pitchdown) RotatePitch (2 * timestep); glLoadIdentity (); glRotatef (-vpitch, 1.0, 0.0 , 0.0); glRotatef (-vhead, 0.0, 1.0 , 0.0); glTranslatef (-xview, -yview, -zview); }
,_blinkSeqSignature(BLINKSEQSIGNATURE_INVALID) ,_command(COMMAND_INVALID) ,_valueCallbackColorLed(NULL) //--- (end of ColorLed initialization) { _className="ColorLed"; } YColorLed::~YColorLed() { //--- (YColorLed cleanup) //--- (end of YColorLed cleanup) } //--- (YColorLed implementation) // static attributes const YMove YColorLed::RGBMOVE_INVALID = YMove(); const YMove YColorLed::HSLMOVE_INVALID = YMove(); const string YColorLed::COMMAND_INVALID = YAPI_INVALID_STRING; int YColorLed::_parseAttr(yJsonStateMachine& j) { if(!strcmp(j.token, "rgbColor")) { if(yJsonParse(&j) != YJSON_PARSE_AVAIL) goto failed; _rgbColor = atoi(j.token); return 1; } if(!strcmp(j.token, "hslColor")) { if(yJsonParse(&j) != YJSON_PARSE_AVAIL) goto failed; _hslColor = atoi(j.token); return 1; }
/// <summary> /// 多轴运动函数 /// </summary> /// <param name="UseAxis">轴号:0:X 1:Y 2:Z 3:T</param> /// <param name="UseStart"></param> /// <param name="UseAcc"></param> /// <param name="UseSpeed"></param> /// <param name="UseMove"></param>运动方向: void PosController::axisXYMove( double UseStart, double UseAcc, double UseSpeed) { if (!check_Val(UseStart, MAX_START_SPEED/*, HT_Public.AxisName[this.UseAxis] + " 轴起始速度必须正数,且只允许[ 0-" + MaxStartSpeed.ToString().Trim() + " ]之间数值!"*/)) { return; } if (!check_Val(UseAcc, MAX_ACC_SPEED/*, HT_Public.AxisName[this.UseAxis] + " 轴加减速度必须正数,且只允许[ 0-" + MaxAccSpeed.ToString().Trim() + " ]之间数值!"*/)) { return; } if (!check_Val(UseSpeed, MAX_RUN_SPEED/*, HT_Public.AxisName[this.UseAxis] + " 轴运行速度必须为正数,且只允许[ 0-" + MaxRunSpeed.ToString().Trim() + " ]之间数值!"*/)) { return; } // if (!check_Val(UseMove, 0/*, HT_Public.AxisName[this.UseAxis] + " 轴运行位移必须为正数!"*/)) // { // return; // } double UseEncConst = PulseUnit[X_Axis]; //获取脉冲当量 float tempPercent = min(abs(m_xPercent), abs(m_yPercent)); int start = (int)(UseStart * UseEncConst * tempPercent); //启动速度 double fAcc = (double)(UseAcc * UseEncConst * tempPercent); //加速度 int speed = (int)(UseSpeed * UseEncConst * tempPercent); //运行速度 if (!isConnected()) { return; } //检测当量轴是否在运动 if (!checkAxisDown(X_Axis) || !checkAxisDown(Y_Axis)) { return; } long DistArray[2] = {0}; DistArray[0] = getUserMove(m_xPercent) * UseEncConst; DistArray[1]= getUserMove(m_yPercent) * UseEncConst; //检测轴是否到极限 if (!check_Limit(X_Axis, getUserMove(m_xPercent),true)) { YMove(); return; } if (!check_Limit(Y_Axis, getUserMove(m_yPercent), true)) { XMove(); return; } //停止当前轴 d1000_immediate_stop(X_Axis); d1000_immediate_stop(Y_Axis); short AxisArray[2] = {X_Axis, Y_Axis}; d1000_start_t_line (2,AxisArray,DistArray, start, speed,fAcc); }
,_positionAtPowerOn(POSITIONATPOWERON_INVALID) ,_enabledAtPowerOn(ENABLEDATPOWERON_INVALID) ,_valueCallbackServo(NULL) //--- (end of Servo initialization) { _className="Servo"; } YServo::~YServo() { //--- (YServo cleanup) //--- (end of YServo cleanup) } //--- (YServo implementation) // static attributes const YMove YServo::MOVE_INVALID = YMove(); int YServo::_parseAttr(yJsonStateMachine& j) { if(!strcmp(j.token, "position")) { if(yJsonParse(&j) != YJSON_PARSE_AVAIL) goto failed; _position = atoi(j.token); return 1; } if(!strcmp(j.token, "enabled")) { if(yJsonParse(&j) != YJSON_PARSE_AVAIL) goto failed; _enabled = (Y_ENABLED_enum)atoi(j.token); return 1; } if(!strcmp(j.token, "range")) { if(yJsonParse(&j) != YJSON_PARSE_AVAIL) goto failed;