sim.scoring.HoopScore#
Classes#
Scoring node for in-house competition. |
Functions#
|
Main function for scoring node. (SAME AS BEFORE) |
Module Contents#
- class HoopScoringNode(vehicle_name: str | None = None, hoop_tolerance: float = 1.5, landing_bonus: float = 5.0, landing_tolerance: float = 2.0, landing_altitude_max: float = 0.4)#
Bases:
sim.scoring.ScoringNodeScoring node for in-house competition. Tracks UAV position and scores hoop passages using directional detection.
- vehicle_name#
- hoop_tolerance = 1.5#
- landing_bonus = 5.0#
- landing_tolerance = 2.0#
- landing_altitude_max = 0.4#
- hoop_poses: List[Tuple[float, float, float, float, float, float]] = []#
- passed_hoops: List[bool] = []#
- start_time#
- uav_position: Tuple[float, float, float] | None = None#
- position_history: List[Tuple[float, float, float, float]] = []#
- max_history = 100#
- prev_position: Tuple[float, float, float] | None = None#
- drone_last_side: List[int] = []#
- landed_at_origin = False#
- landing_bonus_awarded = False#
- drone_publisher#
- position_subscription#
- hoop_client#
- hoops_loaded = False#
- _try_request_hoops()#
- _on_hoops_response(future)#
- load_hoop_positions()#
Load hoop positions from ROS2 parameters.
- set_course_hoops(hoop_poses: List[Tuple[float, float, float, float, float, float]])#
Set the hoop positions for scoring. (UPDATED)
- update_scoring() None#
Check if drone passes through any hoop using directional detection.
Implements the abstract method from ScoringNode.
- check_landing_bonus()#
Check if drone has landed at origin and award bonus points.
- _world_to_hoop_local(world_pos: Tuple[float, float, float], hoop_pos: Tuple[float, float, float], hoop_euler: Tuple[float, float, float]) Tuple[float, float, float]#
Convert world position to hoop local coordinates. (NEW METHOD)
- position_callback(msg: px4_msgs.msg.VehicleLocalPosition)#
Callback for UAV position updates. (SAME AS BEFORE)
- main(args=None)#
Main function for scoring node. (SAME AS BEFORE)