Skip to content

Commit

Permalink
Merge pull request #12 from arduino-libraries/control_revamp
Browse files Browse the repository at this point in the history
Improved move and rotate
  • Loading branch information
gbr1 authored Mar 12, 2024
2 parents 457f2b1 + 80c61dd commit bd664bd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/definitions/robot_definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#define WHEEL_DIAMETER_MM 34.0

// Motor Control and mechanical parameters
#define CONTROL_LIMIT 4096 // PWM resolution
#define CONTROL_LIMIT 4095 // PWM resolution

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


// Kinematics control
#define ROTATE_KP_DEFAULT 5.0
#define ROTATE_KI_DEFAULT 0.0
#define ROTATE_KP_DEFAULT 4.0
#define ROTATE_KI_DEFAULT 0.01
#define ROTATE_KD_DEFAULT 0.001
#define ROTATE_CONTROL_PERIOD 0.02
#define ROTATE_MAX_SPEED 45.0
#define ROTATE_MAX_SPEED 170.0
#define ROTATE_THRESHOLD 1

#define MOVE_KP_DEFAULT 5.0
#define MOVE_KI_DEFAULT 0.0
#define MOVE_KP_DEFAULT 4.0
#define MOVE_KI_DEFAULT 0.01
#define MOVE_KD_DEFAULT 0.001
#define MOVE_CONTROL_PERIOD 0.02
#define MOVE_MAX_SPEED 45.0
#define MOVE_MAX_SPEED 130.0
#define MOVE_THRESHOLD 3

#define MOVEMENT_DISABLED 0
Expand Down
2 changes: 1 addition & 1 deletion src/motor_control/motor_control.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "../definitions/robot_definitions.h"
#include "pid_controller.h"

#define CONTROL_LIMIT 4095
//#define CONTROL_LIMIT 4095
#define MEM_SIZE 5
#define CONTROL_MODE_NORMAL 0
#define CONTROL_MODE_LINEAR 1
Expand Down

0 comments on commit bd664bd

Please sign in to comment.