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

Make camera settings configurable & more #38

Merged
merged 28 commits into from
Aug 7, 2024
Merged

Commits on May 28, 2024

  1. build: Set CMAKE_CXX_STANDARD_REQUIRED

    This is needed for clangd LSP working properly.
    luator committed May 28, 2024
    Configuration menu
    Copy the full SHA
    57b0d83 View commit details
    Browse the repository at this point in the history
  2. Add CameraSettings struct and function to load from file

    Add struct `CameraSettings` which is supposed to hold all configurable
    settings of the cameras (currently frame rate and the path to the pylon
    settings file).
    Further add functions to get default values and to load from TOML files.
    
    To avoid having to either pass around the path to the TOML file in
    higher-level scripts or to assume a hard-coded default path, use an
    environment variable TRICAMERA_CONFIG_FILE to specify the path.
    
    Note: This commit only adds the struct but does not yet use it.  It is
    the first step in getting rid of the hard-coded frame rate.
    luator committed May 28, 2024
    Configuration menu
    Copy the full SHA
    5f35b9c View commit details
    Browse the repository at this point in the history
  3. Reimplement Settings

    I realised that frame rate and the pylon settings file are actually used
    by different classes (TriCameraDriver and PylonDriver), so having them
    together in one structure was a bit messy.
    
    This commit rewrites the settings implementation to use a separate
    struct for each module/class that needs configuration but still bundles
    the loading in one central `Settings` class.
    
    Configuration for the different classes is expected to be in separate
    sections of the same TOML file:
    
    ```toml
    [pylon_driver]
    pylon_settings_file = "path/to/pylon_settings_file.txt"
    
    [tricamera_driver]
    frame_rate_fps = 10
    ```
    
    While the TOML file is parsed as a whole in the constructor, the structs
    for the different sections are only instantiated on demand, when the
    corresponding getter is called.
    luator committed May 28, 2024
    Configuration menu
    Copy the full SHA
    580c7de View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    1c9b0b9 View commit details
    Browse the repository at this point in the history
  5. Use Settings in PylonDriver

    Use `Settings` to get path to the Pylon settings file.
    luator committed May 28, 2024
    Configuration menu
    Copy the full SHA
    a098807 View commit details
    Browse the repository at this point in the history
  6. Use Settings in TriCameraDriver

    Expect a `Settings` instance as argument (optional, by default use the
    "load file from env variable"-constructor).
    Use it to set the `rate` at which images are fetched.
    Also pass it on to PylonDriver instances, so the file is only read once.
    
    This now technically allows to change the frame rate of the
    TriCameraDriver.  Note however, that currently the rate of 10Hz is still
    assumed in some other parts of the code, so changing it via the
    configuration may not yet work properly in all cases.
    luator committed May 28, 2024
    Configuration menu
    Copy the full SHA
    406fa95 View commit details
    Browse the repository at this point in the history

Commits on May 29, 2024

  1. Configuration menu
    Copy the full SHA
    21513fc View commit details
    Browse the repository at this point in the history
  2. Update CHANGELOG

    luator committed May 29, 2024
    Configuration menu
    Copy the full SHA
    d89dcf7 View commit details
    Browse the repository at this point in the history
  3. fix: Open camera when no device_user_id is given & refactor

    Move the code for connecting to a Pylon camera out of the constructor of
    PylonDriver to a standalone function.  This allows reusing the code.
    
    While doing this, I noticed that the steps to open the camera and start
    grabbing images where accidentally done in the `else`-block handling the
    case when a DeviceUserID is specified.  I remember that connecting to a
    camera without user id did work in the past, probably due to that.
    Moving the relevant function calls out of the if/else should fix it.
    luator committed May 29, 2024
    Configuration menu
    Copy the full SHA
    72114de View commit details
    Browse the repository at this point in the history

Commits on Jun 5, 2024

  1. Add executable pylon_dump_camera_settings

    This is a simple tool to load the current settings of a Pylon camera and
    print it to stdout (so it can be piped into a file).
    This makes it easier to produce a new Pylon settings file for use with
    PylonDriver.
    luator committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    0f06620 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6f94f93 View commit details
    Browse the repository at this point in the history
  3. (check_camera_sharpness) Do not assume camera rate

    The previous implementation seemed to assume a hard-coded frame rate of
    10 fps.  This wasn't even correct as PylonDriver uses the camera frame
    rate which is configured via the Pylon settings file (currently 100fps).
    
    Instead add a parameter "--update-freq" (still defaulting to 10) and use
    that to compute the sleep duration of `cv2.waitKey`.
    Behaviour should be mostly the same as before (with default values, the
    sleep duration just changes from 90 to 100) but no explicit camera frame
    rate is assumed anymore.
    luator committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    5e15d49 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    0a1f605 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    320d86a View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    83ea941 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    2bed6f4 View commit details
    Browse the repository at this point in the history
  8. More informative error if config file parsing fails

    Add some more context to the error message that is shown
    when parsing the configuration file fails.
    
    Add fmt library for more convenient string formatting.
    luator committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    392c8f7 View commit details
    Browse the repository at this point in the history
  9. Use fmt in PylonDriver

    luator committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    1f444e3 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    77a977b View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    40adfa2 View commit details
    Browse the repository at this point in the history

Commits on Jun 11, 2024

  1. Configuration menu
    Copy the full SHA
    9b3a6da View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    570001e View commit details
    Browse the repository at this point in the history
  3. build: Remove ament_export_libraries and _include_directories

    According to the
    [documentation](https://docs.ros.org/en/humble/How-To-Guides/Ament-CMake-Documentation.html#installing),
    those macros are not needed for target-based installs and should thus
    normally not be used anymore.
    luator committed Jun 11, 2024
    Configuration menu
    Copy the full SHA
    ceb2f23 View commit details
    Browse the repository at this point in the history

Commits on Jun 24, 2024

  1. Configuration menu
    Copy the full SHA
    9cc988b View commit details
    Browse the repository at this point in the history

Commits on Aug 5, 2024

  1. Add script tricamera_monitor_rate.py

    Add a script that fetches TriCamera observations to analyse the frame
    rate.  This is mostly meant for developers (for testing/debugging) but
    might also be useful for users to verify their settings are loaded
    correctly.
    luator committed Aug 5, 2024
    Configuration menu
    Copy the full SHA
    e643965 View commit details
    Browse the repository at this point in the history
  2. doc: Update CHANGELOG

    luator committed Aug 5, 2024
    Configuration menu
    Copy the full SHA
    3927d86 View commit details
    Browse the repository at this point in the history
  3. Reformat C++

    luator committed Aug 5, 2024
    Configuration menu
    Copy the full SHA
    37e0dee View commit details
    Browse the repository at this point in the history
  4. Reformat Python

    luator committed Aug 5, 2024
    Configuration menu
    Copy the full SHA
    74b4518 View commit details
    Browse the repository at this point in the history