From 34a18bc40ea6f673512e6f2a08a8e7bba57e13ca Mon Sep 17 00:00:00 2001 From: Roland Hieber Date: Thu, 20 Jan 2011 15:14:24 +0100 Subject: [PATCH] turn: allow negative values for orientation input, but only positive for velocity --- main.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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; } -- 2.20.1