summaryrefslogtreecommitdiffhomepage
path: root/filter-accela/accela-settings.hpp
blob: 6a857bae896c3eed3969f0391d589733c36dbd48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#pragma once

#include "options/options.hpp"
using namespace options;
#include "spline/spline.hpp"

struct settings_accela : opts
{
    struct gains
    {
        double x, y;
    };

    static constexpr gains rot_gains[16] =
    {
        { 10, 500 },
        { 8, 180 },
        { 7, 85 },
        { 6, 55 },
        { 5, 40 },
        { 3, 20 },
        { 1.66, 10 },
        { 1, 4 },
        { .5, .53 },
        { 0, 0 },
    };

    static constexpr gains pos_gains[16] =
    {
        { 9, 200 },
        { 8, 150 },
        { 7, 110 },
        { 5, 60 },
        { 3, 24 },
        { 2, 7.5 },
        { 1.66, 4.5 },
        { 1.33, 2.25 },
        { .66, .75 },
        { .33, .375 },
        { 0, 0 },
    };

    static void make_splines(spline& rot, spline& pos);

    value<slider_value> rot_sensitivity, pos_sensitivity;
    value<slider_value> rot_deadzone, pos_deadzone;
    value<slider_value> ewma;
    value<slider_value> rot_nonlinearity;
    settings_accela() :
        opts("accela-sliders"),
        rot_sensitivity(b, "rotation-sensitivity", slider_value(1.5, .2, 2.5)),
        pos_sensitivity(b, "translation-sensitivity", slider_value(1., .05, 1.5)),
        rot_deadzone(b, "rotation-deadzone", slider_value(.03, 0, .1)),
        pos_deadzone(b, "translation-deadzone", slider_value(.1, 0, 1)),
        ewma(b, "ewma", slider_value(0, 0, 200)),
        rot_nonlinearity(b, "rotation-nonlinearity", slider_value(1.05, 1, 1.5))
    {}
};