mecha10-behavior-patterns 0.1.23

Common behavior patterns for Mecha10 - subsumption, ensemble, and more
Documentation
{
  "$schema": "https://mecha10.dev/schemas/behavior-composition-v1.json",
  "name": "patrol",
  "description": "Default patrol behavior with waypoint following, obstacle avoidance, and status reporting",
  "root": {
    "type": "sequence",
    "name": "patrol_loop",
    "children": [
      {
        "type": "node",
        "node": "check_battery_level",
        "name": "battery_check",
        "config": {
          "min_battery_percentage": 20.0,
          "return_to_base_threshold": 15.0
        }
      },
      {
        "type": "selector",
        "name": "patrol_or_return",
        "children": [
          {
            "type": "sequence",
            "name": "patrol_waypoints",
            "children": [
              {
                "type": "node",
                "node": "load_waypoints",
                "name": "waypoint_loader",
                "config": {
                  "waypoint_file": "configs/waypoints/patrol_route.json",
                  "loop_route": true,
                  "load_on_init": true
                }
              },
              {
                "type": "node",
                "node": "get_next_waypoint",
                "name": "waypoint_selector",
                "config": {
                  "cycle_mode": "sequential",
                  "skip_reached": true
                }
              },
              {
                "type": "parallel",
                "name": "navigate_with_monitoring",
                "policy": "require_one",
                "children": [
                  {
                    "type": "sequence",
                    "name": "navigation_sequence",
                    "children": [
                      {
                        "type": "node",
                        "node": "plan_path",
                        "name": "path_planner",
                        "config_ref": "path_planning"
                      },
                      {
                        "type": "selector",
                        "name": "navigate_or_avoid",
                        "children": [
                          {
                            "type": "sequence",
                            "name": "obstacle_handling",
                            "children": [
                              {
                                "type": "node",
                                "node": "detect_obstacles",
                                "name": "obstacle_detector",
                                "config_ref": "obstacle_detection"
                              },
                              {
                                "type": "selector",
                                "name": "avoidance_strategy",
                                "children": [
                                  {
                                    "type": "node",
                                    "node": "replan_around_obstacle",
                                    "name": "dynamic_replanner",
                                    "config": {
                                      "replan_timeout_sec": 2.0,
                                      "max_replan_attempts": 3
                                    }
                                  },
                                  {
                                    "type": "node",
                                    "node": "wait_for_clearance",
                                    "name": "obstacle_waiter",
                                    "config": {
                                      "max_wait_time_sec": 10.0,
                                      "check_interval_ms": 500
                                    }
                                  }
                                ]
                              }
                            ]
                          },
                          {
                            "type": "node",
                            "node": "follow_path",
                            "name": "path_follower",
                            "config_ref": "path_following"
                          }
                        ]
                      },
                      {
                        "type": "node",
                        "node": "check_waypoint_reached",
                        "name": "waypoint_validator",
                        "config": {
                          "distance_threshold": 0.3,
                          "heading_threshold_deg": 15.0
                        }
                      }
                    ]
                  },
                  {
                    "type": "node",
                    "node": "publish_status",
                    "name": "status_reporter",
                    "config": {
                      "publish_interval_sec": 2.0,
                      "topic": "/robot/patrol_status",
                      "include_position": true,
                      "include_velocity": true,
                      "include_battery": true
                    }
                  }
                ]
              },
              {
                "type": "node",
                "node": "record_waypoint_visit",
                "name": "visit_logger",
                "config": {
                  "log_timestamp": true,
                  "log_duration": true,
                  "save_to_file": true
                }
              }
            ]
          },
          {
            "type": "sequence",
            "name": "return_to_base",
            "children": [
              {
                "type": "node",
                "node": "set_base_as_goal",
                "name": "base_goal_setter",
                "config": {
                  "base_position": [0.0, 0.0, 0.0],
                  "base_orientation": [0.0, 0.0, 0.0, 1.0]
                }
              },
              {
                "type": "node",
                "node": "navigate_to_goal",
                "name": "base_navigator",
                "config": {
                  "approach_speed": 0.3,
                  "final_position_tolerance": 0.15
                }
              },
              {
                "type": "node",
                "node": "initiate_charging",
                "name": "charging_initiator",
                "config": {
                  "docking_enabled": true,
                  "align_with_dock": true,
                  "contact_timeout_sec": 30.0
                }
              }
            ]
          }
        ]
      }
    ]
  },
  "configs": {
    "path_planning": {
      "planner_type": "a_star",
      "grid_resolution": 0.05,
      "allow_unknown": false,
      "use_costmap": true,
      "inflation_radius": 0.3,
      "cost_scaling_factor": 10.0
    },
    "obstacle_detection": {
      "sensor_types": ["lidar", "sonar"],
      "fusion_method": "max_confidence",
      "detection_range": 5.0,
      "min_obstacle_size": 0.1,
      "confidence_threshold": 0.7,
      "update_rate_hz": 20.0
    },
    "path_following": {
      "controller_type": "pure_pursuit",
      "max_linear_speed": 0.8,
      "max_angular_speed": 1.0,
      "lookahead_distance": 0.5,
      "position_tolerance": 0.2,
      "angular_tolerance_deg": 10.0
    }
  }
}