Skip to content

Commit bd664bd

Browse files
authored
Merge pull request #12 from arduino-libraries/control_revamp
Improved move and rotate
2 parents 457f2b1 + 80c61dd commit bd664bd

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/definitions/robot_definitions.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#define WHEEL_DIAMETER_MM 34.0
1919

2020
// Motor Control and mechanical parameters
21-
#define CONTROL_LIMIT 4096 // PWM resolution
21+
#define CONTROL_LIMIT 4095 // PWM resolution
2222

2323
#define MOTOR_LIMIT 70.0 // Mechanical RPM limit speed of used motors
2424
#define MOTOR_CPR 6.0 // Resolution of the encoder
@@ -41,18 +41,18 @@ const float MOTOR_RATIO = MOTOR_CPR*MOTOR_GEAR_RATIO;
4141

4242

4343
// Kinematics control
44-
#define ROTATE_KP_DEFAULT 5.0
45-
#define ROTATE_KI_DEFAULT 0.0
44+
#define ROTATE_KP_DEFAULT 4.0
45+
#define ROTATE_KI_DEFAULT 0.01
4646
#define ROTATE_KD_DEFAULT 0.001
4747
#define ROTATE_CONTROL_PERIOD 0.02
48-
#define ROTATE_MAX_SPEED 45.0
48+
#define ROTATE_MAX_SPEED 170.0
4949
#define ROTATE_THRESHOLD 1
5050

51-
#define MOVE_KP_DEFAULT 5.0
52-
#define MOVE_KI_DEFAULT 0.0
51+
#define MOVE_KP_DEFAULT 4.0
52+
#define MOVE_KI_DEFAULT 0.01
5353
#define MOVE_KD_DEFAULT 0.001
5454
#define MOVE_CONTROL_PERIOD 0.02
55-
#define MOVE_MAX_SPEED 45.0
55+
#define MOVE_MAX_SPEED 130.0
5656
#define MOVE_THRESHOLD 3
5757

5858
#define MOVEMENT_DISABLED 0

src/motor_control/motor_control.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "../definitions/robot_definitions.h"
2020
#include "pid_controller.h"
2121

22-
#define CONTROL_LIMIT 4095
22+
//#define CONTROL_LIMIT 4095
2323
#define MEM_SIZE 5
2424
#define CONTROL_MODE_NORMAL 0
2525
#define CONTROL_MODE_LINEAR 1

0 commit comments

Comments
 (0)