root / scout / scoutsim / src / scout_teleop.h @ 9cb9623b
History | View | Annotate | Download (881 Bytes)
1 | 86222358 | roboclub | #ifndef _SCOUT_TELEOP_
|
---|---|---|---|
2 | #define _SCOUT_TELEOP_
|
||
3 | |||
4 | #include <ros/ros.h> |
||
5 | #include <motors/set_motors.h> |
||
6 | #include <signal.h> |
||
7 | #include <termios.h> |
||
8 | #include <stdio.h> |
||
9 | |||
10 | #include <scoutsim/teleop_input.h> |
||
11 | |||
12 | #define QUEUE_SIZE 10 |
||
13 | |||
14 | #define KEYCODE_R 0x43 |
||
15 | #define KEYCODE_L 0x44 |
||
16 | #define KEYCODE_U 0x41 |
||
17 | #define KEYCODE_D 0x42 |
||
18 | #define KEYCODE_Q 0x71 |
||
19 | #define KEYCODE_S 0x73 |
||
20 | |||
21 | // a second
|
||
22 | 4c495190 | roboclub | #define MAX_WAIT_TIME ros::Duration(0.5) |
23 | 86222358 | roboclub | |
24 | class TeleopScout |
||
25 | { |
||
26 | public:
|
||
27 | TeleopScout(std::string scoutname); |
||
28 | void keyListenerLoop();
|
||
29 | |||
30 | private:
|
||
31 | ros::NodeHandle node; |
||
32 | bool fl_set, fr_set, bl_set, br_set;
|
||
33 | int fl_speed, fr_speed, bl_speed, br_speed;
|
||
34 | char last_key;
|
||
35 | ros::Time last_time; |
||
36 | void teleop_input_callback(const scoutsim::teleop_input::ConstPtr& msg); |
||
37 | |||
38 | ros::Publisher motors_pub; |
||
39 | ros::Subscriber key_input_sub; |
||
40 | }; |
||
41 | |||
42 | #endif |