Command Hardware Control – IMU (MPU9250)
<Header> + <Payload_length> | <Payload> | ||||||
PL0 | PL1 | PL2 | PL3 | PL4 | PL5 | … | |
$ESP_OK|xx| | ‘T’ | ‘M’ | ID Control | Infor 1 | Infor 2 | Infor 3 | ... |
‘T’ | ‘M’ | PL2 | Control IMU (MPU9250) | 5 |
| ‘0’ | M_Start_Print_IMU_Data |
| |
‘1’ | M_Stop_Print_IMU_Data |
| ||
‘2’ | M_Start_IMU_Calibrate |
| ||
‘3’ | M_Stop_IMU_Calibrate |
| ||
‘4’ | M_Save_Calibrate_Result |
| ||
|
| Disable/Enable type print IMU |
|
HOST send M_Start_Print_IMU_Data
<Header> + <Payload_length> | <Payload> | ||||||
PL0 | PL1 | PL2 | PL3 | PL4 | PL5 | … | |
$ESP_OK|xx| | ‘T’ | ‘M’ | ‘0’ | Infor 1 | Infor 2 | Infor 3 | ... |
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | ||
PL2 | ‘0’ |
| ID Control :M_Start_Print_IMU_Data |
| |||||
| PL3 | INTEGER | 0 | 9 | - | - | Type frequency update IMU
|
| |
0 | 2 Hz | ||||||||
1 | 10 Hz | ||||||||
2 | 15 Hz | ||||||||
3 | 20 Hz | ||||||||
4 | 25 Hz | ||||||||
5 | 35 Hz | ||||||||
6 | 50 Hz | ||||||||
7 | 100 Hz | ||||||||
8 | 150 Hz | ||||||||
9 | 200 Hz |
ESPrtk Respond
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | ||
PL2 | ‘0’ |
| ID Control : M_Start_Print_IMU_Data |
| |||||
| PL3 | INTEGER | -1 | 1 | - | - | Status Control |
| |
-1 | NACK: Invalid input /wrong format / out of range …? | ||||||||
0 | Error: Not found data configure for MPU9250 in Profile | ||||||||
1 | OK: Is starting connect to IMU and print IMU data | ||||||||
| PL4 | STRING | - | - | - | - | Describe status respond control as text |
|
Example
Message : | |
HOST Send | $ESP_OK|8|T|M|0|1|*3D5A |
ACK Respond | $ESP_OK|64|T|M|0|1|Is starting print IMU data , Type Frequency update = 1 |*1C0E |
NACK Respond |
|
Other NACK | $ESP_ER|… or $ESS_ER|… or $AES_ER|… |
HOST send M_Stop_Print_IMU_Data
<Header> + <Payload_length> | <Payload> | ||||||
PL0 | PL1 | PL2 | PL3 | PL4 | PL5 | … | |
$ESP_OK|xx| | ‘T’ | ‘M’ | ‘1’ | Infor 1 | Infor 2 | Infor 3 | ... |
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | |
PL2 | ‘1’ | STRING | - | - | 1 | 1 | ID Control : M_Stop_Print_IMU_Data |
|
ESPrtk Respond
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | ||
PL2 | ‘1’ |
| ID Control : M_Stop_Print_IMU_Data |
| |||||
| PL3 | INTEGER | -1 | 1 | - | - | Status Control |
| |
-1 | NACK: Invalid input /wrong format / out of range …? | ||||||||
0 | Error: | ||||||||
1 | OK: Stopped Print IMU data | ||||||||
| PL4 | STRING | - | - | - | - | Describe status respond control as text |
|
Example
Message : | |
HOST Send | $ESP_OK|6|T|M|1|*7F26 |
ACK Respond | $ESP_OK|31|T|M|1|1|Stopped Print IMU data|*031B |
NACK Respond |
|
Other NACK | $ESP_ER|… or $ESS_ER|… or $AES_ER|… |
HOST send Disable/Enable type print IMU
Please see “Control Enable Type Print on TX_UART0” → PL3 → BIT11 and BIT12.
$ESP_OK|19|T|P|0|000000000000|*2157 -> Disable Print ALL output UART_0 $ESP_OK|19|T|P|0|111111111100|*2156 -> Disable Print IMU 1 + IMU2 $ESP_OK|19|T|P|0|111111111110|*2057 -> Disable Print IMU 1 , Enable Print IMU2 $ESP_OK|19|T|P|0|111111111101|*2056 -> Enable Print IMU1 , Disable Print IMU 2 $ESP_OK|19|T|P|0|111111111111|*2157 -> Enable Print ALL output UART_0 |
HOST send M_Start_IMU_Calibrate
<Header> + <Payload_length> | <Payload> | ||||||
PL0 | PL1 | PL2 | PL3 | PL4 | PL5 | … | |
$ESP_OK|xx| | ‘T’ | ‘M’ | ‘2’ | Infor 1 | Infor 2 | Infor 3 | ... |
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | |
PL2 | ‘2’ | STRING | - | - | 1 | 1 | ID Control : M_Start_IMU_Calibrate |
|
ESPrtk Respond
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | ||
PL2 | ‘2’ |
| ID Control : M_Start_IMU_Calibrate |
| |||||
| PL3 | INTEGER | -1 | 1 | - | - | Status Control |
| |
-1 | NACK: Invalid input /wrong format / out of range …? | ||||||||
0 | Error: Not found data configure for MPU9250 in Profile | ||||||||
1 | OK: Is starting connect to IMU and print IMU data | ||||||||
2 | Error : Low memory - Fail to malloc new buffer ! | ||||||||
| PL4 | STRING | - | - | - | - | Describe status respond control as text |
|
Example
Message : | |
HOST Send | $ESP_OK|6|T|M|2|*7C26 |
ACK Respond | $ESP_OK|30|T|M|2|1|Started IMU Calibrate|*2F54 |
Data Respond | $ESPLOG|59|2|INFO|CAL|Please rotate the sensor to the different angle|*6224 $ESPLOG|59|2|INFO|CAL|Please rotate the sensor to the different angle|*6224 $ESPLOG|74|2|INFO|CAL|Surface scan (0.00 %),Input [-4.2010503,4.0510130,-69.0172577]|*6C01 $ESPLOG|74|2|INFO|CAL|Surface scan (0.01 %),Input [-4.2010503,4.0510130,-69.0172577]|*6D01 $ESPLOG|74|2|INFO|CAL|Surface scan (0.02 %),Input [-9.7524385,5.1012754,-67.9669952]|*6E07 $ESPLOG|75|2|INFO|CAL|Surface scan (0.03 %),Input [-17.5543880,5.8514628,-67.9669952]|*5C76 $ESPLOG|75|2|INFO|CAL|Surface scan (0.04 %),Input [-24.4561138,5.8514628,-62.7156792]|*5276 $ESPLOG|75|2|INFO|CAL|Surface scan (0.05 %),Input [-31.9579887,6.7516880,-58.0645180]|*527A …………. ………….
|
NACK Respond |
|
Other NACK | $ESP_ER|… or $ESS_ER|… or $AES_ER|… |
HOST send M_Stop_IMU_Calibrate
<Header> + <Payload_length> | <Payload> | ||||||
PL0 | PL1 | PL2 | PL3 | PL4 | PL5 | … | |
$ESP_OK|xx| | ‘T’ | ‘M’ | ‘3’ | Infor 1 | Infor 2 | Infor 3 | ... |
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | |
PL2 | ‘3’ | STRING | - | - | 1 | 1 | ID Control : M_Stop_IMU_Calibrate |
|
ESPrtk Respond
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | ||
PL2 | ‘3’ |
| ID Control : M_Stop_IMU_Calibrate |
| |||||
| PL3 | INTEGER | -1 | 1 | - | - | Status Control |
| |
-1 | NACK: Invalid input /wrong format / out of range …? | ||||||||
0 | Is calculating ... , please wait. | ||||||||
1 | OK: Stopped IMU Calibrate. ( Success ) | ||||||||
2 | Error : Incomplete samples (We need more samples to be able to calibrate! | ||||||||
3 | Error : Incomplete samples ( We need more samples on the X and Y axes by rotating the sensor around the Z axis!) | ||||||||
4 | Error : Fail to calculating , please try again ! | ||||||||
| PL4 | STRING | - | - | - | - | Describe status respond control as text |
|
Example
Message : | |
HOST Send | $ESP_OK|6|T|M|3|*7D26 |
ACK Respond | $ESP_OK|41|T|M|3|0|Is calculating ... , please wait|*0214
…. (Calibrate progress )… …. (Noise filter progress )… …. (Printout data calibrated progress )… …. (Printout Bias+Rotations matrices )…
$ESP_OK|30|T|M|3|1|Stopped IMU Calibrate|*2656
|
Data Respond |
$ESP_OK|41|T|M|3|0|Is calculating ... , please wait|*0214 ………….. ………….. $ESPLOG|27|2|INFO|CAL|Calibrating:1 %|*396B $ESPLOG|27|2|INFO|CAL|Calibrating:2 %|*3A6B $ESPLOG|27|2|INFO|CAL|Calibrating:3 %|*3B6B ………….. $ESPLOG|28|2|INFO|CAL|Calibrating:90 %|*0E23 $ESPLOG|28|2|INFO|CAL|Calibrating:95 %|*0B23 $ESPLOG|29|2|INFO|CAL|Calibrating:100 %|*3755 ………….. ………….. ………….. $ESPLOG|28|2|INFO|CAL|Noise filter:0 %|*0B2F $ESPLOG|28|2|INFO|CAL|Noise filter:3 %|*082F $ESPLOG|28|2|INFO|CAL|Noise filter:6 %|*0D2F ………….. $ESPLOG|29|2|INFO|CAL|Noise filter:90 %|*3355 $ESPLOG|29|2|INFO|CAL|Noise filter:93 %|*3055 $ESPLOG|29|2|INFO|CAL|Noise filter:96 %|*3555 ………….. ………….. ………….. $ESPLOG|69|2|INFO|CAL|Count (1/617),Output [-24.6396484,26.2568359,-19.2402344]|*112C $ESPLOG|69|2|INFO|CAL|Count (2/617),Output [-24.6396484,26.2568359,-19.2402344]|*122F $ESPLOG|69|2|INFO|CAL|Count (3/617),Output [-22.3652344,25.3867188,-21.1152344]|*102C ………….. $ESPLOG|70|2|INFO|CAL|Count (615/617),Output [12.0615234,22.5830078,-25.9902344]|*3D36 $ESPLOG|70|2|INFO|CAL|Count (616/617),Output [14.1621094,25.6347656,-25.7070312]|*323C $ESPLOG|70|2|INFO|CAL|Count (617/617),Output [12.6474609,24.3251953,-24.7656250]|*3E3D ………….. ………….. ………….. $ESPLOG|205|2|INFO|CAL|Success ! Bias 1x3 [ -11.4422918 , -23.6864032 , -40.1461467 ] ,Rotation 3x3 [ 1.0044592 , -0.0014763 , -0.0122153 , -0.0014784 , 0.9697963 , -0.0028070 , -0.0122177 , -0.0028135 , 1.0257844 ] |*1007 ………….. ………….. ………….. $ESP_OK|30|T|M|3|1|Stopped IMU Calibrate|*2656 |
NACK Respond |
|
Other NACK | $ESP_ER|… or $ESS_ER|… or $AES_ER|… |
HOST send M_Save_Calibrate_Result
<Header> + <Payload_length> | <Payload> | ||||||
PL0 | PL1 | PL2 | PL3 | PL4 | PL5 | … | |
$ESP_OK|xx| | ‘T’ | ‘M’ | ‘4’ | Infor 1 | Infor 2 | Infor 3 | ... |
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | |
PL2 | ‘4’ | STRING | - | - | 1 | 1 | ID Control : M_Save_Calibrate_Result |
|
ESPrtk Respond
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | ||
PL2 | ‘4’ |
| ID Control : M_Save_Calibrate_Result |
| |||||
| PL3 | INTEGER | -1 | 1 | - | - | Status Control |
| |
-1 | NACK: Invalid input /wrong format / out of range …? | ||||||||
0 | Error: | ||||||||
1 | OK: Updated Calibrate Result | ||||||||
| PL4 | STRING | - | - | - | - | Describe status respond control as text |
|
Example
Message : | |
HOST Send | $ESP_OK|6|T|M|4|*7A26 |
ACK Respond | $ESP_OK|33|T|M|4|1|Updated Calibrate Result|*4650 |
NACK Respond |
|
Other NACK | $ESP_ER|… or $ESS_ER|… or $AES_ER|… |
Command Hardware Control – IMU (MPU9250)
<Header> + <Payload_length> | <Payload> | ||||||
PL0 | PL1 | PL2 | PL3 | PL4 | PL5 | … | |
$ESP_OK|xx| | ‘T’ | ‘M’ | ID Control | Infor 1 | Infor 2 | Infor 3 | ... |
‘T’ | ‘M’ | PL2 | Control IMU (MPU9250) | 2 |
| ‘0’ | M_Start_Print_IMU_Data |
| |
‘1’ | M_Stop_Print_IMU_Data |
| ||
|
| Disable/Enable type print IMU |
|
HOST send M_Start_Print_IMU_Data
<Header> + <Payload_length> | <Payload> | ||||||
PL0 | PL1 | PL2 | PL3 | PL4 | PL5 | … | |
$ESP_OK|xx| | ‘T’ | ‘M’ | ‘0’ | Infor 1 | Infor 2 | Infor 3 | ... |
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | ||
PL2 | ‘0’ |
| ID Control :M_Start_Print_IMU_Data |
| |||||
| PL3 | INTEGER | 0 | 9 | - | - | Type frequency update IMU
|
| |
0 | 2 Hz | ||||||||
1 | 10 Hz | ||||||||
2 | 15 Hz | ||||||||
3 | 20 Hz | ||||||||
4 | 25 Hz | ||||||||
5 | 35 Hz | ||||||||
6 | 50 Hz | ||||||||
7 | 100 Hz | ||||||||
8 | 150 Hz | ||||||||
9 | 200 Hz |
ESPrtk Respond
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | ||
PL2 | ‘0’ |
| ID Control : M_Start_Print_IMU_Data |
| |||||
| PL3 | INTEGER | -1 | 1 | - | - | Status Control |
| |
-1 | NACK: Invalid input /wrong format / out of range …? | ||||||||
0 | Error: Not found data configure for MPU9250 in Profile | ||||||||
1 | OK: Is starting connect to IMU and print IMU data | ||||||||
| PL4 | STRING | - | - | - | - | Describe status respond control as text |
|
Example
Message : | |
HOST Send | $ESP_OK|8|T|M|0|1|*3D5A |
ACK Respond | $ESP_OK|64|T|M|0|1|Is starting print IMU data , Type Frequency update = 1 |*1C0E |
NACK Respond |
|
Other NACK | $ESP_ER|… or $ESS_ER|… or $AES_ER|… |
HOST send M_Stop_Print_IMU_Data
<Header> + <Payload_length> | <Payload> | ||||||
PL0 | PL1 | PL2 | PL3 | PL4 | PL5 | … | |
$ESP_OK|xx| | ‘T’ | ‘M’ | ‘1’ | Infor 1 | Infor 2 | Infor 3 | ... |
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | |
PL2 | ‘1’ | STRING | - | - | 1 | 1 | ID Control : M_Stop_Print_IMU_Data |
|
ESPrtk Respond
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | ||
PL2 | ‘1’ |
| ID Control : M_Stop_Print_IMU_Data |
| |||||
| PL3 | INTEGER | -1 | 1 | - | - | Status Control |
| |
-1 | NACK: Invalid input /wrong format / out of range …? | ||||||||
0 | Error: | ||||||||
1 | OK: Stopped Print IMU data | ||||||||
| PL4 | STRING | - | - | - | - | Describe status respond control as text |
|
Example
Message : | |
HOST Send | $ESP_OK|6|T|M|1|*7F26 |
ACK Respond | $ESP_OK|31|T|M|1|1|Stopped Print IMU data|*031B |
NACK Respond |
|
Other NACK | $ESP_ER|… or $ESS_ER|… or $AES_ER|… |
HOST send Disable/Enable type print IMU
Please see “Control Enable Type Print on TX_UART0” → PL3 → BIT11 and BIT12.
$ESP_OK|19|T|P|0|000000000000|*2157 -> Disable Print ALL output UART_0 $ESP_OK|19|T|P|0|111111111100|*2156 -> Disable Print IMU 1 + IMU2 $ESP_OK|19|T|P|0|111111111110|*2057 -> Disable Print IMU 1 , Enable Print IMU2 $ESP_OK|19|T|P|0|111111111101|*2056 -> Enable Print IMU1 , Disable Print IMU 2 $ESP_OK|19|T|P|0|111111111111|*2157 -> Enable Print ALL output UART_0 |