diff --git a/main.c b/main.c index 14257c5..5b47d04 100644 --- a/main.c +++ b/main.c @@ -15,9 +15,9 @@ #define SCENE_WIDTH (WIN_WIDTH - 2 * MARGIN_X) #define SCENE_HEIGHT (WIN_HEIGHT - 2 * MARGIN_Y) -#define CART_WIDTH 50 +#define CART_WIDTH 40 #define CART_HEIGHT 20 -#define MASS_RADIUS 10 +#define MASS_RADIUS 20 #define SETPOINT_LN_LEN 40 #define A_KP 80.0 @@ -36,7 +36,7 @@ typedef struct { } state_t; static const double mc = 2; // Cart mass -static const double mp = 2; // Pendulum mass +static const double mp = 4; // Pendulum mass static const double l = 0.5; // Pendulum length static const double g = 9.8; // Gravity @@ -75,7 +75,7 @@ static double control(const state_t *s, double pos, double dt) const double err_a = s->a - target_a; const double deriv_a = (err_a - prev_a) / dt; - const double out = CLAMP(A_KP * err_a + A_KD * deriv_a, -5.0, 5.0); + const double out = CLAMP(A_KP * err_a + A_KD * deriv_a, -10.0, 10.0); prev_a = err_a; return out;