Skip to content

Commit b9fa9ee

Browse files
committed
remove unnecessary things
1 parent 18fbfe6 commit b9fa9ee

1 file changed

Lines changed: 7 additions & 16 deletions

File tree

examples/motion_control/custom_motion_control/custom_motion_control.ino

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ void setup() {
4444
SimpleFOCDebug::enable(&Serial);
4545

4646
// initialize sensor hardware
47-
sensor.init(&SPI);
47+
sensor.init();
4848
motor.linkSensor(&sensor);
4949

5050
// driver config
@@ -56,27 +56,23 @@ void setup() {
5656
// link current sense and the driver
5757
current_sense.linkDriver(&driver);
5858

59-
// set the custom control method as the position P control
59+
// set the custom control method
6060
motor.setCustomMotionControlMethod(positionPControl);
6161
// set control loop type to be used
6262
motor.controller = MotionControlType::custom;
6363
// set the torque control type to voltage control (default is voltage control)
6464
motor.torque_controller = TorqueControlType::foc_current;
6565

66-
// velocity low pass filtering time constant
67-
motor.LPF_velocity.Tf = 0.01f;
68-
69-
// angle loop controller
70-
motor.P_angle.P = 20;
71-
// angle loop velocity limit
72-
motor.velocity_limit = 20;
73-
motor.voltage_sensor_align = 1.0f;
74-
7566
// comment out if not needed
7667
motor.useMonitoring(Serial);
7768
motor.monitor_downsample = 0; // disable intially
7869
motor.monitor_variables = _MON_TARGET | _MON_VEL | _MON_ANGLE; // monitor target velocity and angle
7970

71+
// subscribe motor to the commander
72+
//command.add('T', doMotion, "motion control"); // a bit less resouce intensive
73+
command.add('M', doMotor, "motor");
74+
command.add('C', doPID, "custom PID");
75+
8076
// current sense init and linking
8177
current_sense.init();
8278
motor.linkCurrentSense(&current_sense);
@@ -86,11 +82,6 @@ void setup() {
8682
// align encoder and start FOC
8783
motor.initFOC();
8884

89-
// subscribe motor to the commander
90-
//command.add('T', doMotion, "motion control"); // a bit less resouce intensive
91-
command.add('M', doMotor, "motor");
92-
command.add('C', doPID, "custom PID");
93-
9485
_delay(1000);
9586
}
9687

0 commit comments

Comments
 (0)