45 struct termios cooked,
raw;
99 std::string arm_controller_name;
100 n_local.
param(
"arm_controller_name", arm_controller_name,std::string(
""));
102 if(arm_controller_name.empty()) {
114 arm_controller_name);
123 double cur_pan_pos = 0.0;
124 double cur_tilt_pos = 0.0;
150 double cur_torso_pos = 0.0;
207 tcsetattr(
kfd, TCSANOW, &cooked);
215 int main(
int argc,
char** argv)
223 tcgetattr(
kfd, &cooked);
224 memcpy(&
raw, &cooked,
sizeof(
struct termios));
225 raw.c_lflag &=~ (ICANON | ECHO);
229 tcsetattr(
kfd, TCSANOW, &
raw);
238 puts(
"Reading from keyboard");
239 puts(
"---------------------------");
241 puts(
"Use 'h' for head commands");
244 puts(
"Use 'b' for body commands");
247 puts(
"Use 'l' for left arm commands");
250 puts(
"Use 'r' for right arm commands");
253 puts(
"Use 'a' for both arm commands");
255 puts(
"Use 'q' to quit");
258 if(read(
kfd, &c, 1) < 0)
269 ROS_INFO(
"No head control enabled");
272 puts(
"---------------------------");
273 puts(
"Use 'z' for projector on");
274 puts(
"Use 'x' for projector off");
275 puts(
"Use 's' for laser slow tilt");
276 puts(
"Use 'f' for laser fast tilt");
277 puts(
"Use 'g' for laser tilt off");
278 puts(
"Use 'm' to set head mannequin mode");
279 puts(
"Use 'y' to set to keyboard head control");
280 puts(
"Use 'i/j/k/l' in keyboard head control mode to move head");
281 puts(
"Use 'q' to quit head mode and return to main menu");
282 bool head_stop =
false;
287 if(read(
kfd, &c, 1) < 0)
345 ROS_INFO(
"No head control enabled");
348 puts(
"---------------------------");
349 puts(
"Use 'u' for torso up");
350 puts(
"Use 'd' for torso down");
351 puts(
"Use 'i/k' for forward/back");
352 puts(
"Use 'j/l' for turning left and right");
353 puts(
"Use 'n/m' for straffing left and right");
354 puts(
"Use 'q' to quit body mode and return to main menu");
356 bool body_stop =
false;
361 if(read(
kfd, &c, 1) < 0)
398 case 'l':
case 'r':
case 'a':
401 ROS_INFO(
"No left arm control enabled");
405 ROS_INFO(
"No right arm control enabled");
415 }
else if(c ==
'r') {
420 puts(
"---------------------------");
421 puts(
"Use 'o' for gripper open");
422 puts(
"Use 'p' for gripper close");
423 puts(
"Use 'r' for wrist rotate clockwise");
424 puts(
"Use 'u' for wrist flex up");
425 puts(
"Use 'd' for wrist flex down");
426 puts(
"Use 't' for wrist rotate counter-clockwise");
427 puts(
"Use 'i/k' for hand pose forward/back");
428 puts(
"Use 'j/l' for hand pose left/right");
429 puts(
"Use 'h/n' for hand pose up/down");
430 puts(
"Use 'q' to quit arm mode and return to main menu");
431 bool arm_stop =
false;
436 if(read(
kfd, &c, 1) < 0)
456 0.0, 0.0,0.0,0.0,0.0,0.0,
471 0.0, 0.0,0.0,0.0,0.0,0.0,
486 0.0, 0.0,0.0,0.0,0.0,0.0,
501 0.0, 0.0,0.0,0.0,0.0,0.0,
516 0.0, 0.0,0.0,0.0,0.0,0.0,
531 0.0, 0.0,0.0,0.0,0.0,0.0,
546 0.0, 0.0,0.0,0.0,0.0,0.0,
561 0.0,0.0,0.0,0.0,0.0,0.0,
576 0.0, 0.0,0.0,0.0,0.0,0.0,
591 0.0, 0.0,0.0,0.0,0.0,0.0,
615 tcsetattr(
kfd, TCSANOW, &cooked);
Pr2TeleopGeneralKeyboard * generalkey
int main(int argc, char **argv)
void setHeadMode(HeadControlMode mode)
void sendTorsoCommand(double torso_diff)
void sendArmVelCommands(double r_x_vel, double r_y_vel, double r_z_vel, double r_roll_vel, double r_pitch_vel, double r_yaw_vel, double l_x_vel, double l_y_vel, double l_z_vel, double l_roll_vel, double l_pitch_vel, double l_yaw_vel, double hz)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
HeadControlMode getHeadMode()
void sendHeadCommand(double pan_diff, double tilt_diff)
ROSCPP_DECL void spin(Spinner &spinner)
struct termios cooked raw
~Pr2TeleopGeneralKeyboard()
void sendBaseCommand(double vx, double vy, double vw)
Pr2TeleopGeneralKeyboard()
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
void sendProjectorStartStop(bool start)
void sendHeadCommand(double req_pan, double req_tilt)
bool getJointPosition(const std::string &name, double &pos) const
#define ROS_INFO_STREAM(args)
void setLaserMode(LaserControlMode mode)
void sendGripperCommand(WhichArm which, bool close)
ROSCPP_DECL void shutdown()
void sendTorsoCommand(double pos, double vel)