commit 6257c97dd822231155108c01df3c40200eaa7c12
Author: Alex <azirbel@andrew.cmu.edu>
Date:   Sat Nov 17 01:15:43 2012 -0500

    Continuing work on standardization of units.

diff --git a/scout/motors/msg/set_motors.msg b/scout/motors/msg/set_motors.msg
index 9756229..d7a66fd 100644
--- a/scout/motors/msg/set_motors.msg
+++ b/scout/motors/msg/set_motors.msg
@@ -6,7 +6,7 @@ bool fr_set
 bool bl_set
 bool br_set
 
-# The absolute motor speeds to set
+# The absolute motor speeds to set (-255 to 255)
 int8 fl_speed
 int8 fr_speed
 int8 bl_speed
diff --git a/scout/scoutsim/src/scout.cpp b/scout/scoutsim/src/scout.cpp
index 8d6e01a..6911177 100644
--- a/scout/scoutsim/src/scout.cpp
+++ b/scout/scoutsim/src/scout.cpp
@@ -113,6 +113,11 @@ namespace scoutsim
         sonar_tick_time = ros::Duration(scoutsim::SONAR_HALF_SPIN_TIME / 24.0);
     }
 
+    float Scout::absolute_to_mps(int absolute_speed)
+    {
+        return ((float) absolute_speed) * MAX_SPEED_MPS / MAX_ABSOLUTE_SPEED;
+    }
+
     /**
      * A callback function that sets velocity based on a set_motors
      * request.
@@ -124,19 +129,19 @@ namespace scoutsim
 
         if(msg->fl_set)
         {
-            motor_fl_speed = msg->fl_speed;
+            motor_fl_speed = absolute_to_mps(msg->fl_speed);
         }
         if(msg->fr_set)
         {
-            motor_fr_speed = msg->fr_speed;
+            motor_fr_speed = absolute_to_mps(msg->fr_speed);
         }
         if(msg->bl_set)
         {
-            motor_bl_speed = msg->bl_speed;
+            motor_bl_speed = absolute_to_mps(msg->bl_speed);
         }
         if(msg->br_set)
         {
-            motor_br_speed = msg->br_speed;
+            motor_br_speed = absolute_to_mps(msg->br_speed);
         }
     }
 
diff --git a/scout/scoutsim/src/scout.h b/scout/scoutsim/src/scout.h
index d643024..a9cfca7 100644
--- a/scout/scoutsim/src/scout.h
+++ b/scout/scoutsim/src/scout.h
@@ -121,6 +121,7 @@ namespace scoutsim
             void paint(wxDC& dc);
 
         private:
+            float absolute_to_mps(int absolute_speed);
             void setMotors(const motors::set_motors::ConstPtr& msg);
             bool setPenCallback(scoutsim::SetPen::Request&,
                                 scoutsim::SetPen::Response&);
@@ -157,11 +158,12 @@ namespace scoutsim
 
             /// @todo should these be an array or something?
 
-            // Keep track of the last commanded speeds sent to the sim
-            int motor_fl_speed;
-            int motor_fr_speed;
-            int motor_bl_speed;
-            int motor_br_speed;
+            // Keep track of the last commanded speeds sent to the sim,
+            // converted to m/s
+            float motor_fl_speed;
+            float motor_fr_speed;
+            float motor_bl_speed;
+            float motor_br_speed;
 
             // Keep track of encoder ticks for each motor
             unsigned int fl_ticks;
diff --git a/scout/scoutsim/src/scout_constants.h b/scout/scoutsim/src/scout_constants.h
index e5504f6..3b06701 100644
--- a/scout/scoutsim/src/scout_constants.h
+++ b/scout/scoutsim/src/scout_constants.h
@@ -45,10 +45,13 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
-/// @todo Comment up.
-
 namespace scoutsim
 {
+    // Maximum speed which will be sent to scoutsim in absolute units
+    const int MAX_ABSOLUTE_SPEED = 255;
+    // Speed in m/s corresponding to maximum absolute speed
+    const float MAX_SPEED_MPS = 1.0;
+
     // Pixels in scoutsim per real-world meter.
     // Note that scout image size has been set based on this.
     const float PIX_PER_METER = 200.0;
diff --git a/scout/scoutsim/src/sim_frame.cpp b/scout/scoutsim/src/sim_frame.cpp
index 6028537..68eb16c 100644
--- a/scout/scoutsim/src/sim_frame.cpp
+++ b/scout/scoutsim/src/sim_frame.cpp
@@ -391,13 +391,13 @@ namespace scoutsim
         }
         else if (wxGetKeyState(WXK_LEFT))
         {
-            teleop_l_speed = -TELEOP_PRECISE_SPEED * 2;
-            teleop_r_speed = TELEOP_PRECISE_SPEED * 2;
+            teleop_l_speed = -TELEOP_PRECISE_SPEED;
+            teleop_r_speed = TELEOP_PRECISE_SPEED;
         }
         else if (wxGetKeyState(WXK_RIGHT))
         {
-            teleop_l_speed = TELEOP_PRECISE_SPEED * 2;
-            teleop_r_speed = -TELEOP_PRECISE_SPEED * 2;
+            teleop_l_speed = TELEOP_PRECISE_SPEED;
+            teleop_r_speed = -TELEOP_PRECISE_SPEED;
         }
     }
 
diff --git a/scout/scoutsim/src/sim_frame.h b/scout/scoutsim/src/sim_frame.h
index f1789a6..bec0f86 100644
--- a/scout/scoutsim/src/sim_frame.h
+++ b/scout/scoutsim/src/sim_frame.h
@@ -77,9 +77,10 @@
 #define ID_TELEOP_FLUID 9
 #define ID_SONAR 10
 
-#define TELEOP_PRECISE_SPEED 1.0f
-#define TELEOP_FLUID_MAX_SPEED 1.5f
-#define TELEOP_FLUID_INC 0.1f
+// Absolute speeds (0 - 255)
+#define TELEOP_PRECISE_SPEED 160
+#define TELEOP_FLUID_MAX_SPEED 200
+#define TELEOP_FLUID_INC 10
 
 // Teleop types
 #define TELEOP_OFF 0
@@ -135,13 +136,13 @@ namespace scoutsim
             ros::Publisher wireless_receive;
 
             // Teleop
-            float teleop_l_speed;
-            float teleop_r_speed;
+            int teleop_l_speed;
+            int teleop_r_speed;
             ros::Publisher teleop_pub;
             int teleop_type;
 
-            float teleop_fluid_speed;
-            float teleop_fluid_omega;
+            int teleop_fluid_speed;
+            int teleop_fluid_omega;
 
             ros::NodeHandle nh;
             wxTimer* update_timer;
