package simulator;

import org.jbox2d.common.Vec2;
import org.jbox2d.dynamics.World;
import simulator.physics.PhysicalObject;

/**
 * Created by Administrator on 11/15/2016.
 */
public class SimModBot extends PhysicalObject {
    public static final double MAX_SPEED = 0.655; // 0.655 m/s
    //The amount of radians a robot with radius 0.5 m changes by when rotating for an arc length of 1 m
    public static final double MAX_ANGULAR_SPEED = Math.PI;//4.18879;// 1 revolution every 2 seconds

    public SimModBot(String name, int id, World world, float xSpeed, float ySpeed, float xPos, float yPos, boolean isDynamic) {
        super(name, id, world, xSpeed, ySpeed, 1f, 1f, true);
    }

    /**
     *
     * @param percent Percentage from 0 to 100
     */
    public void forward(double percent) {
        assert(percent <= 100 && percent >= 0);
        float new_speed = (float)(MAX_SPEED * 0.01 * percent);
        float angle = this.getBody().getAngle();
        float newX = (float) (new_speed*Math.cos(angle));
        float newY = (float) (new_speed*Math.sin(angle));
        this.getBody().setLinearVelocity(new Vec2(newX, newY));
        this.getBody().setAngularVelocity(0.0f);
    }

    public void backward(double percent) {
        assert(percent <= 100 && percent >= 0);
        float new_speed = (float)(-MAX_SPEED * 0.01 * percent);
        float angle = this.getBody().getAngle();
        float newX = (float) (new_speed*Math.cos(angle));
        float newY = (float) (new_speed*Math.sin(angle));
        this.getBody().setLinearVelocity(new Vec2(newX,newY));
        this.getBody().setAngularVelocity(0.0f);
    }

    public void left(double percent) { //currently this does the same thing as a CCW turn
        this.getBody().setLinearVelocity(new Vec2(0.0f,0.0f));
        this.getBody().setAngularVelocity((float)(MAX_ANGULAR_SPEED));
    }

    public void right(double percent) { //currently this does the same thing as a CW turn
        this.getBody().setLinearVelocity(new Vec2(0.0f,0.0f));
        this.getBody().setAngularVelocity((float)(-MAX_ANGULAR_SPEED));
    }

    public void clockwise(double percent) {
        this.getBody().setLinearVelocity(new Vec2(0.0f,0.0f));
        this.getBody().setAngularVelocity((float)(-MAX_ANGULAR_SPEED));

    }

    public void counterClockwise(double percent) {
        this.getBody().setLinearVelocity(new Vec2(0.0f,0.0f));
        this.getBody().setAngularVelocity((float)(MAX_ANGULAR_SPEED));
    }


}

@@ -1734,363 +1734,157 @@
     
-this.getBody().setLinearVelocity(new Vec2(0.0f,0.0f));%0A        this.getBody().setAngularVelocity((float)(MAX_ANGULAR_SPEED));%0A    %7D%0A%0A    public void right(double percent) %7B //currently this does the same thing as a CW turn%0A        this.getBody().setLinearVelocity(new Vec2(0.0f,0.0f));%0A        this.getBody().setAngularVelocity((float)(-MAX_ANGULAR_SPEED)
+counterClockwise(percent);%0A    %7D%0A%0A    public void right(double percent) %7B //currently this does the same thing as a CW turn%0A        clockwise(percent
 );%0A 

Update SimModBot.java