2 #include <geometry_msgs/Twist.h>    20   {
'm', {-1, 0, 0, -1}},
    27   {
'>', {-1, -1, 0, 0}},
    49 Reading from the keyboard and Publishing to Twist!    50 ---------------------------    56 For Holonomic mode (strafing), hold down the shift key:    57 ---------------------------    67 q/z : increase/decrease max speeds by 10%    68 w/x : increase/decrease only linear speed by 10%    69 e/c : increase/decrease only angular speed by 10%    78 float x(0), 
y(0), 
z(0), 
th(0); 
    89   tcgetattr(STDIN_FILENO, &oldt);
    93   newt.c_lflag &= ~(ICANON | ECHO);
    94   newt.c_iflag |= IGNBRK;
    95   newt.c_iflag &= ~(INLCR | ICRNL | IXON | IXOFF);
    96   newt.c_lflag &= ~(ICANON | ECHO | ECHOK | ECHOE | ECHONL | ISIG | IEXTEN);
    99   tcsetattr(fileno(stdin), TCSANOW, &newt);
   105   tcsetattr(STDIN_FILENO, TCSANOW, &oldt);
   110 int main(
int argc, 
char** argv)
   113   ros::init(argc, argv, 
"teleop_twist_keyboard");
   120   geometry_msgs::Twist twist;
   123   printf(
"\rCurrent: speed %f\tturn %f | Awaiting command...\r", 
speed, 
turn);
   139       printf(
"\rCurrent: speed %f\tturn %f | Last command: %c   ", 
speed, 
turn, 
key);
   149       printf(
"\rCurrent: speed %f\tturn %f | Last command: %c   ", 
speed, 
turn, 
key);
   163         printf(
"\n\n                 .     .\n              .  |\\-^-/|  .    \n             /| } O.=.O { |\\\n\n                 CH3EERS\n\n");
   167       printf(
"\rCurrent: speed %f\tturn %f | Invalid command! %c", 
speed, 
turn, 
key);
   171     twist.linear.x = 
x * 
speed;
   172     twist.linear.y = 
y * 
speed;
   173     twist.linear.z = 
z * 
speed;
   177     twist.angular.z = 
th * 
turn;
 
void publish(const boost::shared_ptr< M > &message) const 
std::map< char, std::vector< float > > speedBindings
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
std::map< char, std::vector< float > > moveBindings
int main(int argc, char **argv)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
ROSCPP_DECL void spinOnce()