Skip to content

Commit

Permalink
update to comply with the v2.2 library version
Browse files Browse the repository at this point in the history
  • Loading branch information
askuric committed Oct 31, 2021
1 parent 671350b commit a29b599
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void setup() {
PciManager.registerListener(&listenerPB);

// set control loop type to be used
motor.controller = ControlType::voltage;
motor.controller = MotionControlType::torque;

// link the motor to the encoder
motor.linkSensor(&encoder);
Expand All @@ -63,6 +63,9 @@ void loop() {

// control loop each ~25ms
if(loop_count++ > 25){
// updating the pendulum angle sensor
// NECESSARY for library versions > v2.2
pendulum.update();

// calculate the pendulum angle
float pendulum_angle = constrainAngle(pendulum.getAngle() + M_PI);
Expand Down
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,10 @@ Then in the `setup()` we configure first the voltage of the power supply if it i
Then we tell the motor which control loop to run by specifying the `motor.controller` variable.
```cpp
// set control loop type to be used
// ControlType::voltage
// ControlType::velocity
// ControlType::angle
motor.controller = ControlType::voltage;
// MotionControlType::torque
// MotionControlType::velocity
// MotionControlType::angle
motor.controller = MotionControlType::torque;
```
<blockquote class="info">For more information about the voltage control loop please check the <a href="voltage_loop">doc</a>.</blockquote>

Expand Down Expand Up @@ -411,7 +411,7 @@ void setup() {
PciManager.registerListener(&listenerPB);
// set control loop type to be used
motor.controller = ControlType::voltage;
motor.controller = MotionControlType::torque;
// link the motor to the encoder
motor.linkSensor(&encoder);
Expand All @@ -437,7 +437,9 @@ void loop() {
// control loop each ~25ms
if(loop_count++ > 25){
// updating the pendulum angle sensor
// NECESSARY for library versions > v2.2
pendulum.update();
// calculate the pendulum angle
float pendulum_angle = constrainAngle(pendulum.getAngle() + M_PI);
Expand Down

0 comments on commit a29b599

Please sign in to comment.