Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement SIM Cameras #357

Merged
merged 43 commits into from
Jan 5, 2025
Merged

Implement SIM Cameras #357

merged 43 commits into from
Jan 5, 2025

Conversation

ClayJay3
Copy link
Collaborator

@ClayJay3 ClayJay3 commented Jan 4, 2025

Description

This PR introduces significant updates and enhancements to the simulation camera system, specifically for Unreal Engine Pixel Streaming integration. These changes improve the functionality, stability, and extensibility of the SIMZEDCam module and related components. SIMBasicCam has also been written, but is not currently used because no BasicCams are used in the simulator.

Changes Made

  • Implemented RGB frame streaming functionality from the simulation camera.

  • Refactored WebRTC-related logic into a reusable object.

  • Fixed WebRTC stream selection bugs.

  • Added support for multiple simulation camera feeds.

  • Enhanced depth measurement capabilities and stability improvements.

  • Improved inheritance structure for camera modules with polymorphism. This allows the entire codebase to switch between SIM and normal USB cameras without the user having to do any extra logic in their own code. It just works.

  • Refactored the ZEDCam decoding logic for better performance and maintainability.

  • Updated SIMZEDCam to retrieve the navboard position accurately. This is used to emulate the VIO tracking.

  • Enabled DataChannel communication for Pixel Streaming commands.

  • Added point cloud calculation capability to SIMZEDCam.

  • Added logic to switch RoveComm_CPP over to sending to an IP specified in AutonomyConstants instead of just sending to localhost.

Other Changes

  • Enabled container window forwarding for both X11 and Wayland.
  • Made DEBUG and INFO report prints from the navigating state and waypoint handler cleaner.
  • Fix some major bugs with search pattern not adhering to the user-specified search radius.
  • Removed intermediate points in search pattern zigzag path. This will make our "point and shoot" navigation method work better with the path.

How It Works

  1. Streaming Setup: RGB frames are streamed from simulation cameras using WebRTC, leveraging a reusable object for modularity.
  2. Compatibility Improvements: Updated forwarding logic to ensure compatibility across X11 and Wayland environments.
  3. Camera Feeds: Supports multiple camera feeds in the simulation, with improved decoding logic and navboard position alignment.
  4. DataChannel Commands: Enables real-time control of streaming parameters using DataChannel communication.
  5. Point Cloud Calculation: Implements point cloud generation within SIMZEDCam for enhanced 3D spatial understanding. Point clouds are generated autonomy-side using the camera parameters and received depth measure.

Testing

  • Tested on Ubuntu (X11 and Wayland) and Windows environments.
  • No new Unit or Integration tests for camera classes.
  • Manual testing includes:
    1. Streaming RGB, DepthImage, and DepthMeasure frames from the simulator.
    2. Realigning ZED camera positions to the navboard.
    3. Controlling streaming via DataChannel messages.

Screenshots/Video (if applicable)

basestation
dev

Performance Improvements

  • Streamlined WebRTC handling reduces latency in RGB frame transmission.
  • Optimized decoding logic improves real-time processing of multiple camera feeds.

Known Issues

  • Potential instability when scaling to very high camera feed counts.
  • Limited testing on non-Linux platforms; additional validation required.
  • H264 errors from the hardware decoder are printed in the console if the network connection or routing is bad. Since the stream is UDP, data can get lost or arrive out of order. LibDataChannel doesn't handle this very well, and will send any complete frame it can depacketize to the encoder. There's not much I can do about that. LibDataChannel doesn't even send RTCP RRs or NACKs to the other client, which doesn't adhere to the WebRTC standards. The library is kinda wack, but it's really the only reasonable choice for C++ WebRTC.

Additional Context

  • Discussions ongoing about enhancing depth measurement accuracy on the simulator side of things.

@ClayJay3 ClayJay3 added enhancement Requests for new features or improvements to existing features. 5-Star Indicates a very difficult task, suitable for experts or those with extensive experience, requiring labels Jan 4, 2025
@ClayJay3 ClayJay3 temporarily deployed to docker-packages January 5, 2025 23:25 — with GitHub Actions Inactive
@ClayJay3 ClayJay3 temporarily deployed to docker-packages January 5, 2025 23:25 — with GitHub Actions Inactive
@ClayJay3 ClayJay3 temporarily deployed to docker-packages January 5, 2025 23:25 — with GitHub Actions Inactive
@ClayJay3 ClayJay3 temporarily deployed to docker-packages January 5, 2025 23:25 — with GitHub Actions Inactive
@ClayJay3 ClayJay3 temporarily deployed to docker-packages January 5, 2025 23:25 — with GitHub Actions Inactive
@ClayJay3 ClayJay3 temporarily deployed to docker-packages January 5, 2025 23:25 — with GitHub Actions Inactive
@ClayJay3 ClayJay3 temporarily deployed to docker-packages January 5, 2025 23:25 — with GitHub Actions Inactive
@ClayJay3 ClayJay3 temporarily deployed to docker-packages January 5, 2025 23:25 — with GitHub Actions Inactive
@ClayJay3 ClayJay3 temporarily deployed to docker-packages January 5, 2025 23:25 — with GitHub Actions Inactive
@ClayJay3 ClayJay3 temporarily deployed to docker-packages January 5, 2025 23:43 — with GitHub Actions Inactive
@ClayJay3 ClayJay3 temporarily deployed to docker-packages January 5, 2025 23:43 — with GitHub Actions Inactive
@ClayJay3 ClayJay3 temporarily deployed to docker-packages January 5, 2025 23:43 — with GitHub Actions Inactive
@ClayJay3 ClayJay3 temporarily deployed to docker-packages January 5, 2025 23:43 — with GitHub Actions Inactive
@ClayJay3 ClayJay3 temporarily deployed to docker-packages January 5, 2025 23:43 — with GitHub Actions Inactive
@ClayJay3 ClayJay3 temporarily deployed to docker-packages January 5, 2025 23:43 — with GitHub Actions Inactive
@ClayJay3 ClayJay3 temporarily deployed to docker-packages January 5, 2025 23:43 — with GitHub Actions Inactive
@ClayJay3 ClayJay3 temporarily deployed to docker-packages January 5, 2025 23:43 — with GitHub Actions Inactive
@ClayJay3 ClayJay3 merged commit 3a16537 into development Jan 5, 2025
45 checks passed
@ClayJay3 ClayJay3 deleted the topic/sim-cam branch January 5, 2025 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5-Star Indicates a very difficult task, suitable for experts or those with extensive experience, requiring cameras Tasks or issues specifically related to camera components, feeds, or image processing. cleanup Code refactoring or cleanup tasks to remove deprecated features, improve clarity, or ensure code qua dev-environment Issues or enhancements related to setting up or maintaining the development environment. docker Tasks or issues related to Docker containerization, including Dockerfile configuration and environme enhancement Requests for new features or improvements to existing features. simulator Tasks related to the simulator environment, including setup, enhancements, and testing. state-machine Issues related to the implementation, design, or modification of state machines in the system.
Projects
Status: Merged
Status: Merged
Development

Successfully merging this pull request may close these issues.

2 participants