# SimpleFOC v2 - understanding sensor align

**URL:** <https://community.simplefoc.com/t/simplefoc-v2-understanding-sensor-align/806>\
**Category:** developement\
**Created:** [April 22, 2021, 1:53am UTC](https://community.simplefoc.com/t/simplefoc-v2-understanding-sensor-align/806 "2021-04-22T01:53:13Z")\
**Posts on this page:** 1\
**Showing post:** 23

<div class="post-metadata">

**Author:** ![ngalin](https://community.simplefoc.com/user_avatar/community.simplefoc.com/ngalin/32/1241_2.png) [@ngalin](https://community.simplefoc.com/u/ngalin)\
**Post date:** [May 17, 2021, 12:30am UTC](https://community.simplefoc.com/t/simplefoc-v2-understanding-sensor-align/806/23 "2021-05-17T00:30:40Z")

</div>

Hi @David_Gonzalez,

Yup, absolutely. I’ve included here a table of various control loop variables to get sensible (but not perfect) operation of the [ODrive](https://odriverobotics.com/shop/odrive-custom-motor-d5065) motor in the following control configuration:

motor.foc\_modulation = FOCModulationType::SpaceVectorPWM;  
motor.controller = MotionControlType::velocity;  
motor.torque\_controller = TorqueControlType::foc\_current;

The test harness I have setup cycles the target velocity of the motor from: 0 → 6 → 0 (rad/s) every 4 seconds. It’s not perfect, as there are still times when various control loops saturate, but it’s nothing compared to the jerky/non-rotating behavior I was getting before:

| Parameter | Value |
| --- | --- |
| voltage limit | 4 |
| current limit | 2 |
| velocity limit | 20 |
| **PID\_current\_q:** | |
| P | 0.5 |
| I | 0.1 |
| D | 0 |
| output\_ramp | 50 |
| limit | 1 |
| **PID\_current\_d:** | |
| P | 1 |
| I | 0.5 |
| D | 0.01 |
| output\_ramp | 100 |
| limit | 2 |
| **PID\_velocity:** | |
| P | 1 |
| I | 0.2 |
| D | 0.05 |
| output\_ramp | 1000 |
| limit | 500 |
| LPF\_current\_q | 0.1 |
| LPF\_current\_d | 0 |
| LPF\_velocity | 1 |

---

_[View the full topic](https://community.simplefoc.com/t/simplefoc-v2-understanding-sensor-align/806)._
