Project

General

Profile

Revision bc4b408e

IDbc4b408e206dea9fe99d5bcd0f695b75b613e518

Added by Thomas Mullins about 12 years ago

Added velocity_control to MikrocopterControl class, which was added to
work with joystick control. Takes forward and lateral speeds and
combines them to set pitch and roll.

View differences:

mikrokopter/src/nav_lib.cpp
16 16
    control.config = 1;
17 17
}
18 18

  
19
void MikrokopterControl::velocity_control(int forward_speed, int lateral_speed)
20
{
21
    int k = 1; // TODO set scaling constant and check signs
22
    control.roll = k*(forward_speed - lateral_speed);
23
    control.pitch = k*(forward_speed + lateral_speed);
24
}
25

  
19 26
void MikrokopterControl::forward()
20 27
{
21 28
    control.roll = 15;
mikrokopter/src/nav_lib.h
4 4
class MikrokopterControl {
5 5
public:
6 6
    MikrokopterControl();
7
    void velocity_control(int forward_speed, int lateral_speed);
7 8
    void forward();
8 9
    void backward();
9 10
    void left();

Also available in: Unified diff