{
  "blocks": {
    "languageVersion": 0,
    "blocks": [
      {
        "type": "APM_attitude_init",
        "id": ",YY0un9eh(*5]r=XTf,r",
        "x": 913,
        "y": 313,
        "fields": {
          "instance_name": "姿态传感器1",
          "scl_io": "A",
          "sda_io": "B"
        },
        "next": {
          "block": {
            "type": "APM_digital_motor_init",
            "id": "G|qqLmr@-2n3P~t3w-h,",
            "fields": {
              "digital_motor_instance": "我的数字电机1",
              "port": "1",
              "direction": "True",
              "soft_break": true
            },
            "next": {
              "block": {
                "type": "APM_digital_motor_init",
                "id": "$N#;LT]5sHR0*LWZ]n1+",
                "fields": {
                  "digital_motor_instance": "我的数字电机2",
                  "port": "2",
                  "direction": "False",
                  "soft_break": true
                },
                "next": {
                  "block": {
                    "type": "APM_attitude_set_zero",
                    "id": "AL[XN2MNJm_6VqhSf^F!",
                    "fields": {
                      "instance_name": "姿态传感器1"
                    },
                    "next": {
                      "block": {
                        "type": "controls_repeat_ext",
                        "id": "k/D(:a||ep7Zns*#KT:m",
                        "inputs": {
                          "TIMES": {
                            "block": {
                              "type": "math_number",
                              "id": "ko@C6_|NU-x}nn)!]/Y;",
                              "fields": {
                                "NUM": 1
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      {
        "type": "procedures_defnoreturn",
        "id": "l{`nIsR:Z!2|2R%3Vda;",
        "x": 13,
        "y": 13,
        "extraState": {
          "params": [
            {
              "name": "速度",
              "id": "gCkLd@Z.%o:hU-4T-]NV"
            },
            {
              "name": "时间",
              "id": "jhK,jz%5@?)~AE%{*jye"
            },
            {
              "name": "角度",
              "id": "Y*ZquWP{[k;T5G4{D!7}"
            }
          ]
        },
        "icons": {
          "comment": {
            "text": "描述该功能...",
            "pinned": false,
            "height": 80,
            "width": 160
          }
        },
        "fields": {
          "NAME": "move"
        },
        "inputs": {
          "STACK": {
            "block": {
              "type": "APM_attitude_set_zero",
              "id": "ftDqeE]f#v%m{1V9tkr#",
              "fields": {
                "instance_name": "姿态传感器1"
              },
              "next": {
                "block": {
                  "type": "pid",
                  "id": ")-#W*xR74?hHS0;hLyP4",
                  "fields": {
                    "PID_NAME": "我的PID1"
                  },
                  "inputs": {
                    "p": {
                      "shadow": {
                        "type": "math_number",
                        "id": ":#XI[?rD:bwu7bq-TyX)",
                        "fields": {
                          "NUM": 0.9
                        }
                      }
                    },
                    "i": {
                      "shadow": {
                        "type": "math_number",
                        "id": "+BPW/Pcx~hPf{s{uT(yJ",
                        "fields": {
                          "NUM": 0.2
                        }
                      }
                    },
                    "d": {
                      "shadow": {
                        "type": "math_number",
                        "id": "q_r#M{o=|WTSklDKSMgO",
                        "fields": {
                          "NUM": 0.09
                        }
                      }
                    },
                    "imax": {
                      "shadow": {
                        "type": "math_number",
                        "id": "9S}k~d3|?o#x|w(L/[G`",
                        "fields": {
                          "NUM": 100
                        }
                      }
                    }
                  },
                  "next": {
                    "block": {
                      "type": "variables_set",
                      "id": "*(zJJ(|ffh0pMG{A`N||",
                      "fields": {
                        "VAR": {
                          "id": "@taAx(I#(IE@CtV*#L5F"
                        }
                      },
                      "inputs": {
                        "VALUE": {
                          "block": {
                            "type": "math_number",
                            "id": ":YqqWM3+*6`cp,xS#^Un",
                            "fields": {
                              "NUM": 0
                            }
                          }
                        }
                      },
                      "next": {
                        "block": {
                          "type": "controls_whileUntil",
                          "id": "fJf[S6Ts}aJp(cb+1mp;",
                          "fields": {
                            "MODE": "WHILE"
                          },
                          "inputs": {
                            "BOOL": {
                              "block": {
                                "type": "logic_compare",
                                "id": "j6PW:{iGyQ:rtUEEIo[|",
                                "fields": {
                                  "OP": "GTE"
                                },
                                "inputs": {
                                  "A": {
                                    "block": {
                                      "type": "variables_get",
                                      "id": "]RhpX2wy+HL(0^8X`KEy",
                                      "fields": {
                                        "VAR": {
                                          "id": "jhK,jz%5@?)~AE%{*jye"
                                        }
                                      }
                                    }
                                  },
                                  "B": {
                                    "block": {
                                      "type": "variables_get",
                                      "id": "1MLWBf;0iiS]1tN-(EWm",
                                      "fields": {
                                        "VAR": {
                                          "id": "@taAx(I#(IE@CtV*#L5F"
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            },
                            "DO": {
                              "block": {
                                "type": "variables_set",
                                "id": "Dz[?sK(kC+Yp]h(3Ow{p",
                                "fields": {
                                  "VAR": {
                                    "id": "gj!nL]haJ;$euzjBcu5!"
                                  }
                                },
                                "inputs": {
                                  "VALUE": {
                                    "block": {
                                      "type": "APM_attitude_get_euler_axis",
                                      "id": "WDluQK=0(6?J^FzjW}VW",
                                      "fields": {
                                        "instance_name": "姿态传感器1",
                                        "axis": "Z"
                                      }
                                    }
                                  }
                                },
                                "next": {
                                  "block": {
                                    "type": "procedures_callnoreturn",
                                    "id": "k)6T~xMQvXW_lJ7;qO1$",
                                    "extraState": {
                                      "name": "drive",
                                      "params": [
                                        "move",
                                        "turn"
                                      ]
                                    },
                                    "inputs": {
                                      "ARG0": {
                                        "block": {
                                          "type": "variables_get",
                                          "id": "RFoaY%ziy1h9m$@;9zC_",
                                          "fields": {
                                            "VAR": {
                                              "id": "gCkLd@Z.%o:hU-4T-]NV"
                                            }
                                          }
                                        }
                                      },
                                      "ARG1": {
                                        "block": {
                                          "type": "get_pid",
                                          "id": "On,QJuPh/m-=+{eMXM;J",
                                          "fields": {
                                            "PID_NAME": "我的PID1"
                                          },
                                          "inputs": {
                                            "err": {
                                              "block": {
                                                "type": "math_arithmetic",
                                                "id": "O:{[gy^D0#@qIVNi))?%",
                                                "fields": {
                                                  "OP": "MINUS"
                                                },
                                                "inputs": {
                                                  "A": {
                                                    "block": {
                                                      "type": "variables_get",
                                                      "id": "]H95G7Q%wbNEQ%UheFFp",
                                                      "fields": {
                                                        "VAR": {
                                                          "id": "Y*ZquWP{[k;T5G4{D!7}"
                                                        }
                                                      }
                                                    }
                                                  },
                                                  "B": {
                                                    "block": {
                                                      "type": "variables_get",
                                                      "id": "@X%{NAgY`}UkT,-WwIyz",
                                                      "fields": {
                                                        "VAR": {
                                                          "id": "gj!nL]haJ;$euzjBcu5!"
                                                        }
                                                      }
                                                    }
                                                  }
                                                }
                                              }
                                            },
                                            "scaler": {
                                              "shadow": {
                                                "type": "math_number",
                                                "id": "R.3L`@u{J7w9psTTpPs5",
                                                "fields": {
                                                  "NUM": 1
                                                }
                                              }
                                            }
                                          }
                                        }
                                      }
                                    },
                                    "next": {
                                      "block": {
                                        "type": "time_sleep",
                                        "id": "o6ld/1M79BT_N|1uK}03",
                                        "inputs": {
                                          "second": {
                                            "shadow": {
                                              "type": "math_number",
                                              "id": "rQ4FliX|JZ@okH?%s|NS",
                                              "fields": {
                                                "NUM": 0.1
                                              }
                                            }
                                          }
                                        },
                                        "next": {
                                          "block": {
                                            "type": "variables_set",
                                            "id": "^$DxDMRds*Zs0o#(b-~D",
                                            "fields": {
                                              "VAR": {
                                                "id": "@taAx(I#(IE@CtV*#L5F"
                                              }
                                            },
                                            "inputs": {
                                              "VALUE": {
                                                "block": {
                                                  "type": "math_arithmetic",
                                                  "id": "h#yBhGP7Z)2Ten@qm*P!",
                                                  "fields": {
                                                    "OP": "ADD"
                                                  },
                                                  "inputs": {
                                                    "A": {
                                                      "block": {
                                                        "type": "variables_get",
                                                        "id": "71x]NAf//VD!U]#xyn!=",
                                                        "fields": {
                                                          "VAR": {
                                                            "id": "@taAx(I#(IE@CtV*#L5F"
                                                          }
                                                        }
                                                      }
                                                    },
                                                    "B": {
                                                      "block": {
                                                        "type": "math_number",
                                                        "id": "buq%/ry/2iN)GkG5PhA|",
                                                        "fields": {
                                                          "NUM": 100
                                                        }
                                                      }
                                                    }
                                                  }
                                                }
                                              }
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          },
                          "next": {
                            "block": {
                              "type": "procedures_callnoreturn",
                              "id": "aYnXSD=Q4v|C3/G6VWp/",
                              "extraState": {
                                "name": "drive",
                                "params": [
                                  "move",
                                  "turn"
                                ]
                              },
                              "inputs": {
                                "ARG0": {
                                  "block": {
                                    "type": "math_number",
                                    "id": "Xm+,2xGVLKK2oTr%RK;R",
                                    "fields": {
                                      "NUM": 0
                                    }
                                  }
                                },
                                "ARG1": {
                                  "block": {
                                    "type": "math_number",
                                    "id": "_fEP)0w`=+6)olsBLUC[",
                                    "fields": {
                                      "NUM": 0
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      {
        "type": "procedures_defnoreturn",
        "id": "PhK0sr[c7v03_7skf_]B",
        "x": -12,
        "y": -187,
        "extraState": {
          "params": [
            {
              "name": "move",
              "id": "nGwLGqt~iEAiF/jg=Ypz"
            },
            {
              "name": "turn",
              "id": "arEc#q%C+Q8oMSmx]]sn"
            }
          ]
        },
        "icons": {
          "comment": {
            "text": "描述该功能...",
            "pinned": false,
            "height": 80,
            "width": 160
          }
        },
        "fields": {
          "NAME": "drive"
        },
        "inputs": {
          "STACK": {
            "block": {
              "type": "APM_digital_motor_openloop",
              "id": "OfO#BB`2+Vw$JLr;4i,B",
              "fields": {
                "instance": "我的数字电机1"
              },
              "inputs": {
                "speed": {
                  "shadow": {
                    "type": "math_number",
                    "id": "jYeiKz|XWor*!T#ZwO|.",
                    "fields": {
                      "NUM": 0
                    }
                  },
                  "block": {
                    "type": "math_arithmetic",
                    "id": "e^jG5lY,#g[Ib{6h7n7R",
                    "fields": {
                      "OP": "MINUS"
                    },
                    "inputs": {
                      "A": {
                        "block": {
                          "type": "variables_get",
                          "id": "}+X~*8|GX)+~j_,.fx8*",
                          "fields": {
                            "VAR": {
                              "id": "nGwLGqt~iEAiF/jg=Ypz"
                            }
                          }
                        }
                      },
                      "B": {
                        "block": {
                          "type": "variables_get",
                          "id": "LQK;|]~7?KOe:nS0XXE$",
                          "fields": {
                            "VAR": {
                              "id": "arEc#q%C+Q8oMSmx]]sn"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              "next": {
                "block": {
                  "type": "APM_digital_motor_openloop",
                  "id": "iFp?QH76FtPR|=um4;DW",
                  "fields": {
                    "instance": "我的数字电机2"
                  },
                  "inputs": {
                    "speed": {
                      "shadow": {
                        "type": "math_number",
                        "id": "X37nF4h#f*x$yaXe$$1N",
                        "fields": {
                          "NUM": 0
                        }
                      },
                      "block": {
                        "type": "math_arithmetic",
                        "id": "8+EVuI[zOJlegaBGM/b-",
                        "fields": {
                          "OP": "ADD"
                        },
                        "inputs": {
                          "A": {
                            "block": {
                              "type": "variables_get",
                              "id": "J/3GArBwzeoDUgpK2uLo",
                              "fields": {
                                "VAR": {
                                  "id": "nGwLGqt~iEAiF/jg=Ypz"
                                }
                              }
                            }
                          },
                          "B": {
                            "block": {
                              "type": "variables_get",
                              "id": "F1#~(#9uS-wo9f.)}O=~",
                              "fields": {
                                "VAR": {
                                  "id": "arEc#q%C+Q8oMSmx]]sn"
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      {
        "type": "procedures_defnoreturn",
        "id": "P,T=KhlUhe{1[HT_uD^4",
        "x": 13,
        "y": 563,
        "extraState": {
          "params": [
            {
              "name": "时间",
              "id": "jhK,jz%5@?)~AE%{*jye"
            },
            {
              "name": "角度",
              "id": "Y*ZquWP{[k;T5G4{D!7}"
            }
          ]
        },
        "icons": {
          "comment": {
            "text": "描述该功能...",
            "pinned": false,
            "height": 80,
            "width": 160
          }
        },
        "fields": {
          "NAME": "turn"
        },
        "inputs": {
          "STACK": {
            "block": {
              "type": "APM_attitude_set_zero",
              "id": "IjCND+p.N3|jcg%AG0LZ",
              "fields": {
                "instance_name": "姿态传感器1"
              },
              "next": {
                "block": {
                  "type": "pid",
                  "id": "9@wLf5{yMgmlCka7usJ#",
                  "fields": {
                    "PID_NAME": "我的PID2"
                  },
                  "inputs": {
                    "p": {
                      "shadow": {
                        "type": "math_number",
                        "id": "z/}?_Fq;=QO_Pwt{v1BS",
                        "fields": {
                          "NUM": 1
                        }
                      }
                    },
                    "i": {
                      "shadow": {
                        "type": "math_number",
                        "id": "[?^(Y)K%@jWe$Z~0;FMR",
                        "fields": {
                          "NUM": 0.2
                        }
                      }
                    },
                    "d": {
                      "shadow": {
                        "type": "math_number",
                        "id": ",]-G}aoK9`o;0pccz$;r",
                        "fields": {
                          "NUM": 0.1
                        }
                      }
                    },
                    "imax": {
                      "shadow": {
                        "type": "math_number",
                        "id": "k!yJUUo;9~D*FDlT#{9x",
                        "fields": {
                          "NUM": 100
                        }
                      }
                    }
                  },
                  "next": {
                    "block": {
                      "type": "variables_set",
                      "id": "6jjF%}*)p|g-gX1Jz5[l",
                      "fields": {
                        "VAR": {
                          "id": "@taAx(I#(IE@CtV*#L5F"
                        }
                      },
                      "inputs": {
                        "VALUE": {
                          "block": {
                            "type": "math_number",
                            "id": "%bAlMk(Zybijw?cX_nW8",
                            "fields": {
                              "NUM": 0
                            }
                          }
                        }
                      },
                      "next": {
                        "block": {
                          "type": "controls_whileUntil",
                          "id": "{K({{Gl/KkO|/;6oFu-L",
                          "fields": {
                            "MODE": "WHILE"
                          },
                          "inputs": {
                            "BOOL": {
                              "block": {
                                "type": "logic_compare",
                                "id": "^_{f=9)G3VZ7ep2$+%zn",
                                "fields": {
                                  "OP": "GTE"
                                },
                                "inputs": {
                                  "A": {
                                    "block": {
                                      "type": "variables_get",
                                      "id": "|mQo^),#=5!Nor~3b.Hn",
                                      "fields": {
                                        "VAR": {
                                          "id": "jhK,jz%5@?)~AE%{*jye"
                                        }
                                      }
                                    }
                                  },
                                  "B": {
                                    "block": {
                                      "type": "variables_get",
                                      "id": "/^^6CZ+r2VD,c8.?,K{Q",
                                      "fields": {
                                        "VAR": {
                                          "id": "@taAx(I#(IE@CtV*#L5F"
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            },
                            "DO": {
                              "block": {
                                "type": "variables_set",
                                "id": "HyctXAT%%[]d6):CDZ@b",
                                "fields": {
                                  "VAR": {
                                    "id": "gj!nL]haJ;$euzjBcu5!"
                                  }
                                },
                                "inputs": {
                                  "VALUE": {
                                    "block": {
                                      "type": "APM_attitude_get_euler_axis",
                                      "id": "c@+I/`=%{4Y_Yl_z2g#I",
                                      "fields": {
                                        "instance_name": "姿态传感器1",
                                        "axis": "Z"
                                      }
                                    }
                                  }
                                },
                                "next": {
                                  "block": {
                                    "type": "procedures_callnoreturn",
                                    "id": "(Igr|pqJ~tqJcLUH%Vur",
                                    "extraState": {
                                      "name": "drive",
                                      "params": [
                                        "move",
                                        "turn"
                                      ]
                                    },
                                    "inputs": {
                                      "ARG0": {
                                        "block": {
                                          "type": "math_number",
                                          "id": "h=C$r.kFg~[~!wC-K,Wo",
                                          "fields": {
                                            "NUM": 0
                                          }
                                        }
                                      },
                                      "ARG1": {
                                        "block": {
                                          "type": "get_pid",
                                          "id": ";3H2J2D]~TYn6L^rQ2^i",
                                          "fields": {
                                            "PID_NAME": "我的PID2"
                                          },
                                          "inputs": {
                                            "err": {
                                              "block": {
                                                "type": "math_arithmetic",
                                                "id": "Ty:n{]DQz)E6pB:P7-1B",
                                                "fields": {
                                                  "OP": "MINUS"
                                                },
                                                "inputs": {
                                                  "A": {
                                                    "block": {
                                                      "type": "variables_get",
                                                      "id": "dxl9U!.]jU!jt|%r`.le",
                                                      "fields": {
                                                        "VAR": {
                                                          "id": "Y*ZquWP{[k;T5G4{D!7}"
                                                        }
                                                      }
                                                    }
                                                  },
                                                  "B": {
                                                    "block": {
                                                      "type": "variables_get",
                                                      "id": "M9Wyokzs1671w@Hoh?5V",
                                                      "fields": {
                                                        "VAR": {
                                                          "id": "gj!nL]haJ;$euzjBcu5!"
                                                        }
                                                      }
                                                    }
                                                  }
                                                }
                                              }
                                            },
                                            "scaler": {
                                              "shadow": {
                                                "type": "math_number",
                                                "id": "Napx)4/_M,6.9R{H0{OP",
                                                "fields": {
                                                  "NUM": 1
                                                }
                                              }
                                            }
                                          }
                                        }
                                      }
                                    },
                                    "next": {
                                      "block": {
                                        "type": "time_sleep",
                                        "id": "tV0#1.Vt$H8/p34^0HGG",
                                        "inputs": {
                                          "second": {
                                            "shadow": {
                                              "type": "math_number",
                                              "id": "URZpQ1FR)VH,b@I_Z8(|",
                                              "fields": {
                                                "NUM": 0.1
                                              }
                                            }
                                          }
                                        },
                                        "next": {
                                          "block": {
                                            "type": "variables_set",
                                            "id": "Ki|P:Dcn+uyAUa7pve9P",
                                            "fields": {
                                              "VAR": {
                                                "id": "@taAx(I#(IE@CtV*#L5F"
                                              }
                                            },
                                            "inputs": {
                                              "VALUE": {
                                                "block": {
                                                  "type": "math_arithmetic",
                                                  "id": "2y`c0ECqFnAqA^:0hO19",
                                                  "fields": {
                                                    "OP": "ADD"
                                                  },
                                                  "inputs": {
                                                    "A": {
                                                      "block": {
                                                        "type": "variables_get",
                                                        "id": ")FqOd,j6.H]l/.F@Dhsq",
                                                        "fields": {
                                                          "VAR": {
                                                            "id": "@taAx(I#(IE@CtV*#L5F"
                                                          }
                                                        }
                                                      }
                                                    },
                                                    "B": {
                                                      "block": {
                                                        "type": "math_number",
                                                        "id": "[)`KSh%Ts.w/uM?G*NHl",
                                                        "fields": {
                                                          "NUM": 100
                                                        }
                                                      }
                                                    }
                                                  }
                                                }
                                              }
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          },
                          "next": {
                            "block": {
                              "type": "procedures_callnoreturn",
                              "id": "XA^,=V8kyy;|p3+6M7JU",
                              "extraState": {
                                "name": "drive",
                                "params": [
                                  "move",
                                  "turn"
                                ]
                              },
                              "inputs": {
                                "ARG0": {
                                  "block": {
                                    "type": "math_number",
                                    "id": "5)L)_o%yA43D#h7F~t$y",
                                    "fields": {
                                      "NUM": 0
                                    }
                                  }
                                },
                                "ARG1": {
                                  "block": {
                                    "type": "math_number",
                                    "id": "ZovbyFGqF]sbhD!@2Dj~",
                                    "fields": {
                                      "NUM": 0
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    ]
  },
  "variables": [
    {
      "name": "x",
      "id": "]x#iXqBYcK3_JJW5@VvL"
    },
    {
      "name": "y",
      "id": "*Ij0(9h@E(+-hD`iW=@g"
    },
    {
      "name": "z",
      "id": "UZ2zLH24.%/sR)RwGr+6"
    },
    {
      "name": "速度",
      "id": "gCkLd@Z.%o:hU-4T-]NV"
    },
    {
      "name": "时间",
      "id": "jhK,jz%5@?)~AE%{*jye"
    },
    {
      "name": "角度",
      "id": "Y*ZquWP{[k;T5G4{D!7}"
    },
    {
      "name": "当前时间",
      "id": "@taAx(I#(IE@CtV*#L5F"
    },
    {
      "name": "gyro",
      "id": "gj!nL]haJ;$euzjBcu5!"
    },
    {
      "name": "move",
      "id": "nGwLGqt~iEAiF/jg=Ypz"
    },
    {
      "name": "turn",
      "id": "arEc#q%C+Q8oMSmx]]sn"
    }
  ]
}