40 #include <geometry_msgs/Twist.h> 42 #define KEYCODE_A 0x61 43 #define KEYCODE_D 0x64 44 #define KEYCODE_S 0x73 45 #define KEYCODE_W 0x77 46 #define KEYCODE_Q 0x71 47 #define KEYCODE_E 0x65 49 #define KEYCODE_A_CAP 0x41 50 #define KEYCODE_D_CAP 0x44 51 #define KEYCODE_S_CAP 0x53 52 #define KEYCODE_W_CAP 0x57 53 #define KEYCODE_Q_CAP 0x51 54 #define KEYCODE_E_CAP 0x45 60 geometry_msgs::Twist
cmd;
68 cmd.linear.x = cmd.linear.y = cmd.angular.z = 0;
70 vel_pub_ = n_.
advertise<geometry_msgs::Twist>(
"cmd_vel", 1);
73 n_private.param(
"walk_vel", walk_vel, 0.5);
74 n_private.param(
"run_vel", run_vel, 1.0);
75 n_private.param(
"yaw_rate", yaw_rate, 1.0);
76 n_private.param(
"yaw_run_rate", yaw_rate_run, 1.5);
86 struct termios cooked,
raw;
90 tcsetattr(
kfd, TCSANOW, &cooked);
94 int main(
int argc,
char** argv)
96 ros::init(argc, argv,
"pr2_base_keyboard");
114 tcgetattr(
kfd, &cooked);
115 memcpy(&
raw, &cooked,
sizeof(
struct termios));
116 raw.c_lflag &=~ (ICANON | ECHO);
120 tcsetattr(
kfd, TCSANOW, &
raw);
122 puts(
"Reading from keyboard");
123 puts(
"---------------------------");
124 puts(
"Use 'WASD' to translate");
125 puts(
"Use 'QE' to yaw");
126 puts(
"Press 'Shift' to run");
132 if(read(
kfd, &c, 1) < 0)
138 cmd.linear.x =
cmd.linear.y =
cmd.angular.z = 0;
int main(int argc, char **argv)
void publish(const boost::shared_ptr< M > &message) const
struct termios cooked raw
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)