Using a 2nd IMU: Difference between revisions

From STorM32-BGC Wiki
Jump to navigation Jump to search
(Undo revision 8662 by OlliW (talk))
Tag: Undo
 
(41 intermediate revisions by the same user not shown)
Line 1: Line 1:
The STorM32 controller allows the use of a second IMU (2nd IMU), in addition to the camera IMU mounted to the camera platform, for superior performance. It's usage and advantages are described here.
The STorM32 controller allows us to use a second IMU (2nd IMU, IMU2), in addition to the camera IMU (IMU1) mounted to the camera platform, for superior performance. It's usage and advantages are described here.
 
{{COMMENT|For T-STorM32 builds the information on this pages is irrelevant; T-STorM32 does not need a 2nd IMU and in fact does not use a 2nd IMU even when one is present.}}


== Installation Options ==
== Installation Options ==
Line 6: Line 8:
  The 2nd IMU must be mounted such that it is not moved by any of the motors.  
  The 2nd IMU must be mounted such that it is not moved by any of the motors.  


It typically is mounted on the gimbal support above the yaw motor. It must not be mounted on one of the gimbal arms or the camera platform.  
It is typically mounted on the gimbal support above/below the yaw motor. It must not be mounted on one of the gimbal arms or the camera platform.
 
So, you can either mount the STorM32 controller board on the gimbal support, and then use the on-board IMU as 2nd IMU, or you put the controller board somewhere else (on the yaw axis or camera platform for example) and mount an external IMU module above/below the yaw motor. These two options are shown as option (1) and (2) in the diagram below.


So, you can either mount the STorM32 controller board on the gimbal support, and then use the on-board IMU as 2nd IMU, or you put the controller board somewhere else (on the yaw axis for example) and mount an external IMU module above the yaw motor. These two options are shown as option (1) and (2) in the diagram below. {{WARNING|Option (3) is '''''not''''' supported by the STorM32}}.
{{WARNING|'''''Comment''': Option (3) in the diagram is '''not''' supported by STorM32''}}.


The external IMU module can be either a NT IMU module or a "traditional" I2C-based MPU6050 board. The NT IMU module would be connected, like all NT modules, to the NT bus. Its ID solder bridge must be closed (for its location see [[Pins and Connectors of NT Modules]]). An external I2C-based IMU would be connected to the I2C#2 connector on the bottom of the STorM32 board.  
The NT IMU module would be connected, like all NT modules, to the NT bus, but its ID solder bridge must be closed (for its location see [[Pins and Connectors of NT Modules]]).


Which IMU is selected as 2nd IMU is determined by the STorM32 controller as follows:
Which IMU is selected as 2nd IMU is determined by the STorM32 controller as follows:
* If a NT IMU module configured as Imu2 (ID solder pad closed) is found on the NT bus, then it will be used as 2nd IMU.
* If a NT IMU module configured as IMU2 (ID solder pad closed) is found on the NT bus, then it will be used as 2nd IMU.
* If a NT IMU module is not found, but an I2C-based IMU is found at the I2C#2 connector, then it will be used as 2nd IMU.
* Otherwise the on-board IMU will be used as 2nd IMU, if a on-board IMU is present.
* If neither of the above, then the on-board IMU will be used as 2nd IMU.
 
In order to make use of the 2nd IMU, it needs to be explicitly activated, see [[#IMU Configuration|IMU Configuration]].


{{COMMENT|The on-board mpu6050 IMU is connected to the I2C#2 connector internally and is set to a non default I2C address. If you connect an external I2C-based IMU to the I2C#2 connector, then it can be recognized by its default I2C address, and is used instead of the on-board IMU.}}
Some features related to the 2nd IMU are enabled by the presence of the 2nd IMU and others needs to be explicitly activated by setting the respective parameter; see [[#IMU Configuration|IMU Configuration]].


[[File:Storm32-wiki-2nd-imu-configurations.jpg|640px|center]]
[[File:Storm32-wiki-2nd-imu-configurations.jpg|640px|center]]
Line 27: Line 28:
As with the camera IMU, also the 2nd IMU, be it the on-board IMU or an external IMU module, needs to be calibrated for optimal performance.
As with the camera IMU, also the 2nd IMU, be it the on-board IMU or an external IMU module, needs to be calibrated for optimal performance.


However, fortunately, for the 2nd IMU it's not critical to get the most accurate calibration, and a good 1-point calibration should be enough for most situations. Exceptions are then motors with high motor pole counts, larger than 14, are used.
However, fortunately, for the 2nd IMU it is not critical to get the most accurate calibration, and a good 1-point calibration should be enough for most situations. Exceptions are then motors with high motor pole counts, larger than 14, are used.


The calibration of the 2nd IMU works similar to the camera IMU; one just has to select the 2nd IMU in the respective fields.
The calibration of the 2nd IMU works similar to the camera IMU; one just has to select the 2nd IMU in the respective fields.
Line 33: Line 34:
== IMU Orientation ==
== IMU Orientation ==


For a correct functioning it is very important to set the IMU orientation correctly, i.e., the parameter field {{PARAMNAME|Imu2 Orientation}} in the {{GUI|Gimbal Configuration}} tab.
For a correct functioning it is mandatory to set the IMU orientation correctly, i.e., the parameter field {{PARAMNAME|Imu2 Orientation}} in the {{GUI|Gimbal Configuration}} tab. If this parameter is configured incorrectly, then the gimbal will missbehave, as simple as that.


This is most conveniently achieved by using the {{GUI|Configure Gimbal Tool}}. Alternatively, it may be set manually following the recipe described in [[Manually Setting the IMU Orientation]].
The configuration is most conveniently - and most reliably - achieved by using the {{GUI|Configure Gimbal Tool}}. Alternatively, it may be set manually following the recipe described in [[Manually Setting the IMU Orientation]].


== Yaw Axis Alignment ==
== Yaw Axis Alignment ==


It is also very important to ensure that at startup the camera is aligned properly with respect to the gimbal support; it needs to point forward to within a degree or so.
It is also mandatory to ensure that at startup the camera is aligned properly with respect to the gimbal support; it needs to point forward to within a degree or so.


This is most conveniently achieved by using the {{GUI|Configure Gimbal Tool}}, which in one step allows you to adjust the camera orientation. Alternatively, the yaw axis orientation at startup may be adjusted manually by setting the {{PARAMNAME|Yaw Startup Motor Pos}} parameter in the {{GUI|Gimbal Configuration}} tab.
This is most conveniently achieved by using the {{GUI|Configure Gimbal Tool}}, which in one step allows you to adjust the camera yaw orientation. Alternatively, the yaw axis orientation at startup may be adjusted manually by setting the {{PARAMNAME|Yaw Startup Motor Pos}} parameter in the {{GUI|Gimbal Configuration}} tab.


{{COMMENT|It is '''not''' required to orient the camera precisely by hand '''before''' the controller is switched on. Here it is sufficient to have the camera aligned to within typically +-25° (for a 14 pole yaw motor). However, when the controller is powered up, it first moves the motors to default startup positions, and after this step the camera must precisely point to the forward.}}
{{COMMENT|It is '''not''' required to orient the camera precisely by hand '''before''' the controller is switched on. Here it is sufficient to have the camera aligned to within typically +-25° (for a 14 pole yaw motor). When the controller is powered up, it first moves the motors to default startup positions. However, after this step the camera must precisely point to the forward.}}


== IMU Configuration ==
== IMU Configuration ==


The 2nd IMU support is determined by the parameter {{PARAMNAME|Imu2 Configuration}} found in the {{GUI|Setup}} tab. To activate the 2nd IMU, set it to
The 2nd IMU support is determined by the parameter {{PARAMNAME|Imu2 Configuration}} found in the {{GUI|Setup}} tab. To activate the 2nd IMU, set it to
* {{PARAMVALUE|full}}: activate 2nd IMU above the yaw motor
* {{PARAMNAME|Imu2 Configuration}} = {{PARAMVALUE|full}}: activate 2nd IMU above the yaw motor
* {{PARAMVALUE|full xy}}: activate 2nd IMU above the yaw motor, with the IMU rotated by 45°.
 
{{COMMENT|Setting the parameter {{PARAMNAME|Imu2 Configuration}} enables all IMU2 related features except of the fast startup mode, such as disturbance correction or enhanced operation range}}.
 
== Fast Startup ==
 
When a 2nd IMU is available, and further conditions are met, the startup time and behavior of the gimbal can be much improved by enabling the fast startup feature. To activate the fast startup, set
* {{PARAMNAME|Startup Mode}} = {{PARAMVALUE|fast}}: enable fast startup mode
 
{{COMMENT|The fast startup mode feature is available whenever a 2nd IMU is present (and the additional conditions calibrated IMUs, configured motor directions and configured startup motor positions are fullfilled). That is, for this feature the parameter {{PARAMNAME|Imu2 Configuration}} does not need to be activated. For all other IMU2 related features such as disturbance correction or enhanced operation range, the parameter needs to be enabled}}.
 
{{COMMENT|Double check that none of the {{PARAMNAME|Motor Direction}} parameters are set to {{PARAMVALUE|auto}}, to skip the time-consuming automatic determination of the motor directions}}.


== PID Tuning ==
== PID Tuning ==
Line 57: Line 68:
If, after the initial PID tuning, the 2nd IMU is activated, then the gimbal often works "out of the box", but sometimes the PID values might have to be slightly readjusted. The reasons are the imperfections in the gimbal, such as the balance, the motor quality or insufficiently stiff gimbal arms. With the 2nd IMU activated the controller is much faster and can compensate gimbal motions much better, as a view on the {{GUI|DataDisplay}} impressively demonstrates. The downside is that imperfections get amplified. Especially the balance of the yaw axis and play in the motor bearings are typical culprits.
If, after the initial PID tuning, the 2nd IMU is activated, then the gimbal often works "out of the box", but sometimes the PID values might have to be slightly readjusted. The reasons are the imperfections in the gimbal, such as the balance, the motor quality or insufficiently stiff gimbal arms. With the 2nd IMU activated the controller is much faster and can compensate gimbal motions much better, as a view on the {{GUI|DataDisplay}} impressively demonstrates. The downside is that imperfections get amplified. Especially the balance of the yaw axis and play in the motor bearings are typical culprits.


If these points cannot be further improved, it can be very successful to down-tune the roll and yaw PID controllers, i.e., to reduce their values. You need to experiment. The control precision is then reduced, but since with 2nd IMU it is much higher anyhow it overall will be still better.  
If these points cannot be further improved, it can be very successful to down-tune the roll and yaw PID controllers, i.e., to reduce their values. You need to experiment. The control precision is then reduced, but since with 2nd IMU it is much higher anyhow it overall will still be better.  


Further points to try is to test different values for {{PARAMNAME|Gyro LPF}}, and/or change the {{PARAMNAME|Motor Vmax}} values by some digits.
Further points to try is to test different values for {{PARAMNAME|Gyro LPF}}, and/or change the {{PARAMNAME|Motor Vmax}} values by some digits.
Line 63: Line 74:
== Benefits of a 2nd IMU ==
== Benefits of a 2nd IMU ==


Nowadays advanced brushless gimbal controller provide 2nd IMU support, but there are marked differences in how and to what extend the 2nd IMU is used. The STorM32 controller is - to the best of the knowledge of the firmware author - unique in that it provides (i) a '''''stable''''' operation with the 2nd IMU above the yaw motor and (ii) a '''''distortion rejection''''' for the yaw axis also in the pan/follow mode. Usually these features would require the installation of a poti or angle encoder on yaw.
Nowadays advanced brushless gimbal controllers provide 2nd IMU support, but there are marked differences in how and to what extend the 2nd IMU is used. The STorM32 controller is - to the best of the knowledge of the firmware author - unique in that it provides (i) a '''''stable''''' operation with the 2nd IMU above the yaw motor and (ii) a '''''disturbance rejection''''' for the yaw axis also in the pan/follow mode. Usually these features would require the installation of a poti or angle encoder on the yaw axis.


The benefits provided by the STorM32's 2nd IMU support are
The benefits provided by the STorM32's 2nd IMU support are
* significantly improved accuracy, i.e., the camera is held in position with a much smaller error bandwidth
* significantly improved stabilization accuracy, i.e., the camera is held in position with a much smaller error bandwidth
* drastically larger range of operation, essentially any pitch and yaw angle is possible (for a more detailed discussion of the possibilities and limitations see here)
* drastically larger range of operation, essentially any pitch and yaw angle is possible (for a more detailed discussion of the possibilities and limitations see the video below)
* stable operation of the 2nd IMU above the yaw axis without deterioration over time due to gyro drift
* stable operation of the 2nd IMU above the yaw axis, without deterioration with time due to gyro drift (the gimbal doesn't freak out after some time)
* returns to the correct yaw orientation after an external distortion, also when in pan/follow mode
* can return to correct yaw orientation after an external disturbance, also when in pan/follow mode
* fast startup mode


These features were demonstrated in this video for an early test version of the firmware (the features became better since then):
Some of these features were demonstrated in this video for an early test version of the firmware (may not reflect current behavior):


{{#ev:youtube|XeKQRgV_V9Q|480|center}}
{{#ev:youtube|XeKQRgV_V9Q|480|center}}

Latest revision as of 12:04, 18 November 2023

The STorM32 controller allows us to use a second IMU (2nd IMU, IMU2), in addition to the camera IMU (IMU1) mounted to the camera platform, for superior performance. It's usage and advantages are described here.

Comment: For T-STorM32 builds the information on this pages is irrelevant; T-STorM32 does not need a 2nd IMU and in fact does not use a 2nd IMU even when one is present.

Installation Options

The primary rule for installation is:

The 2nd IMU must be mounted such that it is not moved by any of the motors. 

It is typically mounted on the gimbal support above/below the yaw motor. It must not be mounted on one of the gimbal arms or the camera platform.

So, you can either mount the STorM32 controller board on the gimbal support, and then use the on-board IMU as 2nd IMU, or you put the controller board somewhere else (on the yaw axis or camera platform for example) and mount an external IMU module above/below the yaw motor. These two options are shown as option (1) and (2) in the diagram below.

Comment: Option (3) in the diagram is not supported by STorM32.

The NT IMU module would be connected, like all NT modules, to the NT bus, but its ID solder bridge must be closed (for its location see Pins and Connectors of NT Modules).

Which IMU is selected as 2nd IMU is determined by the STorM32 controller as follows:

  • If a NT IMU module configured as IMU2 (ID solder pad closed) is found on the NT bus, then it will be used as 2nd IMU.
  • Otherwise the on-board IMU will be used as 2nd IMU, if a on-board IMU is present.

Some features related to the 2nd IMU are enabled by the presence of the 2nd IMU and others needs to be explicitly activated by setting the respective parameter; see IMU Configuration.

Storm32-wiki-2nd-imu-configurations.jpg

Calibration

As with the camera IMU, also the 2nd IMU, be it the on-board IMU or an external IMU module, needs to be calibrated for optimal performance.

However, fortunately, for the 2nd IMU it is not critical to get the most accurate calibration, and a good 1-point calibration should be enough for most situations. Exceptions are then motors with high motor pole counts, larger than 14, are used.

The calibration of the 2nd IMU works similar to the camera IMU; one just has to select the 2nd IMU in the respective fields.

IMU Orientation

For a correct functioning it is mandatory to set the IMU orientation correctly, i.e., the parameter field Imu2 Orientation in the [GUI:Gimbal Configuration] tab. If this parameter is configured incorrectly, then the gimbal will missbehave, as simple as that.

The configuration is most conveniently - and most reliably - achieved by using the [GUI:Configure Gimbal Tool]. Alternatively, it may be set manually following the recipe described in Manually Setting the IMU Orientation.

Yaw Axis Alignment

It is also mandatory to ensure that at startup the camera is aligned properly with respect to the gimbal support; it needs to point forward to within a degree or so.

This is most conveniently achieved by using the [GUI:Configure Gimbal Tool], which in one step allows you to adjust the camera yaw orientation. Alternatively, the yaw axis orientation at startup may be adjusted manually by setting the Yaw Startup Motor Pos parameter in the [GUI:Gimbal Configuration] tab.

Comment: It is not required to orient the camera precisely by hand before the controller is switched on. Here it is sufficient to have the camera aligned to within typically +-25° (for a 14 pole yaw motor). When the controller is powered up, it first moves the motors to default startup positions. However, after this step the camera must precisely point to the forward.

IMU Configuration

The 2nd IMU support is determined by the parameter Imu2 Configuration found in the [GUI:Setup] tab. To activate the 2nd IMU, set it to

  • Imu2 Configuration = “full”: activate 2nd IMU above the yaw motor

Comment: Setting the parameter Imu2 Configuration enables all IMU2 related features except of the fast startup mode, such as disturbance correction or enhanced operation range.

Fast Startup

When a 2nd IMU is available, and further conditions are met, the startup time and behavior of the gimbal can be much improved by enabling the fast startup feature. To activate the fast startup, set

  • Startup Mode = “fast”: enable fast startup mode

Comment: The fast startup mode feature is available whenever a 2nd IMU is present (and the additional conditions calibrated IMUs, configured motor directions and configured startup motor positions are fullfilled). That is, for this feature the parameter Imu2 Configuration does not need to be activated. For all other IMU2 related features such as disturbance correction or enhanced operation range, the parameter needs to be enabled.

Comment: Double check that none of the Motor Direction parameters are set to “auto”, to skip the time-consuming automatic determination of the motor directions.

PID Tuning

The initial PID tuning should be done with the 2nd IMU deactivated.

If, after the initial PID tuning, the 2nd IMU is activated, then the gimbal often works "out of the box", but sometimes the PID values might have to be slightly readjusted. The reasons are the imperfections in the gimbal, such as the balance, the motor quality or insufficiently stiff gimbal arms. With the 2nd IMU activated the controller is much faster and can compensate gimbal motions much better, as a view on the [GUI:DataDisplay] impressively demonstrates. The downside is that imperfections get amplified. Especially the balance of the yaw axis and play in the motor bearings are typical culprits.

If these points cannot be further improved, it can be very successful to down-tune the roll and yaw PID controllers, i.e., to reduce their values. You need to experiment. The control precision is then reduced, but since with 2nd IMU it is much higher anyhow it overall will still be better.

Further points to try is to test different values for Gyro LPF, and/or change the Motor Vmax values by some digits.

Benefits of a 2nd IMU

Nowadays advanced brushless gimbal controllers provide 2nd IMU support, but there are marked differences in how and to what extend the 2nd IMU is used. The STorM32 controller is - to the best of the knowledge of the firmware author - unique in that it provides (i) a stable operation with the 2nd IMU above the yaw motor and (ii) a disturbance rejection for the yaw axis also in the pan/follow mode. Usually these features would require the installation of a poti or angle encoder on the yaw axis.

The benefits provided by the STorM32's 2nd IMU support are

  • significantly improved stabilization accuracy, i.e., the camera is held in position with a much smaller error bandwidth
  • drastically larger range of operation, essentially any pitch and yaw angle is possible (for a more detailed discussion of the possibilities and limitations see the video below)
  • stable operation of the 2nd IMU above the yaw axis, without deterioration with time due to gyro drift (the gimbal doesn't freak out after some time)
  • can return to correct yaw orientation after an external disturbance, also when in pan/follow mode
  • fast startup mode

Some of these features were demonstrated in this video for an early test version of the firmware (may not reflect current behavior):