feat: all the features

* Move rover-ros2/rover_launch.py to src/anchor_pkg/launch/, renamed to rover.launch.py
* Anchor now waits to initialize topics until after it has found a microcontroller.
* Headless now waits for anchor to start before it starts itself
* Add default cases to motor feedback for motorId
* Added black to the flake.nix and package.xml
This commit is contained in:
David
2025-10-23 02:22:31 -05:00
parent 44aa4b0848
commit fe1ae6120f
8 changed files with 43 additions and 25 deletions

View File

@@ -48,6 +48,14 @@ class Headless(Node):
# Initialize pygame first
pygame.init()
pygame.joystick.init()
super().__init__("headless")
# Wait for anchor to start
pub_info = self.get_publishers_info_by_topic('/anchor/from_vic/debug')
while len(pub_info) == 0:
self.get_logger().info("Waiting for anchor to start...")
time.sleep(1.0)
pub_info = self.get_publishers_info_by_topic('/anchor/from_vic/debug')
# Wait for a gamepad to be connected
print("Waiting for gamepad connection...")
@@ -65,8 +73,6 @@ class Headless(Node):
self.gamepad.init()
print(f'Gamepad Found: {self.gamepad.get_name()}')
# Now initialize the ROS2 node
super().__init__("headless")
self.create_timer(0.15, self.send_controls)
self.core_publisher = self.create_publisher(CoreControl, '/core/control', 2)