commit 321961ca2609b2090e13c86ff00376d8cb6ff18b
Author: Alex <azirbel@andrew.cmu.edu>
Date:   Sun Dec 2 16:45:51 2012 -0500

    Removed old teleop.

diff --git a/scout/scoutsim/CMakeLists.txt b/scout/scoutsim/CMakeLists.txt
index fe24a45..d28b887 100644
--- a/scout/scoutsim/CMakeLists.txt
+++ b/scout/scoutsim/CMakeLists.txt
@@ -37,5 +37,3 @@ target_link_libraries(scoutsim_node ${wxWidgets_LIBRARIES})
 #rosbuild_add_executable(draw_square tutorials/draw_square.cpp)
 #rosbuild_add_executable(mimic tutorials/mimic.cpp)
 rosbuild_add_executable(sonar_viz src/sonar_viz.cpp)
-rosbuild_add_executable(scout_teleop src/scout_teleop.cpp)
-rosbuild_add_executable(scout_teleop_userinput src/scout_teleop_userinput.cpp)
diff --git a/scout/scoutsim/msg/teleop_input.msg b/scout/scoutsim/msg/teleop_input.msg
deleted file mode 100644
index 34deb38..0000000
--- a/scout/scoutsim/msg/teleop_input.msg
+++ /dev/null
@@ -1,2 +0,0 @@
-Header header
-char last_key
\ No newline at end of file
diff --git a/scout/scoutsim/src/scout_teleop.cpp b/scout/scoutsim/src/scout_teleop.cpp
deleted file mode 100644
index 651dae7..0000000
--- a/scout/scoutsim/src/scout_teleop.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-#include "scout_teleop.h"
-
-using namespace std;
-
-TeleopScout::TeleopScout(string scoutname)
-{
-    fl_set = fr_set = bl_set = br_set = true;
-    fl_speed = fr_speed = bl_speed = br_speed = 0;
-    motors_pub = node.advertise<motors::set_motors>(
-                    scoutname+"/set_motors", QUEUE_SIZE);
-    key_input_sub = node.subscribe(scoutname+"/teleop_input",
-                                        QUEUE_SIZE,
-                                        &TeleopScout::teleop_input_callback,
-                                        this);
-}
-
-void TeleopScout::teleop_input_callback(
-            const scoutsim::teleop_input::ConstPtr& msg)
-{
-    last_key = msg->last_key;
-    last_time = msg->header.stamp;
-    //ROS_INFO("received key: 0x%02X ", last_key);
-    //ROS_INFO("at last time: %f\n", last_time.toSec()); 
-}
-
-void TeleopScout::keyListenerLoop()
-{	
-    ROS_INFO("waiting for userinput commands...\n");
-    ROS_INFO("current max wait time is:  %f\n", MAX_WAIT_TIME.toSec());
-    while(ros::ok())
-    {
-	// if we haven't passed the waiting threshold
-        if(last_time + MAX_WAIT_TIME > ros::Time::now())
-        {
-            switch(last_key)
-            {
-		// TODO: for some reason negative speeds go forward, not backward
-		
-                case KEYCODE_L:
-                    //ROS_INFO("LEFT");
-                    fl_speed = bl_speed = 200;
-                    fr_speed = br_speed = -200;
-                    break;
-                case KEYCODE_R:
-                    //ROS_INFO("RIGHT");
-                    fl_speed = bl_speed = -200;
-                    fr_speed = br_speed = 200;
-                    break;
-                case KEYCODE_U:
-                    //ROS_INFO("UP");
-                    fl_speed = bl_speed = -200;
-                    fr_speed = br_speed = -200;
-                    break;
-                case KEYCODE_D:
-                    //ROS_INFO("DOWN");
-                    fl_speed = bl_speed = 200;
-                    fr_speed = br_speed = 200;
-                    break;
-                default:
-                    //don't publish a message yet; no change to key, 
-                    // and no timeout yet
-                    //ROS_INFO("no time out yet\n");
-                    ros::spinOnce();
-                    continue;
-                    break;
-            }
-        }
-        else if (fl_speed != 0 || fr_speed != 0 || 
-                 bl_speed != 0 || br_speed != 0)
-        {
-	    ROS_INFO("no key press; stopping movement");
-            fl_speed = fr_speed = bl_speed = br_speed = 0;
-        }
-
-        //send command to the motors
-        motors::set_motors msg;
-        msg.fl_set = fl_set;
-        msg.fr_set = fr_set;
-        msg.bl_set = bl_set;
-        msg.br_set = br_set;
-        msg.fl_speed = fl_speed;
-        msg.fr_speed = fr_speed;
-        msg.bl_speed = bl_speed;
-        msg.br_speed = br_speed;
-        motors_pub.publish(msg);
-                
-        ros::spinOnce();
-    }
-    return;
-}
-
-int main(int argc, char** argv)
-{
-    string scoutname = "";
-    if(argc != 2)
-    {
-        cout << "Opens up a teleop process to send input to the motors" << endl;
-        cout << "(Remember to create a scout_teleop_userinput process as well to actually capture keyboard input!)" << endl;
-        cout << "Usage: " << argv[0] <<" <scoutname>" << endl;
-        exit(0);
-    }
-
-    scoutname = argv[1];
-    ros::init(argc, argv, scoutname+"_scout_teleop");
-    TeleopScout teleop_scout = TeleopScout(scoutname);
-    
-    teleop_scout.keyListenerLoop();
-
-    return(0);
-}
diff --git a/scout/scoutsim/src/scout_teleop.h b/scout/scoutsim/src/scout_teleop.h
deleted file mode 100644
index c1d9ffa..0000000
--- a/scout/scoutsim/src/scout_teleop.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef _SCOUT_TELEOP_
-#define _SCOUT_TELEOP_
-
-#include <ros/ros.h>
-#include <motors/set_motors.h>
-#include <signal.h>
-#include <termios.h>
-#include <stdio.h>
-
-#include <scoutsim/teleop_input.h>
-
-#define QUEUE_SIZE 10
-
-#define KEYCODE_R 0x43 
-#define KEYCODE_L 0x44
-#define KEYCODE_U 0x41
-#define KEYCODE_D 0x42
-#define KEYCODE_Q 0x71
-#define KEYCODE_S 0x73
-
-// a second
-#define MAX_WAIT_TIME ros::Duration(0.5)
-
-class TeleopScout
-{
-    public:
-        TeleopScout(std::string scoutname);
-        void keyListenerLoop();
-
-    private:
-        ros::NodeHandle node;
-        bool fl_set, fr_set, bl_set, br_set;
-        int fl_speed, fr_speed, bl_speed, br_speed;
-        char last_key;
-        ros::Time last_time;
-        void teleop_input_callback(const scoutsim::teleop_input::ConstPtr& msg);
-
-        ros::Publisher motors_pub;
-        ros::Subscriber key_input_sub;
-};
-
-#endif
diff --git a/scout/scoutsim/src/scout_teleop_userinput.cpp b/scout/scoutsim/src/scout_teleop_userinput.cpp
deleted file mode 100644
index 9dbdc9c..0000000
--- a/scout/scoutsim/src/scout_teleop_userinput.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-#include "scout_teleop_userinput.h"
-
-using namespace std;
-
-TeleopInput::TeleopInput(string scoutname)
-{
-    input_pub = node.advertise<scoutsim::teleop_input>(
-                   scoutname+"/teleop_input", QUEUE_SIZE);
-    kfd = 0;
-
-    // get the console in raw mode
-    tcgetattr(kfd, &cooked);
-    memcpy(&raw, &cooked, sizeof(struct termios));
-    raw.c_lflag &=~ (ICANON | ECHO);
-    // Setting a new line, then end of file                         
-    raw.c_cc[VEOL] = 1;
-    raw.c_cc[VEOF] = 2;
-    tcsetattr(kfd, TCSANOW, &raw);
-
-    //TeleopInput::keyLoop();
-    return;
-}
-
-TeleopInput::~TeleopInput()
-{
-    // reset console mode to no longer be raw
-    tcsetattr(kfd, TCSANOW, &cooked);
-    ros::shutdown();
-    exit(0);
-}
-
-void TeleopInput::keyLoop()
-{
-    ROS_INFO("press keys to start moving!");
-    char pressed_key;
-
-    while (ros::ok())
-    {
-        // get the next event from the keyboard  
-        if(read(kfd, &pressed_key, 1) < 0)
-        {
-          perror("read():");
-          exit(-1);
-        }
-
-	// note: printing this normally slows things the hell down
-        ROS_DEBUG("pressed key 0x%02X at time: %f\n", pressed_key, ros::Time::now().toSec());
-
-        scoutsim::teleop_input msg;
-        msg.last_key = pressed_key;
-	msg.header.stamp = ros::Time::now();
-        input_pub.publish(msg);    
-        
-        ros::spinOnce();
-    }
-    return;
-}
-
-int main(int argc, char** argv)
-{
-    string scoutname = "";
-    if(argc != 2)
-    {
-        cout << "Opens up a teleop process to read in user keyboard input" << endl;
-	cout << "(Remember to have a scout_teleop process running simulatenously to actually process this input!)"<< endl;
-        cout << "Usage: " << argv[0] <<" <scoutname>" << endl;
-        exit(0);
-    }
-    
-    scoutname = argv[1];
-    ros::init(argc, argv, scoutname +"_scout_teleop_userinput");
-    TeleopInput teleop_input = TeleopInput(scoutname);
-    //signal(SIGINT,quit);
-    teleop_input.keyLoop();
-    
-    return(0);
-}
-
diff --git a/scout/scoutsim/src/scout_teleop_userinput.h b/scout/scoutsim/src/scout_teleop_userinput.h
deleted file mode 100644
index 19c6897..0000000
--- a/scout/scoutsim/src/scout_teleop_userinput.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef _TELEOP_INPUT_
-#define _TELEOP_INPUT_
-
-#include <ros/ros.h>
-#include <signal.h>
-#include <termios.h>
-#include <stdio.h>
-
-#include <scoutsim/teleop_input.h>
-
-#define QUEUE_SIZE 10
-
-class TeleopInput{
-    public:
-        TeleopInput(std::string scoutname);
-        ~TeleopInput();
-        void keyLoop();
-    private:
-        int kfd;
-        struct termios cooked, raw;
-        ros::Publisher input_pub;
-        ros::NodeHandle node;
-};
-
-#endif
-
