Skip to content

Commit b42db27

Browse files
committed
motion control done
1 parent 17316b9 commit b42db27

56 files changed

Lines changed: 1246 additions & 452 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/simplefoc_library/code/communication/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ has_toc: False
1515
- 📈 Supervision and variable monitoring - [Monitoring](monitoring)
1616
- ⚙️ Tunning and Configuration interface - [Commander interface](commander_interface)
1717

18+
[Set up Monitoring](monitoring){: .btn .btn-docs .mr-2}
19+
[Configure Commander interface](commander_interface){: .btn .btn-docs}
20+
1821
Additionally we will try to provide an implementation of the simplest forms of the communication protocols:
1922
- [Step-direction interface](step_dir_interface)
2023
- PWM interface - *not supported yet*

docs/simplefoc_library/code/current_sense/index.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,6 @@ Note: current sensing on Renesas MCUs will be added in a future release.
7272

7373
## Digging deeper
7474

75-
For more theoretical explanations and source code implementations of the current sensing and its integration into the FOC and motion check out the [digging deeper section](digging_deeper).
75+
For more theoretical explanations and source code implementations of the current sensing and its integration into the FOC and motion check out the digging deeper section.
76+
77+
[Learn about current sensing theory and implementation](digging_deeper){: .btn .btn-docs}

docs/simplefoc_library/code/drivers/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ Arduino <span class="simple">Simple<span class="foc">FOC</span>library</span> su
2424
- **4 PWM signals** ( 2 phase ) - `StepperDriver4PWM`
2525
- **2 PWM signals** ( 2 phase ) - `StepperDriver2PWM`
2626

27+
[Configure BLDC drivers](bldcdriver){: .btn .btn-docs .mr-2}
28+
[Configure Stepper drivers](stepperdriver){: .btn .btn-docs}
2729

2830
The driver code is written in a way to support as many different drivers out there as possible and in a way to be fully interchangeable.
2931
These classes can be used as stand-alone classes and they can be used to set certain PWM value to the driver outputs, see example codes in `utils > driver_standalone_test`.

docs/simplefoc_library/code/motion_control/closed_loop_control/angle/angle.md

Lines changed: 148 additions & 81 deletions
Large diffs are not rendered by default.

docs/simplefoc_library/code/motion_control/closed_loop_control/angle/angle_nocascade.md

Lines changed: 144 additions & 109 deletions
Large diffs are not rendered by default.

docs/simplefoc_library/code/motion_control/closed_loop_control/angle/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ This angle control loop is therefore created by adding one more control loop in
5454

5555
</div>
5656
<div class="cascade cascade-n hide" markdown="1">
57-
<img class="width60 type type-b" src="extras/Images/an_b_i.drawio.png">
58-
<img class="width60 type type-s hide" src="extras/Images/an_s_i.drawio.png">
57+
<img class="width60 type type-b" src="extras/Images/an_b_i1.drawio.png">
58+
<img class="width60 type type-s hide" src="extras/Images/an_s_i1.drawio.png">
5959

6060
In **No-cascade position control** the angle control loop is closing the loop directly around the torque control loop. This means that the angle controller will be setting the torque target to the torque controller, without using the velocity controller in between.
6161

docs/simplefoc_library/code/motion_control/closed_loop_control/index.md

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,41 +10,22 @@ parent: Motion Control
1010
grand_parent: Writing the Code
1111
grand_grand_parent: Arduino <span class="simple">Simple<span class="foc">FOC</span>library</span>
1212
---
13-
# Motion control
13+
# Closed loop motion control
1414

1515

16-
Choose the motor type:
17-
1816
<a href ="javascript:show('b','type');" class="btn btn-type btn-b btn-primary">BLDC motors</a>
1917
<a href ="javascript:show('s','type');" class="btn btn-type btn-s"> Stepper motors</a>
2018

21-
Choose the voltage control type:
22-
23-
<a href ="javascript:show(0,'loop');" id="btn-0" class="btn btn-loop btn-primary">Position control</a>
24-
<a href ="javascript:show(1,'loop');" id="btn-1" class="btn btn-loop">Velocity control</a>
25-
<a href ="javascript:show(2,'loop');" id="btn-2" class="btn btn-loop">Torque control</a>
26-
27-
<div class="type type-b">
28-
<img class="loop loop-0 width80" src="extras/Images/closedloop_0000_Layer 3.jpg"/>
29-
<img class="loop loop-1 width80 hide" src="extras/Images/closedloop_0001_Layer 2.jpg"/>
30-
<img class="loop loop-2 width80 hide" src="extras/Images/closedloop_0002_Layer 1.jpg"/>
31-
32-
</div>
33-
<div class="type type-s hide">
34-
35-
<img id="4" class="loop width80 loop-0" src="extras/Images/closed_loop_stepper3.jpg"/>
36-
<img id="5" class="loop width80 loop-1 hide" src="extras/Images/closed_loop_stepper2.jpg"/>
37-
<img id="6" class="loop width80 loop-2 hide" src="extras/Images/closed_loop_stepper1.jpg"/>
38-
39-
</div>
19+
<img class="type type-b width60" src="extras/Images/clb.png"/>
20+
<img class="type type-s width60 hide" src="extras/Images/cls.png"/>
4021

22+
This is the standard motion control approach where the position sensor is used to provide feedback to the motion control loop. The motion control loop (`motor.move()`) will calculate the target torque (current or voltage) to be applied to the motor using the underlying torque/FOC control loop (`motor.loopFOC()`) in order to achieve the desired motion.
4123

4224
<span class="simple">Simple<span class="foc">FOC</span>library</span> gives you the choice of using 3 different Closed-Loop control strategies:
4325
- [Torque control loop](torque_loop)
4426
- [Velocity motion control](velocity_loop)
4527
- [Position/angle motion control](angle_loop)
4628

47-
You set it by changing the `motor.controller` variable. If you want to control the motor angle you will set the `controller` to `MotionControlType::angle` or `MotionControlType::angle_nocascade`, if you want to control the torque of the BLDC or Stepper motors either through voltage or the current use `MotionControlType::torque`, if you wish to control motor angular velocity `MotionControlType::velocity`.
4829

4930
```cpp
5031
// set FOC loop to be used
@@ -55,8 +36,38 @@ You set it by changing the `motor.controller` variable. If you want to control t
5536
motor.controller = MotionControlType::angle;
5637
```
5738

39+
5840
| Torque control | Velocity control | Position/angle control |
5941
|----------------|------------------|-----------------------|
6042
| `MotionControlType::torque` | `MotionControlType::velocity` | `MotionControlType::angle` or<br> `MotionControlType::angle_nocascade` |
6143
|[Go to Torque control docs](torque_loop){: .btn .mr-2 .btn-docs} | [Go to Velocity control docs](velocity_loop){: .btn .mr-2 .btn-docs} |[Go to Position/angle control docs](angle_loop){: .btn .mr-2 .btn-docs}|
6244

45+
### How it works?
46+
47+
<a href ="javascript:show('b','type');" class="btn btn-type btn-b btn-primary">BLDC motors</a>
48+
<a href ="javascript:show('s','type');" class="btn btn-type btn-s"> Stepper motors</a>
49+
50+
Choose the motion control type:
51+
52+
<a href ="javascript:show('ac','loop');" id="btn-ac" class="btn btn-loop btn-primary">Position control (Cascaded)</a>
53+
<a href ="javascript:show('an','loop');" id="btn-an" class="btn btn-loop">Position control (Non-Cascaded)</a>
54+
<a href ="javascript:show('v','loop');" id="btn-v" class="btn btn-loop">Velocity control</a>
55+
<a href ="javascript:show('t','loop');" id="btn-t" class="btn btn-loop">Torque control</a>
56+
57+
<div class="type type-b">
58+
<img class="loop loop-ac width80" src="extras/Images/a_b_i.drawio.png"/>
59+
<img class="loop loop-an width80 hide" src="extras/Images/an_b_i1.drawio.png"/>
60+
<img class="loop loop-v width80 hide" src="extras/Images/v_b_i.drawio.png"/>
61+
<img class="loop loop-t width80 hide" src="extras/Images/t_b_i.drawio.png"/>
62+
63+
</div>
64+
<div class="type type-s hide">
65+
66+
<img class="loop loop-ac width80" src="extras/Images/a_s_i.drawio.png"/>
67+
<img class="loop loop-an width80 hide" src="extras/Images/an_s_i1.drawio.png"/>
68+
<img class="loop loop-v width80 hide" src="extras/Images/v_s_i.drawio.png"/>
69+
<img class="loop loop-t width80 hide" src="extras/Images/t_s_i.drawio.png"/>
70+
71+
</div>
72+
73+

0 commit comments

Comments
 (0)