Search code examples
javaeclipsejar

How to turn Finch Robot by using turn function?


I have a Finch Robot, I download Finch software for Java Windows Eclipse from finchrobot site, the given software javadocs is www.finchrobot.com/javadoc/index.html, After all setup done, Now I want to insert some code to Finch Hardware....

package Code;
import edu.cmu.ri.createlab.terk.robot.finch.Finch;

public class FinchTemplateFile
   {
   public static void main(final String[] args)
      {

      Finch myFinch = new Finch();
      //for moving robot straight 
      myFinch.setWheelVelocities(255,255,1000);
      myFinch.sleep(1000);
      myFinch.stopWheels();
      myFinch.quit();
      System.exit(0);
      }
}

this's code is working fine, but Now I want to turn my robot by using turn function but www.finchrobot.com/javadoc/index.html Finch Class does not contain any Turn function but In another Finch API here which contain the Turn funcion in his Finch class.Now how I turn the robot 90 degree, that's is the my problem. How can I use the API which has turn method? any JAR File available for this API ?

Thanks


Solution

  • You have to manipulate the wheel velocities in order to turn the robot. For example:

    myFinch.setWheelVelocities(150,-100,1000);
    

    would put the left wheel at a forward speed of 150, while the right wheel would be reversing at a speed of -100. Thus, the robot would rotate right.

    If you wanted, you could make the robot turn at more of a curve forwards/ backwards rather than around a point, this would be by making one wheel velocity a higher value than the other, but staying both in positive/ both in negative values.

    Experiment with this until you get to a 90 degree turn.

    Hope that helps.