Skip to content

Feature/hw13-ros2 - #13

Merged
alex-popkov merged 12 commits into
mainfrom
feature/hw13-ros2
Aug 15, 2026
Merged

alex-popkov merged 12 commits into
mainfrom
feature/hw13-ros2

Conversation

@alex-popkov

Copy link
Copy Markdown
Owner

Extends the provided antidrone_turret package with the turret control layer required by the assignment. Adds a ROS-independent decision core, the turret_controller_node, two aiming driver nodes, three new message types, unit tests, and the CMake/launch/YAML wiring. The starter package (target_track_publisher_node, actuator_node, provided interfaces, tracks, and provided_logic_test.cpp) is left untouched.

What was implemented

New message interfaces

  • msg/GimbalCommand.msg — vertical aiming command (UP/CENTER/DOWN, target_y, error_y)
  • msg/ServoCommand.msg — horizontal aiming command (LEFT/CENTER/RIGHT, target_x, error_x)
  • msg/TurretStatus.msg — controller decision snapshot (target_state, action, trigger_state, confidence, distance_m)

Pure C++ logic (no rclcpp) — include/antidrone_turret/turret_controller.hpp

  • evaluate_target → TARGET_NONE / TARGET_LOW_CONFIDENCE / TARGET_LOCKED
  • make_servo_command → direction + error_x = x - 320
  • make_gimbal_command → direction + error_y = 240 - y
  • make_trigger_decision → TRIGGER_SKIP / TRIGGER_REQUESTED / TRIGGER_RELOADING
  • build_turret_status → assembles the full TurretStatus

Nodes

  • turret_controller_node — subscribes to /perception/target and /actuator/status, publishes /turret/status, /gimbal/cmd, /servo/cmd, and calls the /actuator/trigger service. Reads confidence_threshold and max_distance_m from YAML. The node is a thin wrapper: it only translates ROS messages to/from the pure logic and maps enums to message constants.
  • gimbal_driver_node — subscribes to /gimbal/cmd and logs the typed command.
  • yaw_servo_driver_node — subscribes to /servo/cmd and logs the typed command.

Trigger safety
A single fire request per engagement: a trigger_pending_ latch plus the last /actuator/status state prevent duplicate /actuator/trigger calls while the actuator is RELOADING. The latch is cleared once the actuator returns to READY.
Tests — test/turret_controller_test.cpp

At least one test per decision part: target evaluation, servo command, gimbal command, trigger decision (READY → REQUESTED, RELOADING → RELOADING, far → SKIP), and full TurretStatus assembly.
Build / launch / config

CMakeLists.txt: registered the three new interfaces, added executables for the three new nodes (ament_auto), linked cpp_typesupport_target, and added the new gtest target.
system.launch.py: added the three nodes (controller gets parameters=[config]; drivers run without parameters). All nodes honor the log_level argument.
config/sequence.yaml: turret_controller_node parameters (confidence_threshold: 0.8, max_distance_m: 30.0).

Comment thread .devcontainer/Dockerfile Resolved

@yevhenkuznetsov yevhenkuznetsov left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сподобалося, як у controller node використано trigger_pending_: прапорець встановлюється до асинхронного виклику сервісу і скидається лише після отримання READY. Це закриває проміжок до оновлення /actuator/status і не допускає повторного trigger. Власні тести також добре покривають граничні координати, confidence threshold, READY та RELOADING.

Після тимчасового виправлення середовища проєкт збирається, усі 33 тести проходять. Far-flyby дає наведення без trigger, low-confidence дає ACTION_IDLE і TRIGGER_SKIP, reload-сценарій переходить від TRIGGER_REQUESTED до TRIGGER_RELOADING без повторного виклику сервісу.

Blocking: devcontainer з PR не збирається. Evidence і перевірений fix: #13 (comment)

Blocking: PR має merge conflicts, GitHub показує CONFLICTING / DIRTY. Потрібно синхронізувати гілку з main та розв’язати конфлікти.

alex-popkov and others added 2 commits August 15, 2026 13:06
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@alex-popkov
alex-popkov merged commit 1e34c32 into main Aug 15, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants