Skip to content

Commit

Permalink
Refactor camera device variable naming for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkahl committed Feb 6, 2025
1 parent 9c64e94 commit d2c36db
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions videos/src/get_ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ def get_ip(self, msg):

def launch_camera(self, ip):
# Find camera devices
explorehd_devices = self.find_camera_devices()
cameras = self.find_camera_devices()
# Launch nodes with the discovered devices
i = 1
for camera in explorehd_devices:
for camera in cameras:
if i > 4:
self.get_logger().info("Camera limit reached, not launching more nodes.")
break
Expand All @@ -71,7 +71,7 @@ def find_camera_devices(self):
# Run command: v4l2-ctl --list-devices
output = subprocess.run(["v4l2-ctl", "--list-devices"], capture_output=True, text=True).stdout
lines = output.splitlines()
explorehd_devices = []
cameras = []
i = 0
# Find the lines with "exploreHD" and get the third device
while i < len(lines):
Expand All @@ -82,11 +82,11 @@ def find_camera_devices(self):
devices.append(lines[i].strip())
i += 1
if len(devices) >= 3:
explorehd_devices.append(devices[2]) # Third device (0-based index)
cameras.append(devices[2]) # Third device (0-based index)
else:
i += 1

self.get_logger().info(f"Discovered cameras: {explorehd_devices}")
self.get_logger().info(f"Discovered cameras: {cameras}")


def publish_stop(self):
Expand Down

0 comments on commit d2c36db

Please sign in to comment.