From 20ccf94852819bf50e088220663b476a3a95e0b8 Mon Sep 17 00:00:00 2001 From: Lucien Renaud Date: Fri, 27 May 2022 19:59:48 +0200 Subject: [PATCH] Typo readme --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 8ddeb07..b17804d 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ The Gimbal is composed of a flex PCB with a main connector and 3 smaller for eac Here is the strategy I followed to find the pinout: 1. Find all equipotential pins with a multimeter set to continuity tests, and test all the combinations -2. Group remaining pins by motor With the multimeter find all the pins connected to the motor connector. (Reapeat 3 times for the other connectors) +2. Group remaining pins by motor with the multimeter find all the pins connected to the motor connector. (Reapeat 3 times for the other connectors) @@ -47,7 +47,7 @@ We can see that in the first movement (positive rotation), the green is out of p ### 3. Encoding the position 1. Get the absolute angle within a period -Since the 2 signals correspond to a cos and sin signals, it is possible to compute the angle inside the period using arctan2 function. However, we have more than one period, it is so necessary to increment a position. +Since the 2 signals correspond to cos and sin signals, it is possible to compute the angle inside the period using arctan2 function. However, we have more than one period, it is so necessary to increment a position. $$\theta= atan2(a,b)$$ 2. Incremental position @@ -57,10 +57,10 @@ Then we need to sum all the delta of movement at each measure sample. $$\phi_t=\phi_{t-1} + (\theta_t - \theta_{t-1})mod(-\pi;\pi)$$ ## Coding the solution -1. Get the angle in the perdiod +1. Get the angle in the period In order to compute the angle from the cos and sin with atan, it is necessary to remap the values of the analog readings from -1 to 1. -Beforehand, the maximum and minimum peak of the signals need to be found. It can be done by swiping the motor on startup in open-loop mode. +Beforehand, the maximum and minimum peak of the signals need to be found. It can be done by swiping the motor on startups in open-loop mode. Then the arctan function can be applied. It is preferable to use arctan2 as it will give an angle within the 4 quadrants (-π,π). Whereas arctan give an angle between (-π/2,π/2). [Wikipedia](https://en.wikipedia.org/wiki/Atan2) ```C++ @@ -74,7 +74,7 @@ float LinearHallSensor::Callback() // Return the estimated position of the sens phi = phi + dist_angle(theta, theta_prev); // increment the difference - theta_prev = theta; // save fot nex time + theta_prev = theta; // save for next time return phi; } @@ -97,9 +97,9 @@ float dist_angle(float newAngle, float prevAngle) // return the difference modul ``` ## Tuning the PIDs -To achive position control it is necessary to have first, a velocity controller well tuned, as they are in cascade. (SimpleFOC implementation and diagram) +To achieve position control it is necessary to have first, a velocity controller well tuned, as they are in cascade. (SimpleFOC implementation and diagram) ![Closed loop position diagram from SimpleFOC](docs/angle_loop_v.png) -However, the motors of the gimbal have hard stop and can only rotate of around a half turn. It was so necessary to remove these mecanical stops. I drilled with a 1.6mm drill the two little holes to remove it. Then the motor was able to rotate freely and PID can be tuned. +However, the motors of the gimbal have hard stops and can only rotate around a half turn. It was so necessary to remove these mechanical stops. I drilled with a 1.6 mm drill the two little holes to remove it. Then the motor was able to rotate freely and PID can be tuned.