Project

General

Profile

Revision a15ffaa4

IDa15ffaa43270831d9621d1a25f41ca5622ab8257

Added by Chris Burchhardt over 12 years ago

adding simple app to make the quadrotor fly forwards a bit

View differences:

mikrokopter/CMakeLists.txt
26 26
target_link_libraries(${PROJECT_NAME} serial)
27 27

  
28 28
rosbuild_add_executable(externctrl_client src/externctrl_client.cpp)
29
rosbuild_add_executable(wasd_nav src/wasd_nav.cpp)
mikrokopter/launch/mikrokopter.launch
2 2

  
3 3
  <node name="mikrokopter" pkg="mikrokopter" 	type="mikrokopter">
4 4
    
5
    <param name="port" value="/dev/ttyUSB0" />
5
    <param name="port" value="/dev/ttyACM0" />
6 6
    	
7 7
    <param name="req_version_rate" value="0.0" />	
8 8
    <param name="req_version_addr" value="97" />
mikrokopter/src/wasd_nav.cpp
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

  

Also available in: Unified diff