{
 "format": "uvira.forge.blocks",
 "version": 1,
 "workspace": {
  "blocks": {
   "languageVersion": 0,
   "blocks": [
    {
     "type": "forge_program",
     "id": "prog",
     "fields": {
      "NAME": "follow_the_truck",
      "PERIOD": "20"
     },
     "inputs": {
      "INIT": {
       "block": {
        "type": "variables_set",
        "id": "F20",
        "fields": {
         "VAR": {
          "id": "var_yaw"
         }
        },
        "inputs": {
         "VALUE": {
          "block": {
           "type": "forge_vehicle_value",
           "id": "F19",
           "fields": {
            "WHAT": "heading"
           }
          }
         }
        },
        "next": {
         "block": {
          "type": "variables_set",
          "id": "F22",
          "fields": {
           "VAR": {
            "id": "var_stage"
           }
          },
          "inputs": {
           "VALUE": {
            "block": {
             "type": "math_number",
             "id": "F21",
             "fields": {
              "NUM": 0
             }
            }
           }
          },
          "next": {
           "block": {
            "type": "variables_set",
            "id": "F24",
            "fields": {
             "VAR": {
              "id": "var_follow_since"
             }
            },
            "inputs": {
             "VALUE": {
              "block": {
               "type": "math_number",
               "id": "F23",
               "fields": {
                "NUM": 0
               }
              }
             }
            }
           }
          }
         }
        }
       }
      },
      "EVERY": {
       "block": {
        "type": "controls_if",
        "id": "F50",
        "inputs": {
         "IF0": {
          "block": {
           "type": "forge_pkt_fresh",
           "id": "F25",
           "fields": {
            "PACKET": "truck"
           }
          }
         },
         "DO0": {
          "block": {
           "type": "variables_set",
           "id": "F27",
           "fields": {
            "VAR": {
             "id": "var_pf_vn"
            }
           },
           "inputs": {
            "VALUE": {
             "block": {
              "type": "variables_get",
              "id": "F26",
              "fields": {
               "VAR": {
                "id": "fv_truck_vel_n"
               }
              }
             }
            }
           },
           "next": {
            "block": {
             "type": "variables_set",
             "id": "F29",
             "fields": {
              "VAR": {
               "id": "var_pf_ve"
              }
             },
             "inputs": {
              "VALUE": {
               "block": {
                "type": "variables_get",
                "id": "F28",
                "fields": {
                 "VAR": {
                  "id": "fv_truck_vel_e"
                 }
                }
               }
              }
             },
             "next": {
              "block": {
               "type": "variables_set",
               "id": "F33",
               "fields": {
                "VAR": {
                 "id": "var_rel_n"
                }
               },
               "inputs": {
                "VALUE": {
                 "block": {
                  "type": "forge_geo_distance",
                  "id": "F32",
                  "fields": {
                   "WHAT": "N"
                  },
                  "inputs": {
                   "LAT": {
                    "block": {
                     "type": "variables_get",
                     "id": "F30",
                     "fields": {
                      "VAR": {
                       "id": "fv_truck_lat"
                      }
                     }
                    }
                   },
                   "LON": {
                    "block": {
                     "type": "variables_get",
                     "id": "F31",
                     "fields": {
                      "VAR": {
                       "id": "fv_truck_lon"
                      }
                     }
                    }
                   }
                  }
                 }
                }
               },
               "next": {
                "block": {
                 "type": "variables_set",
                 "id": "F37",
                 "fields": {
                  "VAR": {
                   "id": "var_rel_e"
                  }
                 },
                 "inputs": {
                  "VALUE": {
                   "block": {
                    "type": "forge_geo_distance",
                    "id": "F36",
                    "fields": {
                     "WHAT": "E"
                    },
                    "inputs": {
                     "LAT": {
                      "block": {
                       "type": "variables_get",
                       "id": "F34",
                       "fields": {
                        "VAR": {
                         "id": "fv_truck_lat"
                        }
                       }
                      }
                     },
                     "LON": {
                      "block": {
                       "type": "variables_get",
                       "id": "F35",
                       "fields": {
                        "VAR": {
                         "id": "fv_truck_lon"
                        }
                       }
                      }
                     }
                    }
                   }
                  }
                 },
                 "next": {
                  "block": {
                   "type": "variables_set",
                   "id": "F39",
                   "fields": {
                    "VAR": {
                     "id": "var_seen"
                    }
                   },
                   "inputs": {
                    "VALUE": {
                     "block": {
                      "type": "logic_boolean",
                      "id": "F38",
                      "fields": {
                       "BOOL": "TRUE"
                      }
                     }
                    }
                   }
                  }
                 }
                }
               }
              }
             }
            }
           }
          }
         },
         "ELSE": {
          "block": {
           "type": "variables_set",
           "id": "F41",
           "fields": {
            "VAR": {
             "id": "var_pf_vn"
            }
           },
           "inputs": {
            "VALUE": {
             "block": {
              "type": "math_number",
              "id": "F40",
              "fields": {
               "NUM": 0
              }
             }
            }
           },
           "next": {
            "block": {
             "type": "variables_set",
             "id": "F43",
             "fields": {
              "VAR": {
               "id": "var_pf_ve"
              }
             },
             "inputs": {
              "VALUE": {
               "block": {
                "type": "math_number",
                "id": "F42",
                "fields": {
                 "NUM": 0
                }
               }
              }
             },
             "next": {
              "block": {
               "type": "variables_set",
               "id": "F45",
               "fields": {
                "VAR": {
                 "id": "var_rel_n"
                }
               },
               "inputs": {
                "VALUE": {
                 "block": {
                  "type": "math_number",
                  "id": "F44",
                  "fields": {
                   "NUM": 0
                  }
                 }
                }
               },
               "next": {
                "block": {
                 "type": "variables_set",
                 "id": "F47",
                 "fields": {
                  "VAR": {
                   "id": "var_rel_e"
                  }
                 },
                 "inputs": {
                  "VALUE": {
                   "block": {
                    "type": "math_number",
                    "id": "F46",
                    "fields": {
                     "NUM": 0
                    }
                   }
                  }
                 },
                 "next": {
                  "block": {
                   "type": "variables_set",
                   "id": "F49",
                   "fields": {
                    "VAR": {
                     "id": "var_seen"
                    }
                   },
                   "inputs": {
                    "VALUE": {
                     "block": {
                      "type": "logic_boolean",
                      "id": "F48",
                      "fields": {
                       "BOOL": "FALSE"
                      }
                     }
                    }
                   }
                  }
                 }
                }
               }
              }
             }
            }
           }
          }
         }
        },
        "extraState": {
         "hasElse": true
        },
        "next": {
         "block": {
          "type": "controls_if",
          "id": "F65",
          "inputs": {
           "IF0": {
            "block": {
             "type": "logic_compare",
             "id": "F60",
             "fields": {
              "OP": "GT"
             },
             "inputs": {
              "A": {
               "block": {
                "type": "math_single",
                "id": "F58",
                "fields": {
                 "OP": "ROOT"
                },
                "inputs": {
                 "NUM": {
                  "block": {
                   "type": "math_arithmetic",
                   "id": "F57",
                   "fields": {
                    "OP": "ADD"
                   },
                   "inputs": {
                    "A": {
                     "block": {
                      "type": "math_arithmetic",
                      "id": "F54",
                      "fields": {
                       "OP": "POWER"
                      },
                      "inputs": {
                       "A": {
                        "block": {
                         "type": "variables_get",
                         "id": "F51",
                         "fields": {
                          "VAR": {
                           "id": "var_pf_vn"
                          }
                         }
                        }
                       },
                       "B": {
                        "block": {
                         "type": "math_number",
                         "id": "F53",
                         "fields": {
                          "NUM": 2
                         }
                        }
                       }
                      }
                     }
                    },
                    "B": {
                     "block": {
                      "type": "math_arithmetic",
                      "id": "F56",
                      "fields": {
                       "OP": "POWER"
                      },
                      "inputs": {
                       "A": {
                        "block": {
                         "type": "variables_get",
                         "id": "F52",
                         "fields": {
                          "VAR": {
                           "id": "var_pf_ve"
                          }
                         }
                        }
                       },
                       "B": {
                        "block": {
                         "type": "math_number",
                         "id": "F55",
                         "fields": {
                          "NUM": 2
                         }
                        }
                       }
                      }
                     }
                    }
                   }
                  }
                 }
                }
               }
              },
              "B": {
               "block": {
                "type": "math_number",
                "id": "F59",
                "fields": {
                 "NUM": 1
                }
               }
              }
             }
            }
           },
           "DO0": {
            "block": {
             "type": "variables_set",
             "id": "F64",
             "fields": {
              "VAR": {
               "id": "var_yaw"
              }
             },
             "inputs": {
              "VALUE": {
               "block": {
                "type": "math_atan2",
                "id": "F63",
                "inputs": {
                 "Y": {
                  "block": {
                   "type": "variables_get",
                   "id": "F61",
                   "fields": {
                    "VAR": {
                     "id": "var_pf_ve"
                    }
                   }
                  }
                 },
                 "X": {
                  "block": {
                   "type": "variables_get",
                   "id": "F62",
                   "fields": {
                    "VAR": {
                     "id": "var_pf_vn"
                    }
                   }
                  }
                 }
                }
               }
              }
             }
            }
           }
          },
          "next": {
           "block": {
            "type": "variables_set",
            "id": "F74",
            "fields": {
             "VAR": {
              "id": "var_gap"
             }
            },
            "inputs": {
             "VALUE": {
              "block": {
               "type": "math_single",
               "id": "F73",
               "fields": {
                "OP": "ROOT"
               },
               "inputs": {
                "NUM": {
                 "block": {
                  "type": "math_arithmetic",
                  "id": "F72",
                  "fields": {
                   "OP": "ADD"
                  },
                  "inputs": {
                   "A": {
                    "block": {
                     "type": "math_arithmetic",
                     "id": "F69",
                     "fields": {
                      "OP": "POWER"
                     },
                     "inputs": {
                      "A": {
                       "block": {
                        "type": "variables_get",
                        "id": "F66",
                        "fields": {
                         "VAR": {
                          "id": "var_rel_n"
                         }
                        }
                       }
                      },
                      "B": {
                       "block": {
                        "type": "math_number",
                        "id": "F68",
                        "fields": {
                         "NUM": 2
                        }
                       }
                      }
                     }
                    }
                   },
                   "B": {
                    "block": {
                     "type": "math_arithmetic",
                     "id": "F71",
                     "fields": {
                      "OP": "POWER"
                     },
                     "inputs": {
                      "A": {
                       "block": {
                        "type": "variables_get",
                        "id": "F67",
                        "fields": {
                         "VAR": {
                          "id": "var_rel_e"
                         }
                        }
                       }
                      },
                      "B": {
                       "block": {
                        "type": "math_number",
                        "id": "F70",
                        "fields": {
                         "NUM": 2
                        }
                       }
                      }
                     }
                    }
                   }
                  }
                 }
                }
               }
              }
             }
            },
            "next": {
             "block": {
              "type": "variables_set",
              "id": "F81",
              "fields": {
               "VAR": {
                "id": "var_back_n"
               }
              },
              "inputs": {
               "VALUE": {
                "block": {
                 "type": "math_arithmetic",
                 "id": "F80",
                 "fields": {
                  "OP": "MINUS"
                 },
                 "inputs": {
                  "A": {
                   "block": {
                    "type": "variables_get",
                    "id": "F75",
                    "fields": {
                     "VAR": {
                      "id": "var_rel_n"
                     }
                    }
                   }
                  },
                  "B": {
                   "block": {
                    "type": "math_arithmetic",
                    "id": "F79",
                    "fields": {
                     "OP": "MULTIPLY"
                    },
                    "inputs": {
                     "A": {
                      "block": {
                       "type": "math_number",
                       "id": "F76",
                       "fields": {
                        "NUM": 15
                       }
                      }
                     },
                     "B": {
                      "block": {
                       "type": "math_trig",
                       "id": "F78",
                       "fields": {
                        "OP": "COS"
                       },
                       "inputs": {
                        "NUM": {
                         "block": {
                          "type": "variables_get",
                          "id": "F77",
                          "fields": {
                           "VAR": {
                            "id": "var_yaw"
                           }
                          }
                         }
                        }
                       }
                      }
                     }
                    }
                   }
                  }
                 }
                }
               }
              },
              "next": {
               "block": {
                "type": "variables_set",
                "id": "F88",
                "fields": {
                 "VAR": {
                  "id": "var_back_e"
                 }
                },
                "inputs": {
                 "VALUE": {
                  "block": {
                   "type": "math_arithmetic",
                   "id": "F87",
                   "fields": {
                    "OP": "MINUS"
                   },
                   "inputs": {
                    "A": {
                     "block": {
                      "type": "variables_get",
                      "id": "F82",
                      "fields": {
                       "VAR": {
                        "id": "var_rel_e"
                       }
                      }
                     }
                    },
                    "B": {
                     "block": {
                      "type": "math_arithmetic",
                      "id": "F86",
                      "fields": {
                       "OP": "MULTIPLY"
                      },
                      "inputs": {
                       "A": {
                        "block": {
                         "type": "math_number",
                         "id": "F83",
                         "fields": {
                          "NUM": 15
                         }
                        }
                       },
                       "B": {
                        "block": {
                         "type": "math_trig",
                         "id": "F85",
                         "fields": {
                          "OP": "SIN"
                         },
                         "inputs": {
                          "NUM": {
                           "block": {
                            "type": "variables_get",
                            "id": "F84",
                            "fields": {
                             "VAR": {
                              "id": "var_yaw"
                             }
                            }
                           }
                          }
                         }
                        }
                       }
                      }
                     }
                    }
                   }
                  }
                 }
                },
                "next": {
                 "block": {
                  "type": "variables_set",
                  "id": "F92",
                  "fields": {
                   "VAR": {
                    "id": "var_steer_n"
                   }
                  },
                  "inputs": {
                   "VALUE": {
                    "block": {
                     "type": "math_arithmetic",
                     "id": "F91",
                     "fields": {
                      "OP": "MULTIPLY"
                     },
                     "inputs": {
                      "A": {
                       "block": {
                        "type": "math_number",
                        "id": "F89",
                        "fields": {
                         "NUM": 0.5
                        }
                       }
                      },
                      "B": {
                       "block": {
                        "type": "variables_get",
                        "id": "F90",
                        "fields": {
                         "VAR": {
                          "id": "var_back_n"
                         }
                        }
                       }
                      }
                     }
                    }
                   }
                  },
                  "next": {
                   "block": {
                    "type": "variables_set",
                    "id": "F96",
                    "fields": {
                     "VAR": {
                      "id": "var_steer_e"
                     }
                    },
                    "inputs": {
                     "VALUE": {
                      "block": {
                       "type": "math_arithmetic",
                       "id": "F95",
                       "fields": {
                        "OP": "MULTIPLY"
                       },
                       "inputs": {
                        "A": {
                         "block": {
                          "type": "math_number",
                          "id": "F93",
                          "fields": {
                           "NUM": 0.5
                          }
                         }
                        },
                        "B": {
                         "block": {
                          "type": "variables_get",
                          "id": "F94",
                          "fields": {
                           "VAR": {
                            "id": "var_back_e"
                           }
                          }
                         }
                        }
                       }
                      }
                     }
                    },
                    "next": {
                     "block": {
                      "type": "variables_set",
                      "id": "F111",
                      "fields": {
                       "VAR": {
                        "id": "var_scale"
                       }
                      },
                      "inputs": {
                       "VALUE": {
                        "block": {
                         "type": "forge_minmax",
                         "id": "F110",
                         "fields": {
                          "OP": "MIN"
                         },
                         "inputs": {
                          "A": {
                           "block": {
                            "type": "math_number",
                            "id": "F97",
                            "fields": {
                             "NUM": 1
                            }
                           }
                          },
                          "B": {
                           "block": {
                            "type": "math_arithmetic",
                            "id": "F109",
                            "fields": {
                             "OP": "DIVIDE"
                            },
                            "inputs": {
                             "A": {
                              "block": {
                               "type": "math_number",
                               "id": "F98",
                               "fields": {
                                "NUM": 6
                               }
                              }
                             },
                             "B": {
                              "block": {
                               "type": "forge_minmax",
                               "id": "F108",
                               "fields": {
                                "OP": "MAX"
                               },
                               "inputs": {
                                "A": {
                                 "block": {
                                  "type": "math_number",
                                  "id": "F99",
                                  "fields": {
                                   "NUM": 0.001
                                  }
                                 }
                                },
                                "B": {
                                 "block": {
                                  "type": "math_single",
                                  "id": "F107",
                                  "fields": {
                                   "OP": "ROOT"
                                  },
                                  "inputs": {
                                   "NUM": {
                                    "block": {
                                     "type": "math_arithmetic",
                                     "id": "F106",
                                     "fields": {
                                      "OP": "ADD"
                                     },
                                     "inputs": {
                                      "A": {
                                       "block": {
                                        "type": "math_arithmetic",
                                        "id": "F103",
                                        "fields": {
                                         "OP": "POWER"
                                        },
                                        "inputs": {
                                         "A": {
                                          "block": {
                                           "type": "variables_get",
                                           "id": "F100",
                                           "fields": {
                                            "VAR": {
                                             "id": "var_steer_n"
                                            }
                                           }
                                          }
                                         },
                                         "B": {
                                          "block": {
                                           "type": "math_number",
                                           "id": "F102",
                                           "fields": {
                                            "NUM": 2
                                           }
                                          }
                                         }
                                        }
                                       }
                                      },
                                      "B": {
                                       "block": {
                                        "type": "math_arithmetic",
                                        "id": "F105",
                                        "fields": {
                                         "OP": "POWER"
                                        },
                                        "inputs": {
                                         "A": {
                                          "block": {
                                           "type": "variables_get",
                                           "id": "F101",
                                           "fields": {
                                            "VAR": {
                                             "id": "var_steer_e"
                                            }
                                           }
                                          }
                                         },
                                         "B": {
                                          "block": {
                                           "type": "math_number",
                                           "id": "F104",
                                           "fields": {
                                            "NUM": 2
                                           }
                                          }
                                         }
                                        }
                                       }
                                      }
                                     }
                                    }
                                   }
                                  }
                                 }
                                }
                               }
                              }
                             }
                            }
                           }
                          }
                         }
                        }
                       }
                      },
                      "next": {
                       "block": {
                        "type": "variables_set",
                        "id": "F115",
                        "fields": {
                         "VAR": {
                          "id": "var_steer_n"
                         }
                        },
                        "inputs": {
                         "VALUE": {
                          "block": {
                           "type": "math_arithmetic",
                           "id": "F114",
                           "fields": {
                            "OP": "MULTIPLY"
                           },
                           "inputs": {
                            "A": {
                             "block": {
                              "type": "variables_get",
                              "id": "F112",
                              "fields": {
                               "VAR": {
                                "id": "var_steer_n"
                               }
                              }
                             }
                            },
                            "B": {
                             "block": {
                              "type": "variables_get",
                              "id": "F113",
                              "fields": {
                               "VAR": {
                                "id": "var_scale"
                               }
                              }
                             }
                            }
                           }
                          }
                         }
                        },
                        "next": {
                         "block": {
                          "type": "variables_set",
                          "id": "F119",
                          "fields": {
                           "VAR": {
                            "id": "var_steer_e"
                           }
                          },
                          "inputs": {
                           "VALUE": {
                            "block": {
                             "type": "math_arithmetic",
                             "id": "F118",
                             "fields": {
                              "OP": "MULTIPLY"
                             },
                             "inputs": {
                              "A": {
                               "block": {
                                "type": "variables_get",
                                "id": "F116",
                                "fields": {
                                 "VAR": {
                                  "id": "var_steer_e"
                                 }
                                }
                               }
                              },
                              "B": {
                               "block": {
                                "type": "variables_get",
                                "id": "F117",
                                "fields": {
                                 "VAR": {
                                  "id": "var_scale"
                                 }
                                }
                               }
                              }
                             }
                            }
                           }
                          },
                          "next": {
                           "block": {
                            "type": "controls_if",
                            "id": "F126",
                            "inputs": {
                             "IF0": {
                              "block": {
                               "type": "logic_negate",
                               "id": "F121",
                               "inputs": {
                                "BOOL": {
                                 "block": {
                                  "type": "variables_get",
                                  "id": "F120",
                                  "fields": {
                                   "VAR": {
                                    "id": "var_seen"
                                   }
                                  }
                                 }
                                }
                               }
                              }
                             },
                             "DO0": {
                              "block": {
                               "type": "variables_set",
                               "id": "F123",
                               "fields": {
                                "VAR": {
                                 "id": "var_steer_n"
                                }
                               },
                               "inputs": {
                                "VALUE": {
                                 "block": {
                                  "type": "math_number",
                                  "id": "F122",
                                  "fields": {
                                   "NUM": 0
                                  }
                                 }
                                }
                               },
                               "next": {
                                "block": {
                                 "type": "variables_set",
                                 "id": "F125",
                                 "fields": {
                                  "VAR": {
                                   "id": "var_steer_e"
                                  }
                                 },
                                 "inputs": {
                                  "VALUE": {
                                   "block": {
                                    "type": "math_number",
                                    "id": "F124",
                                    "fields": {
                                     "NUM": 0
                                    }
                                   }
                                  }
                                 }
                                }
                               }
                              }
                             }
                            },
                            "next": {
                             "block": {
                              "type": "variables_set",
                              "id": "F135",
                              "fields": {
                               "VAR": {
                                "id": "var_hold_climb"
                               }
                              },
                              "inputs": {
                               "VALUE": {
                                "block": {
                                 "type": "math_constrain",
                                 "id": "F134",
                                 "inputs": {
                                  "VALUE": {
                                   "block": {
                                    "type": "math_arithmetic",
                                    "id": "F131",
                                    "fields": {
                                     "OP": "MULTIPLY"
                                    },
                                    "inputs": {
                                     "A": {
                                      "block": {
                                       "type": "math_number",
                                       "id": "F127",
                                       "fields": {
                                        "NUM": 0.8
                                       }
                                      }
                                     },
                                     "B": {
                                      "block": {
                                       "type": "math_arithmetic",
                                       "id": "F130",
                                       "fields": {
                                        "OP": "MINUS"
                                       },
                                       "inputs": {
                                        "A": {
                                         "block": {
                                          "type": "math_number",
                                          "id": "F128",
                                          "fields": {
                                           "NUM": 15
                                          }
                                         }
                                        },
                                        "B": {
                                         "block": {
                                          "type": "forge_vehicle_value",
                                          "id": "F129",
                                          "fields": {
                                           "WHAT": "alt"
                                          }
                                         }
                                        }
                                       }
                                      }
                                     }
                                    }
                                   }
                                  },
                                  "LOW": {
                                   "block": {
                                    "type": "math_number",
                                    "id": "F132",
                                    "fields": {
                                     "NUM": -1.5
                                    }
                                   }
                                  },
                                  "HIGH": {
                                   "block": {
                                    "type": "math_number",
                                    "id": "F133",
                                    "fields": {
                                     "NUM": 2
                                    }
                                   }
                                  }
                                 }
                                }
                               }
                              },
                              "next": {
                               "block": {
                                "type": "forge_debug",
                                "id": "F137",
                                "fields": {
                                 "INDEX": "0"
                                },
                                "inputs": {
                                 "VALUE": {
                                  "block": {
                                   "type": "variables_get",
                                   "id": "F136",
                                   "fields": {
                                    "VAR": {
                                     "id": "var_stage"
                                    }
                                   }
                                  }
                                 }
                                },
                                "next": {
                                 "block": {
                                  "type": "forge_debug",
                                  "id": "F139",
                                  "fields": {
                                   "INDEX": "1"
                                  },
                                  "inputs": {
                                   "VALUE": {
                                    "block": {
                                     "type": "variables_get",
                                     "id": "F138",
                                     "fields": {
                                      "VAR": {
                                       "id": "var_gap"
                                      }
                                     }
                                    }
                                   }
                                  },
                                  "next": {
                                   "block": {
                                    "type": "forge_debug",
                                    "id": "F141",
                                    "fields": {
                                     "INDEX": "2"
                                    },
                                    "inputs": {
                                     "VALUE": {
                                      "block": {
                                       "type": "forge_vehicle_value",
                                       "id": "F140",
                                       "fields": {
                                        "WHAT": "alt"
                                       }
                                      }
                                     }
                                    }
                                   }
                                  }
                                 }
                                }
                               }
                              }
                             }
                            }
                           }
                          }
                         }
                        }
                       }
                      }
                     }
                    }
                   }
                  }
                 }
                }
               }
              }
             }
            }
           }
          }
         }
        }
       }
      },
      "STATES": {
       "block": {
        "type": "forge_state",
        "id": "F155",
        "fields": {
         "NAME": "climb"
        },
        "inputs": {
         "ENTRY": {
          "block": {
           "type": "variables_set",
           "id": "F143",
           "fields": {
            "VAR": {
             "id": "var_stage"
            }
           },
           "inputs": {
            "VALUE": {
             "block": {
              "type": "math_number",
              "id": "F142",
              "fields": {
               "NUM": 0
              }
             }
            }
           }
          }
         },
         "TICK": {
          "block": {
           "type": "forge_cmd_loiter",
           "id": "F149",
           "fields": {
            "frame": "NED",
            "yaw_valid": true,
            "DISARM_WHEN_LANDED": false
           },
           "inputs": {
            "vel_x": {
             "block": {
              "type": "math_number",
              "id": "F144",
              "fields": {
               "NUM": 0
              }
             }
            },
            "vel_y": {
             "block": {
              "type": "math_number",
              "id": "F145",
              "fields": {
               "NUM": 0
              }
             }
            },
            "climb_rate": {
             "block": {
              "type": "variables_get",
              "id": "F146",
              "fields": {
               "VAR": {
                "id": "var_hold_climb"
               }
              }
             }
            },
            "yaw_rate": {
             "block": {
              "type": "math_number",
              "id": "F148",
              "fields": {
               "NUM": 0
              }
             }
            },
            "yaw": {
             "block": {
              "type": "variables_get",
              "id": "F147",
              "fields": {
               "VAR": {
                "id": "var_yaw"
               }
              }
             }
            }
           },
           "next": {
            "block": {
             "type": "controls_if",
             "id": "F154",
             "inputs": {
              "IF0": {
               "block": {
                "type": "logic_compare",
                "id": "F152",
                "fields": {
                 "OP": "GT"
                },
                "inputs": {
                 "A": {
                  "block": {
                   "type": "forge_vehicle_value",
                   "id": "F150",
                   "fields": {
                    "WHAT": "alt"
                   }
                  }
                 },
                 "B": {
                  "block": {
                   "type": "math_number",
                   "id": "F151",
                   "fields": {
                    "NUM": 13
                   }
                  }
                 }
                }
               }
              },
              "DO0": {
               "block": {
                "type": "forge_goto",
                "id": "F153",
                "fields": {
                 "NAME": "follow"
                }
               }
              }
             }
            }
           }
          }
         }
        },
        "next": {
         "block": {
          "type": "forge_state",
          "id": "F181",
          "fields": {
           "NAME": "follow"
          },
          "inputs": {
           "ENTRY": {
            "block": {
             "type": "variables_set",
             "id": "F157",
             "fields": {
              "VAR": {
               "id": "var_stage"
              }
             },
             "inputs": {
              "VALUE": {
               "block": {
                "type": "math_number",
                "id": "F156",
                "fields": {
                 "NUM": 1
                }
               }
              }
             },
             "next": {
              "block": {
               "type": "variables_set",
               "id": "F159",
               "fields": {
                "VAR": {
                 "id": "var_follow_since"
                }
               },
               "inputs": {
                "VALUE": {
                 "block": {
                  "type": "forge_time_running",
                  "id": "F158"
                 }
                }
               }
              }
             }
            }
           },
           "TICK": {
            "block": {
             "type": "forge_cmd_loiter",
             "id": "F169",
             "fields": {
              "frame": "NED",
              "yaw_valid": true,
              "DISARM_WHEN_LANDED": false
             },
             "inputs": {
              "vel_x": {
               "block": {
                "type": "math_arithmetic",
                "id": "F162",
                "fields": {
                 "OP": "ADD"
                },
                "inputs": {
                 "A": {
                  "block": {
                   "type": "variables_get",
                   "id": "F160",
                   "fields": {
                    "VAR": {
                     "id": "var_pf_vn"
                    }
                   }
                  }
                 },
                 "B": {
                  "block": {
                   "type": "variables_get",
                   "id": "F161",
                   "fields": {
                    "VAR": {
                     "id": "var_steer_n"
                    }
                   }
                  }
                 }
                }
               }
              },
              "vel_y": {
               "block": {
                "type": "math_arithmetic",
                "id": "F165",
                "fields": {
                 "OP": "ADD"
                },
                "inputs": {
                 "A": {
                  "block": {
                   "type": "variables_get",
                   "id": "F163",
                   "fields": {
                    "VAR": {
                     "id": "var_pf_ve"
                    }
                   }
                  }
                 },
                 "B": {
                  "block": {
                   "type": "variables_get",
                   "id": "F164",
                   "fields": {
                    "VAR": {
                     "id": "var_steer_e"
                    }
                   }
                  }
                 }
                }
               }
              },
              "climb_rate": {
               "block": {
                "type": "variables_get",
                "id": "F166",
                "fields": {
                 "VAR": {
                  "id": "var_hold_climb"
                 }
                }
               }
              },
              "yaw_rate": {
               "block": {
                "type": "math_number",
                "id": "F168",
                "fields": {
                 "NUM": 0
                }
               }
              },
              "yaw": {
               "block": {
                "type": "variables_get",
                "id": "F167",
                "fields": {
                 "VAR": {
                  "id": "var_yaw"
                 }
                }
               }
              }
             },
             "next": {
              "block": {
               "type": "controls_if",
               "id": "F180",
               "inputs": {
                "IF0": {
                 "block": {
                  "type": "logic_compare",
                  "id": "F174",
                  "fields": {
                   "OP": "GT"
                  },
                  "inputs": {
                   "A": {
                    "block": {
                     "type": "math_arithmetic",
                     "id": "F172",
                     "fields": {
                      "OP": "MINUS"
                     },
                     "inputs": {
                      "A": {
                       "block": {
                        "type": "forge_time_running",
                        "id": "F170"
                       }
                      },
                      "B": {
                       "block": {
                        "type": "variables_get",
                        "id": "F171",
                        "fields": {
                         "VAR": {
                          "id": "var_follow_since"
                         }
                        }
                       }
                      }
                     }
                    }
                   },
                   "B": {
                    "block": {
                     "type": "math_number",
                     "id": "F173",
                     "fields": {
                      "NUM": 40
                     }
                    }
                   }
                  }
                 }
                },
                "DO0": {
                 "block": {
                  "type": "forge_goto",
                  "id": "F175",
                  "fields": {
                   "NAME": "home"
                  }
                 }
                },
                "IF1": {
                 "block": {
                  "type": "logic_compare",
                  "id": "F178",
                  "fields": {
                   "OP": "GT"
                  },
                  "inputs": {
                   "A": {
                    "block": {
                     "type": "forge_pkt_age",
                     "id": "F176",
                     "fields": {
                      "PACKET": "truck"
                     }
                    }
                   },
                   "B": {
                    "block": {
                     "type": "math_number",
                     "id": "F177",
                     "fields": {
                      "NUM": 3000
                     }
                    }
                   }
                  }
                 }
                },
                "DO1": {
                 "block": {
                  "type": "forge_goto",
                  "id": "F179",
                  "fields": {
                   "NAME": "home"
                  }
                 }
                }
               },
               "extraState": {
                "elseIfCount": 1
               }
              }
             }
            }
           }
          },
          "next": {
           "block": {
            "type": "forge_state",
            "id": "F202",
            "fields": {
             "NAME": "home"
            },
            "inputs": {
             "ENTRY": {
              "block": {
               "type": "variables_set",
               "id": "F183",
               "fields": {
                "VAR": {
                 "id": "var_stage"
                }
               },
               "inputs": {
                "VALUE": {
                 "block": {
                  "type": "math_number",
                  "id": "F182",
                  "fields": {
                   "NUM": 2
                  }
                 }
                }
               }
              }
             },
             "TICK": {
              "block": {
               "type": "forge_cmd_guided",
               "id": "F189",
               "fields": {
                "yaw_valid": true,
                "DISARM_WHEN_LANDED": false
               },
               "inputs": {
                "pos_n": {
                 "block": {
                  "type": "math_number",
                  "id": "F184",
                  "fields": {
                   "NUM": 0
                  }
                 }
                },
                "pos_e": {
                 "block": {
                  "type": "math_number",
                  "id": "F185",
                  "fields": {
                   "NUM": 0
                  }
                 }
                },
                "alt": {
                 "block": {
                  "type": "math_number",
                  "id": "F186",
                  "fields": {
                   "NUM": 15
                  }
                 }
                },
                "yaw": {
                 "block": {
                  "type": "variables_get",
                  "id": "F187",
                  "fields": {
                   "VAR": {
                    "id": "var_yaw"
                   }
                  }
                 }
                },
                "speed_max": {
                 "block": {
                  "type": "math_number",
                  "id": "F188",
                  "fields": {
                   "NUM": 8
                  }
                 }
                }
               },
               "next": {
                "block": {
                 "type": "controls_if",
                 "id": "F201",
                 "inputs": {
                  "IF0": {
                   "block": {
                    "type": "logic_compare",
                    "id": "F199",
                    "fields": {
                     "OP": "LT"
                    },
                    "inputs": {
                     "A": {
                      "block": {
                       "type": "math_single",
                       "id": "F197",
                       "fields": {
                        "OP": "ROOT"
                       },
                       "inputs": {
                        "NUM": {
                         "block": {
                          "type": "math_arithmetic",
                          "id": "F196",
                          "fields": {
                           "OP": "ADD"
                          },
                          "inputs": {
                           "A": {
                            "block": {
                             "type": "math_arithmetic",
                             "id": "F193",
                             "fields": {
                              "OP": "POWER"
                             },
                             "inputs": {
                              "A": {
                               "block": {
                                "type": "forge_vehicle_value",
                                "id": "F190",
                                "fields": {
                                 "WHAT": "north"
                                }
                               }
                              },
                              "B": {
                               "block": {
                                "type": "math_number",
                                "id": "F192",
                                "fields": {
                                 "NUM": 2
                                }
                               }
                              }
                             }
                            }
                           },
                           "B": {
                            "block": {
                             "type": "math_arithmetic",
                             "id": "F195",
                             "fields": {
                              "OP": "POWER"
                             },
                             "inputs": {
                              "A": {
                               "block": {
                                "type": "forge_vehicle_value",
                                "id": "F191",
                                "fields": {
                                 "WHAT": "east"
                                }
                               }
                              },
                              "B": {
                               "block": {
                                "type": "math_number",
                                "id": "F194",
                                "fields": {
                                 "NUM": 2
                                }
                               }
                              }
                             }
                            }
                           }
                          }
                         }
                        }
                       }
                      }
                     },
                     "B": {
                      "block": {
                       "type": "math_number",
                       "id": "F198",
                       "fields": {
                        "NUM": 1.5
                       }
                      }
                     }
                    }
                   }
                  },
                  "DO0": {
                   "block": {
                    "type": "forge_goto",
                    "id": "F200",
                    "fields": {
                     "NAME": "land"
                    }
                   }
                  }
                 }
                }
               }
              }
             }
            },
            "next": {
             "block": {
              "type": "forge_state",
              "id": "F208",
              "fields": {
               "NAME": "land"
              },
              "inputs": {
               "ENTRY": {
                "block": {
                 "type": "variables_set",
                 "id": "F204",
                 "fields": {
                  "VAR": {
                   "id": "var_stage"
                  }
                 },
                 "inputs": {
                  "VALUE": {
                   "block": {
                    "type": "math_number",
                    "id": "F203",
                    "fields": {
                     "NUM": 3
                    }
                   }
                  }
                 }
                }
               },
               "TICK": {
                "block": {
                 "type": "forge_cmd_land",
                 "id": "F207",
                 "inputs": {
                  "vel_x": {
                   "block": {
                    "type": "math_number",
                    "id": "F205",
                    "fields": {
                     "NUM": 0
                    }
                   }
                  },
                  "vel_y": {
                   "block": {
                    "type": "math_number",
                    "id": "F206",
                    "fields": {
                     "NUM": 0
                    }
                   }
                  }
                 }
                }
               }
              }
             }
            }
           }
          }
         }
        }
       }
      }
     },
     "x": 40,
     "y": 40
    },
    {
     "type": "forge_ground_link",
     "id": "link_ground",
     "fields": {
      "ENDIAN": "LE"
     },
     "inputs": {
      "PACKETS": {
       "block": {
        "type": "forge_packet",
        "id": "L9",
        "fields": {
         "NAME": "truck",
         "DIR": "RX",
         "START": "AA 55",
         "ID": "21",
         "CHECKSUM": "CRC16",
         "PERIOD": 200,
         "STALE": 1500
        },
        "inputs": {
         "FIELDS": {
          "block": {
           "type": "forge_packet_field",
           "id": "L2",
           "fields": {
            "VAR": {
             "id": "fv_truck_lat"
            },
            "TYPE": "i32",
            "SCALE": 1e-7,
            "OFFSET": 0,
            "UNIT": "deg"
           },
           "inputs": {
            "VALUE": {
             "block": {
              "type": "forge_source",
              "id": "L1",
              "fields": {
               "ACTOR": "truck_gps",
               "VAR": "gps_lat"
              }
             }
            }
           },
           "next": {
            "block": {
             "type": "forge_packet_field",
             "id": "L4",
             "fields": {
              "VAR": {
               "id": "fv_truck_lon"
              },
              "TYPE": "i32",
              "SCALE": 1e-7,
              "OFFSET": 0,
              "UNIT": "deg"
             },
             "inputs": {
              "VALUE": {
               "block": {
                "type": "forge_source",
                "id": "L3",
                "fields": {
                 "ACTOR": "truck_gps",
                 "VAR": "gps_lon"
                }
               }
              }
             },
             "next": {
              "block": {
               "type": "forge_packet_field",
               "id": "L6",
               "fields": {
                "VAR": {
                 "id": "fv_truck_vel_n"
                },
                "TYPE": "i16",
                "SCALE": 0.01,
                "OFFSET": 0,
                "UNIT": "m/s"
               },
               "inputs": {
                "VALUE": {
                 "block": {
                  "type": "forge_source",
                  "id": "L5",
                  "fields": {
                   "ACTOR": "truck_gps",
                   "VAR": "gps_vel_n"
                  }
                 }
                }
               },
               "next": {
                "block": {
                 "type": "forge_packet_field",
                 "id": "L8",
                 "fields": {
                  "VAR": {
                   "id": "fv_truck_vel_e"
                  },
                  "TYPE": "i16",
                  "SCALE": 0.01,
                  "OFFSET": 0,
                  "UNIT": "m/s"
                 },
                 "inputs": {
                  "VALUE": {
                   "block": {
                    "type": "forge_source",
                    "id": "L7",
                    "fields": {
                     "ACTOR": "truck_gps",
                     "VAR": "gps_vel_e"
                    }
                   }
                  }
                 }
                }
               }
              }
             }
            }
           }
          }
         }
        },
        "next": {
         "block": {
          "type": "forge_packet",
          "id": "L18",
          "fields": {
           "NAME": "report",
           "DIR": "TX",
           "START": "AA 55",
           "ID": "31",
           "CHECKSUM": "CRC16",
           "PERIOD": 500,
           "STALE": 1500
          },
          "inputs": {
           "FIELDS": {
            "block": {
             "type": "forge_packet_field",
             "id": "L11",
             "fields": {
              "VAR": {
               "id": "var_stage"
              },
              "TYPE": "u8",
              "SCALE": 1,
              "OFFSET": 0,
              "UNIT": ""
             },
             "inputs": {},
             "next": {
              "block": {
               "type": "forge_packet_field",
               "id": "L13",
               "fields": {
                "VAR": {
                 "id": "fv_height"
                },
                "TYPE": "i16",
                "SCALE": 0.01,
                "OFFSET": 0,
                "UNIT": "m"
               },
               "inputs": {
                "VALUE": {
                 "block": {
                  "type": "forge_vehicle_value",
                  "id": "F12",
                  "fields": {
                   "WHAT": "alt"
                  }
                 }
                }
               },
               "next": {
                "block": {
                 "type": "forge_packet_field",
                 "id": "L15",
                 "fields": {
                  "VAR": {
                   "id": "var_gap"
                  },
                  "TYPE": "u16",
                  "SCALE": 0.1,
                  "OFFSET": 0,
                  "UNIT": "m"
                 },
                 "inputs": {},
                 "next": {
                  "block": {
                   "type": "forge_packet_field",
                   "id": "L17",
                   "fields": {
                    "VAR": {
                     "id": "fv_truck_seen"
                    },
                    "TYPE": "u8",
                    "SCALE": 1,
                    "OFFSET": 0,
                    "UNIT": ""
                   },
                   "inputs": {
                    "VALUE": {
                     "block": {
                      "type": "variables_get",
                      "id": "F16",
                      "fields": {
                       "VAR": {
                        "id": "var_seen"
                       }
                      }
                     }
                    }
                   }
                  }
                 }
                }
               }
              }
             }
            }
           }
          }
         }
        }
       }
      }
     },
     "x": 1500,
     "y": 40
    }
   ]
  },
  "variables": [
   {
    "name": "pf_vn",
    "id": "var_pf_vn"
   },
   {
    "name": "pf_ve",
    "id": "var_pf_ve"
   },
   {
    "name": "yaw",
    "id": "var_yaw"
   },
   {
    "name": "rel_n",
    "id": "var_rel_n"
   },
   {
    "name": "rel_e",
    "id": "var_rel_e"
   },
   {
    "name": "seen",
    "id": "var_seen"
   },
   {
    "name": "gap",
    "id": "var_gap"
   },
   {
    "name": "back_n",
    "id": "var_back_n"
   },
   {
    "name": "back_e",
    "id": "var_back_e"
   },
   {
    "name": "steer_n",
    "id": "var_steer_n"
   },
   {
    "name": "steer_e",
    "id": "var_steer_e"
   },
   {
    "name": "scale",
    "id": "var_scale"
   },
   {
    "name": "hold_climb",
    "id": "var_hold_climb"
   },
   {
    "name": "stage",
    "id": "var_stage"
   },
   {
    "name": "follow_since",
    "id": "var_follow_since"
   },
   {
    "name": "truck_lat",
    "id": "fv_truck_lat"
   },
   {
    "name": "truck_lon",
    "id": "fv_truck_lon"
   },
   {
    "name": "truck_vel_n",
    "id": "fv_truck_vel_n"
   },
   {
    "name": "truck_vel_e",
    "id": "fv_truck_vel_e"
   },
   {
    "name": "height",
    "id": "fv_height"
   },
   {
    "name": "truck_seen",
    "id": "fv_truck_seen"
   }
  ],
  "actors": [
   {
    "id": "truck_gps",
    "name": "Truck GPS",
    "asset": "gps_receiver",
    "motion": "attached",
    "position": [
     0,
     0,
     0
    ],
    "rotationDeg": [
     0,
     0,
     0
    ],
    "waypoints": [
     [
      0,
      0,
      0
     ]
    ],
    "speedMps": 5,
    "loop": "back_and_forth",
    "attachTo": "truck",
    "offset": [
     1.5,
     0,
     0.1
    ],
    "markerFamily": "aruco_4x4_50",
    "markerId": 0,
    "markerSizeM": 1,
    "camera": null,
    "gimbal": null,
    "gps": {
     "preset": "typical",
     "lossFrac": 0.05,
     "outageEveryS": 600,
     "outageS": 3,
     "jumpEveryS": 180,
     "jumpM": 2.5,
     "jumpS": 4,
     "rateHz": 5,
     "hSigmaM": 0.8,
     "vSigmaM": 1.8,
     "velSigmaMps": 0.1,
     "biasM": 1.5,
     "biasTauS": 300,
     "latencyMs": 220,
     "sats": 14
    },
    "assetName": "GPS receiver"
   },
   {
    "id": "truck",
    "name": "Platform truck",
    "asset": "box_truck",
    "motion": "waypoints",
    "position": [
     40,
     20,
     0
    ],
    "rotationDeg": [
     0,
     0,
     0
    ],
    "waypoints": [
     [
      40,
      20,
      0
     ],
     [
      1240,
      20,
      0
     ]
    ],
    "speedMps": 5,
    "loop": "back_and_forth",
    "attachTo": "",
    "offset": [
     0,
     0,
     0
    ],
    "markerFamily": "aruco_4x4_50",
    "markerId": 0,
    "markerSizeM": 1,
    "camera": null,
    "gimbal": null,
    "gps": null,
    "assetName": "Box truck"
   }
  ]
 }
}
