25 #include <geometry_msgs/Twist.h> 27 #define KEYCODE_A 0x61 28 #define KEYCODE_D 0x64 29 #define KEYCODE_S 0x73 30 #define KEYCODE_W 0x77 31 #define KEYCODE_Q 0x71 32 #define KEYCODE_E 0x65 34 #define KEYCODE_A_CAP 0x41 35 #define KEYCODE_D_CAP 0x44 36 #define KEYCODE_S_CAP 0x53 37 #define KEYCODE_W_CAP 0x57 38 #define KEYCODE_Q_CAP 0x51 39 #define KEYCODE_E_CAP 0x45 45 geometry_msgs::Twist
cmd;
53 cmd.linear.x = cmd.linear.y = cmd.angular.z = 0;
55 vel_pub_ = n_.
advertise<geometry_msgs::Twist>(
"cmd_vel", 1);
58 n_private.param(
"walk_vel", walk_vel, 0.5);
59 n_private.param(
"run_vel", run_vel, 1.0);
60 n_private.param(
"yaw_rate", yaw_rate, 1.0);
61 n_private.param(
"yaw_run_rate", yaw_rate_run, 1.5);
78 struct termios cooked,
raw;
82 tcsetattr(
kfd, TCSANOW, &cooked);
86 int main(
int argc,
char** argv)
106 tcgetattr(
kfd, &cooked);
107 memcpy(&
raw, &cooked,
sizeof(
struct termios));
108 raw.c_lflag &=~ (ICANON | ECHO);
112 tcsetattr(
kfd, TCSANOW, &
raw);
114 puts(
"Reading from keyboard");
115 puts(
"---------------------------");
116 puts(
"Use 'WASD' to translate");
117 puts(
"Use 'QE' to yaw");
118 puts(
"Press 'Shift' to run");
124 if(read(
kfd, &c, 1) < 0)
130 cmd.linear.x =
cmd.linear.y =
cmd.angular.z = 0;
struct termios cooked raw
void publish(const boost::shared_ptr< M > &message) const
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
int main(int argc, char **argv)