Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed ros_lib_kinetic
Diff: defines.h
- Revision:
- 0:dd126a1080d3
- Child:
- 1:40bdbe1a93b7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/defines.h Tue Feb 14 05:12:54 2017 +0000 @@ -0,0 +1,68 @@ + +#ifndef DEFINES_H_INCLUDED +#define DEFINES_H_INCLUDED + +//#####################################################################################\\ + +#define N_THRUSTERS 8 + +#define PID_PERIOD 50.0 // [ms] +#define LED_PERIOD 50.0 // [ms] +#define DEBUG_PERIOD 1000.0 // [ms] +#define THRUST_PERIOD 1000.0 // [ms] +#define THRUST_PWM_N 10 // Number of PWM steps per PID period + +#define NCREV 64.0 // Number of counts per revolution +#define NGR 18.75 // Gear ratio +#define V_SMAX 500.0 // [RPM] No-load max shaft speed +#define M2SEC 60.0 +#define MOTOR_PWM_PERIOD 0.00005 // 20 kHz +#define SPEED_COUNTS 50 // Number of counts per speed measurement in encoder +#define SCALED_MAX 10000.0 // Number representing maximum motor speed +#define V_SMAX_ENF 400.0 // [RPM] Enforced maximum shaft speed +#define V_SMIN_ENF 10.0 // [RPM] Enforced minimum shaft speed + +#define R 2.4 // 12 V / 5 A +#define CURRENT_MAX 5.0 // Stall curent of motor +#define VOLTAGE_MAX 12.0 // Supply voltage to motor + +#define KP 1.0 +#define KI 0.0002 +#define KD 0.0 +#define ACC_LIMIT 3.0 // Scaled accumulated error limit + +#define SMOOTHING_VAL 0.9 +#define PWM_LIMIT 1.0 + +#define INITIAL_SP 0.0 +#define COARSE_INCR 2000.0 +#define FINE_INCR 1000.0 +#define HAIR_INCR 200.0 + +#define KE_ADJUST 0.75 +#define WAIT_LIMIT 5 + +#define DEFAULT_BAUD_RATE 115200 +#define DEFAULT_BITS 8 +#define DEFAULT_PARITY Serial::None +#define DEFAULT_STOP_BITS 1 + +#define SCALE_VELCOUNTS 1000.0*SCALED_MAX*M2SEC/(NCREV*V_SMAX*NGR*VEL_PERIOD) +#define SCALE_COUNTS SCALED_MAX*M2SEC/(NCREV*V_SMAX*NGR) +#define SCALE_VSHAFT SCALED_MAX/V_SMAX +#define KE VOLTAGE_MAX/(V_SMAX*NGR) +#define KE_SCALED VOLTAGE_MAX/SCALED_MAX*KE_ADJUST +#define SCALED_SMAX_ENF V_SMAX_ENF*SCALE_VSHAFT +#define SCALED_SMIN_ENF V_SMIN_ENF*SCALE_VSHAFT + +/*extern const float SCALE_VELCOUNTS = 1000.0*SCALED_MAX*M2SEC/(NCREV*V_SMAX*NGR*VEL_PERIOD); // Scales motor pulses per velocity period to scaled motor speed (0 to SCALED_MAX) +extern const float SCALE_COUNTS = SCALED_MAX*M2SEC/(NCREV*V_SMAX*NGR); // Scales motor pulses per second to scaled motor speed +extern const float SCALE_VSHAFT = SCALED_MAX/V_SMAX; +extern const float KE = VOLTAGE_MAX/(V_SMAX*NGR); // [V*s/(motor revs)] Motor voltage constant //(60.0/(582.0*NCREV)) // 18.75 gear ratio * 500 RPM / 12 V +extern const float KE_SCALED = VOLTAGE_MAX/SCALED_MAX*KE_ADJUST; +extern const float SCALED_SMAX_ENF = V_SMAX_ENF*SCALE_VSHAFT; +extern const float SCALED_SMIN_ENF = V_SMIN_ENF*SCALE_VSHAFT;*/ + +//#####################################################################################\\ + +#endif // End include guard \ No newline at end of file