Example #1
0
void turn(ros::Publisher vel_pub)
{
  if (hasReachedGoal())
    {
      g_state = STOP_TURN;
      commandFly(vel_pub, 0, 0);
    }
  else
    {
      commandFly(vel_pub, 0.0, 0.4);
    }
}
// orden de movimiento forward
void forward(ros::Publisher twist_pub)
{
  if (hasReachedGoal())	// si ha llegado a la meta, da la orden de detener el movimiento:
  {
    g_state = STOP_FORWARD;
    commandTurtle(twist_pub, 0, 0);
  }
  else	// sino, da la orden de continuar el movimiento:
  {
    commandTurtle(twist_pub, 1.0, 0.0);
  }
}
Example #3
0
void forward(ros::Publisher vel_pub)
{
  if (hasReachedGoal())
    {
      g_state = STOP_FORWARD;
      commandFly(vel_pub, 0, 0);
    }
  else
    {
      commandFly(vel_pub, 1.0, 0.0);
    }
}
// orden de movimiento angular
void turn(ros::Publisher twist_pub)
{
  if (hasReachedGoal())	// si se ha llegado a la meta, se detiene el giro:
  {
    g_state = STOP_TURN;
    commandTurtle(twist_pub, 0, 0);
    i++;
    if(i==cantGiros) {
	ROS_INFO("DONE");
	 ros::shutdown();
    }
  }
  else	// sino, se envia la orden de continuar girando:
  {
    commandTurtle(twist_pub, 0.0, 0.4);
  }
}