From: Roland Hieber Date: Thu, 20 Jan 2011 14:14:24 +0000 (+0100) Subject: turn: allow negative values for orientation input, but only positive for velocity X-Git-Url: https://git.rohieb.name/bachelor-thesis/roomba_tests.git/commitdiff_plain/34a18bc40ea6f673512e6f2a08a8e7bba57e13ca turn: allow negative values for orientation input, but only positive for velocity --- diff --git a/main.cc b/main.cc index e373c51..c02d17e 100644 --- a/main.cc +++ b/main.cc @@ -227,7 +227,7 @@ void turn(Roomba& roomba, ControlledMotion& ctrl_motion) { while(true) { // new turn velocity velocity = getInt(0, "Input velocity", chargeText() - + "Input turn velocity in mm/sec:", velocity, -500, 500, 10, &ok); + + "Input turn velocity in mm/sec:", velocity, 0, 500, 10, &ok); if(!ok) { break; } @@ -246,9 +246,10 @@ void turn(Roomba& roomba, ControlledMotion& ctrl_motion) { // new current angle measured_angle = getInt(0, "Input measured angle", chargeText() + QString( - "Orientation should be %1 degree now.\n\n").arg((cur_angle + turn_angle) - % 360) + "Input measured angle in degree the Roomba has " - "turned:", turn_angle, 0, numeric_limits::max(), 1, &ok); + "Orientation should be %1 degree now.\n\n").arg((cur_angle + turn_angle + + 360) % 360) + "Input measured angle in degree the Roomba has turned:", + turn_angle, numeric_limits::min(), numeric_limits::max(), 1, + &ok); if(!ok) { break; }