root / mikrokopter / src / wasd_nav.cpp @ a15ffaa4
History | View | Annotate | Download (862 Bytes)
1 |
#include "ros/ros.h" |
---|---|
2 |
#include "mikrokopter/Control.h" |
3 |
#include <cstdlib> |
4 |
|
5 |
|
6 |
int main(int argc, char **argv) |
7 |
{ |
8 |
ros::init(argc, argv, "mikrokopter_externctrl_client");
|
9 |
|
10 |
ros::NodeHandle n; |
11 |
ros::Publisher pub = n.advertise<mikrokopter::Control>("/mikrokopter/req_set_control", 100); |
12 |
mikrokopter::Control req; |
13 |
req.digital[0] = 0; |
14 |
req.digital[1] = 0; |
15 |
req.remoteKey = 0;
|
16 |
req.pitch = 0;
|
17 |
req.roll = 0;
|
18 |
req.yaw = 0;
|
19 |
req.thrust = 40;
|
20 |
req.height = 0;
|
21 |
req.free = 0;
|
22 |
req.frame = 7;
|
23 |
req.config = 1;
|
24 |
|
25 |
ros::Rate loop_rate(25);
|
26 |
|
27 |
printf("moving\n");
|
28 |
|
29 |
req.roll = -15;
|
30 |
req.pitch = -15; /* nick is pitch */ |
31 |
pub.publish(req); |
32 |
ros::spinOnce(); |
33 |
|
34 |
sleep(5);
|
35 |
printf("evening out\n");
|
36 |
req.roll = 0;
|
37 |
req.pitch = 0;
|
38 |
pub.publish(req); |
39 |
ros::spinOnce(); |
40 |
|
41 |
} |
42 |
void forward()
|
43 |
{ |
44 |
|
45 |
|
46 |
} |
47 |
|