Ejemplo n.º 1
0
void CLocomotion::lAvancer (unsigned int distance, int dir)
{
  Serial.println("ENTER LAVANCER");
  Serial.println(distance);

  if (distance == 0) return;
  
  resetPulses();
  if(m_flag) {
    lStop();
    updatePulses();
    updateCoord();
    return;
  }

  
  unsigned long fPulses = DToPulses(distance);
  Serial.print("FPULSES : ");
  Serial.println(fPulses);
  m_etat.dir = dir;
  m_speedConsigne=10;
  lPositionControl(fPulses);
  lStop();
  delay(200);
  Serial.println("FINAL PULSES");
  printLPulses();
  updatePulses();
  updateCoord();
  // Serial.println(getCurrentX());
  // Serial.println(getCurrentY());
  // Serial.println(getCurrentTheta());
  // Serial.println(m_dPulses);
  // Serial.println(m_mPulses);

} 
Ejemplo n.º 2
0
void CLocomotion::lTurn (unsigned int angle, int dir)
{
  Serial.println("ENTER LTURN");
  Serial.println(angle);
  if (angle == 0) {
    // Serial.println("RETURN1");
    return;
  }
  // Serial.println("RESET");
  resetPulses();
  // Serial.println("TEST2");
  // if(m_flag) {
  //   Serial.println("LSTOP");
  //   lStop();
  //   Serial.println("RETURN");
  //   return;
    
  // }
  
  unsigned long fPulses = AToPulses(angle);
  Serial.print("FPULSES : ");
  Serial.println(fPulses);
  m_etat.dir = dir;
  m_speedConsigne=10;
  lAngleControl(fPulses);
  lStop();
  delay(200);
  updatePulses();
  updateCoord();
  // printLPulses();
  Serial.print("THETA FINAL : ");
  Serial.println(m_etat.theta);
  // Serial.println(getCurrentTheta());
}
Ejemplo n.º 3
0
	void SelectorControl::notifyWindowChangeCoord(MyGUI::Window* _sender)
	{
		MyGUI::IntCoord coord = _sender->getCoord() - mProjectionDiff;
		const MyGUI::IntCoord& actionScale = _sender->getActionScale();

		if (actionScale.left != 0 && actionScale.width != 0)
		{
			int right = mCoordValue.right();
			mCoordValue.width = (int)((double)coord.width / mScaleValue);
			mCoordValue.left = right - mCoordValue.width;
		}
		else
		{
			mCoordValue.left = (int)((double)coord.left / mScaleValue);
			mCoordValue.width = (int)((double)coord.width / mScaleValue);
		}

		if (actionScale.top != 0 && actionScale.height != 0)
		{
			int bottom = mCoordValue.bottom();
			mCoordValue.height = (int)((double)coord.height / mScaleValue);
			mCoordValue.top = bottom - mCoordValue.height;
		}
		else
		{
			mCoordValue.top = (int)((double)coord.top / mScaleValue);
			mCoordValue.height = (int)((double)coord.height / mScaleValue);
		}

		updateCoord();
		eventChangePosition();
	}
Ejemplo n.º 4
0
	void StateTextureControl::updateSkinProperty(Property* _sender, const MyGUI::UString& _owner)
	{
		if (_owner != mTypeName)
		{
			if (_sender->getName() == "Texture")
				updateTexture();
			else if (_sender->getName() == "Coord")
				updateCoord();
		}
	}
Ejemplo n.º 5
0
	void StateTextureControl::updateSkinProperties()
	{
		updateTexture();
		updateCoord();
	}
Ejemplo n.º 6
0
	void SelectorControl::setScale(double _value)
	{
		mScaleValue = _value;
		updateCoord();
	}
Ejemplo n.º 7
0
	void SelectorControl::setCoord(const MyGUI::IntCoord& _value)
	{
		mCoordValue = _value;
		updateCoord();
	}
Ejemplo n.º 8
0
	void SelectorControl::setPosition(const MyGUI::IntPoint& _value)
	{
		mCoordValue = _value;
		updateCoord();
	}