by benjamin7 » Fri Mar 02, 2012 4:10 pm
Thank you for your quick reply.
I have now tried all types of arc movements. When I set a positive radius, everything is fine: in combination with a positve/negative angle the robot travels forward/backward with the center of the circle left of the NXT.
When I set a negative radius, the center of the circle is right of the NXT (which is also fine), but the forward and backward directions are mixed up (negative angle -> forward (clockwise) movement, positive angle -> backward (counter-clockwise) movement. It should be the other way around.
I am using the DifferentialPilot class. The 'Carpet Pilot' is not a piece of implemented software but a real, physical robot. Its building instruction is in the book 'Intelligence Unleashed'. Sorry for the misunderstanding. I am using leJOS 0.9.1.
This is my complete code:
-----------------------------------------------------------------
package nxt.intelligence.unleashed;
import lejos.nxt.*;
import lejos.robotics.navigation.DifferentialPilot;
public class ArcMoves {
public static void main (String[] args) {
double diam = DifferentialPilot.WHEEL_SIZE_NXT1;
double width = 16.4;
DifferentialPilot robot = new DifferentialPilot(diam, width, Motor.B, Motor.C);
robot.setAcceleration(500);
robot.arc(30, 360); // OK
robot.arc(30, -360); // OK
// in the following two cases the center of the circle is right of
// the NXT but the forward/backward directions are mixed up
robot.arc(-30, 360); // the robot drives backward in a counter-clockwise circle
robot.arc(-30, -360);// the robot drives forward in a clockwise circle
Button.waitForAnyPress();
}
}
-----------------------------------------------------------------------------------