Skip to content

Commit

Permalink
added the debugging in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
askuric committed Jun 20, 2024
1 parent 0611830 commit 3c3e9c8
Show file tree
Hide file tree
Showing 54 changed files with 322 additions and 112 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ void doTarget(char* cmd) { command.motion(&motor, cmd); }

void setup() {

// use monitoring with serial
Serial.begin(115200);
// enable more verbose output for debugging
// comment out if not needed
SimpleFOCDebug::enable(&Serial);

// initialize encoder sensor hardware
encoder.init();
encoder.enableInterrupts(doA, doB);
Expand Down Expand Up @@ -76,9 +82,6 @@ void setup() {
// maximal velocity of the position control
motor.velocity_limit = 4;


// use monitoring with serial
Serial.begin(115200);
// comment out if not needed
motor.useMonitoring(Serial);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ void doTarget(char* cmd) { command.scalar(&target_angle, cmd); }

void setup() {

// use monitoring with serial
Serial.begin(115200);
// enable more verbose output for debugging
// comment out if not needed
SimpleFOCDebug::enable(&Serial);

// initialize encoder sensor hardware
encoder.init();
encoder.enableInterrupts(doA, doB, doI);
Expand Down Expand Up @@ -75,8 +81,6 @@ void setup() {
motor.velocity_limit = 4;


// use monitoring with serial
Serial.begin(115200);
// comment out if not needed
motor.useMonitoring(Serial);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ void doTarget(char* cmd) { command.scalar(&target_angle, cmd); }

void setup() {

// use monitoring with serial
Serial.begin(115200);
// enable more verbose output for debugging
// comment out if not needed
SimpleFOCDebug::enable(&Serial);

// initialise magnetic sensor hardware
sensor.init();
// link the motor to the sensor
Expand Down Expand Up @@ -72,8 +78,6 @@ void setup() {
// maximal velocity of the position control
motor.velocity_limit = 40;

// use monitoring with serial
Serial.begin(115200);
// comment out if not needed
motor.useMonitoring(Serial);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ void onMotor(char* cmd){ command.motor(&motor, cmd); }

void setup() {

// use monitoring with serial
Serial.begin(115200);
// enable more verbose output for debugging
// comment out if not needed
SimpleFOCDebug::enable(&Serial);

// initialize encoder sensor hardware
encoder.init();
encoder.enableInterrupts(doA, doB);
Expand Down Expand Up @@ -90,9 +96,6 @@ void setup() {
// angle loop velocity limit
motor.velocity_limit = 50;

// use monitoring with serial for motor init
// monitoring port
Serial.begin(115200);
// comment out if not needed
motor.useMonitoring(Serial);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ void onMotor(char* cmd){ command.motor(&motor, cmd); }

void setup() {

// use monitoring with serial
Serial.begin(115200);
// enable more verbose output for debugging
// comment out if not needed
SimpleFOCDebug::enable(&Serial);

// initialize encoder sensor hardware
encoder.init();
encoder.enableInterrupts(doA, doB);
Expand Down Expand Up @@ -91,9 +97,6 @@ void setup() {
// angle loop velocity limit
motor.velocity_limit = 50;

// use monitoring with serial for motor init
// monitoring port
Serial.begin(115200);
// comment out if not needed
motor.useMonitoring(Serial);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ void onMotor(char* cmd){ command.motor(&motor, cmd); }

void setup() {

// use monitoring with serial
Serial.begin(115200);
// enable more verbose output for debugging
// comment out if not needed
SimpleFOCDebug::enable(&Serial);

// initialize encoder sensor hardware
encoder.init();
encoder.enableInterrupts(doA, doB);
Expand Down Expand Up @@ -115,10 +121,6 @@ void setup() {
motor.voltage_limit = 12.0; // 12 Volt limit
motor.current_limit = 2.0; // 2 Amp current limit


// use monitoring with serial for motor init
// monitoring port
Serial.begin(115200);
// comment out if not needed
motor.useMonitoring(Serial);
motor.monitor_variables = _MON_CURR_Q | _MON_CURR_D; // monitor the two currents d and q
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ void onMotor(char* cmd){ command.motor(&motor, cmd); }

void setup() {

// use monitoring with serial
Serial.begin(115200);
// enable more verbose output for debugging
// comment out if not needed
SimpleFOCDebug::enable(&Serial);

// initialize encoder sensor hardware
encoder.init();
encoder.enableInterrupts(doA, doB);
Expand Down Expand Up @@ -115,10 +121,6 @@ void setup() {
motor.voltage_limit = 12.0; // 12 Volt limit
motor.current_limit = 2.0; // 2 Amp current limit


// use monitoring with serial for motor init
// monitoring port
Serial.begin(115200);
// comment out if not needed
motor.useMonitoring(Serial);
motor.monitor_variables = _MON_CURR_Q | _MON_CURR_D; // monitor the two currents d and q
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ void onMotor(char* cmd){ command.motor(&motor, cmd); }

void setup() {

// use monitoring with serial
Serial.begin(115200);
// enable more verbose output for debugging
// comment out if not needed
SimpleFOCDebug::enable(&Serial);

// initialize encoder sensor hardware
encoder.init();
encoder.enableInterrupts(doA, doB);
Expand Down Expand Up @@ -116,10 +122,6 @@ void setup() {
motor.voltage_limit = 12.0; // 12 Volt limit
motor.current_limit = 2.0; // 2 Amp current limit


// use monitoring with serial for motor init
// monitoring port
Serial.begin(115200);
// comment out if not needed
motor.useMonitoring(Serial);
motor.monitor_variables = _MON_CURR_Q | _MON_CURR_D; // monitor the two currents d and q
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ void doTarget(char* cmd) { command.scalar(&target_angle, cmd); }

void setup() {

// use monitoring with serial
Serial.begin(115200);
// enable more verbose output for debugging
// comment out if not needed
SimpleFOCDebug::enable(&Serial);

// initialize encoder sensor hardware
encoder.init();
encoder.enableInterrupts(doA, doB);
Expand Down Expand Up @@ -66,9 +72,6 @@ void setup() {
// maximal velocity of the position control
motor.velocity_limit = 4;


// use monitoring with serial
Serial.begin(115200);
// comment out if not needed
motor.useMonitoring(Serial);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ void doTarget(char* cmd) { command.scalar(&target_angle, cmd); }

void setup() {

// use monitoring with serial
Serial.begin(115200);
// enable more verbose output for debugging
// comment out if not needed
SimpleFOCDebug::enable(&Serial);

// initialise magnetic sensor hardware
sensor.init();
// link the motor to the sensor
Expand Down Expand Up @@ -69,8 +75,6 @@ void setup() {
// maximal velocity of the position control
motor.velocity_limit = 40;

// use monitoring with serial
Serial.begin(115200);
// comment out if not needed
motor.useMonitoring(Serial);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ void doTarget(char* cmd) { command.scalar(&target_angle, cmd); }

void setup() {

// use monitoring with serial
Serial.begin(115200);

// initialise encoder hardware
encoder.init();
// interrupt initialization
Expand Down Expand Up @@ -85,9 +88,6 @@ void setup() {
// maximal velocity of the position control
motor.velocity_limit = 4;


// use monitoring with serial
Serial.begin(115200);
// comment out if not needed
motor.useMonitoring(Serial);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ void doI(){encoder.handleIndex();}

void setup(){

// use monitoring with serial
Serial.begin(115200);
// enable more verbose output for debugging
// comment out if not needed
SimpleFOCDebug::enable(&Serial);

// pwm frequency to be used [Hz]
driver.pwm_frequency = 20000;
// power supply voltage [V]
Expand All @@ -96,8 +102,6 @@ void setup(){
// alignment voltage limit
motor.voltage_sensor_align = 0.5;


Serial.begin(115200);
// comment out if not needed
motor.useMonitoring(Serial);
motor.monitor_variables = _MON_CURR_Q | _MON_CURR_D;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ SPIClass SPI_3(SPI3_MOSO, SPI3_MISO, SPI3_SCL);

void setup(){

// use monitoring with serial
Serial.begin(115200);
// enable more verbose output for debugging
// comment out if not needed
SimpleFOCDebug::enable(&Serial);

// pwm frequency to be used [Hz]
driver.pwm_frequency = 20000;
// power supply voltage [V]
Expand All @@ -94,8 +100,6 @@ void setup(){
// alignment voltage limit
motor.voltage_sensor_align = 0.5;


Serial.begin(115200);
// comment out if not needed
motor.useMonitoring(Serial);
motor.monitor_variables = _MON_CURR_Q | _MON_CURR_D;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ void doTarget(char* cmd) { command.scalar(&target_velocity, cmd); }


void setup() {
// use monitoring with serial
Serial.begin(115200);
// enable more verbose output for debugging
// comment out if not needed
SimpleFOCDebug::enable(&Serial);

delay(1000);
Serial.println("Initializing...");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ void doTarget(char* cmd){ command.scalar(&motor.target, cmd); }

void setup() {

// use monitoring with serial
Serial.begin(115200);
// enable more verbose output for debugging
// comment out if not needed
SimpleFOCDebug::enable(&Serial);

// initialize encoder sensor hardware
encoder.init();
encoder.enableInterrupts(doA, doB);
Expand Down Expand Up @@ -56,9 +62,6 @@ void setup() {
// angle loop velocity limit
motor.velocity_limit = 20;

// use monitoring with serial for motor init
// monitoring port
Serial.begin(115200);
// comment out if not needed
motor.useMonitoring(Serial);
motor.monitor_downsample = 0; // disable intially
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ Commander command = Commander(Serial);
void doMotor(char* cmd) { command.motor(&motor, cmd); }

void setup() {
// use monitoring with serial
Serial.begin(115200);
// enable more verbose output for debugging
// comment out if not needed
SimpleFOCDebug::enable(&Serial);

// if SimpleFOCMini is stacked in arduino headers
// on pins 12,11,10,9,8
// pin 12 is used as ground
Expand Down Expand Up @@ -84,9 +90,6 @@ void setup() {
// maximal velocity of the position control
motor.velocity_limit = 4;


// use monitoring with serial
Serial.begin(115200);
// comment out if not needed
motor.useMonitoring(Serial);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ void doMotor2(char* cmd){ command.motor(&motor2, cmd); }

void setup() {

// use monitoring with serial
Serial.begin(115200);
// enable more verbose output for debugging
// comment out if not needed
SimpleFOCDebug::enable(&Serial);

// initialize encoder sensor hardware
encoder1.init();
encoder1.enableInterrupts(doA1, doB1);
Expand Down Expand Up @@ -72,9 +78,6 @@ void setup() {
motor1.velocity_limit = 20;
motor2.velocity_limit = 20;

// use monitoring with serial for motor init
// monitoring port
Serial.begin(115200);
// comment out if not needed
motor1.useMonitoring(Serial);
motor2.useMonitoring(Serial);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ void doMotor(char* cmd){ command.motor(&motor, cmd); }

void setup() {

// use monitoring with serial
Serial.begin(115200);
// enable more verbose output for debugging
// comment out if not needed
SimpleFOCDebug::enable(&Serial);

// initialize encoder sensor hardware
encoder.init();
encoder.enableInterrupts(doA, doB);
Expand Down Expand Up @@ -48,9 +54,6 @@ void setup() {
// angle loop velocity limit
motor.velocity_limit = 20;

// use monitoring with serial for motor init
// monitoring port
Serial.begin(115200);
// comment out if not needed
motor.useMonitoring(Serial);
motor.monitor_downsample = 0; // disable intially
Expand Down
Loading

0 comments on commit 3c3e9c8

Please sign in to comment.