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

DO NOT MERGE Azure Kinect Auto Tune Exposure Node #6

Open
wants to merge 497 commits into
base: plusone
Choose a base branch
from

Conversation

ShannonPlusOne
Copy link

@ShannonPlusOne ShannonPlusOne commented Jun 7, 2023

Urgency for the review.

  • Not blocking anything.

Issues this MR addresses.

  • Creates a new node that allows users to update the Azure Kinect camera exposure and auto tune the camera exposure with a provided target blue value from the command line.

The change MR adds.

  • k4a_exposure_calibration_node
  • associated header file for node
  • testing for node: checks
  • update CMake to include catkin testing for node
  • Location of node: Azure_Kinect_ROS_Driver/src/k4a_exposure_calibration_node.cpp
  • Where to launch from: Aaron's Kinect Support repo, using my Azure_Kinect_ROS_Driver repo (plusone branch) in the dockerfile, the node launches from the plusone.launch file from my Azure Kinect ROS Driver repo.
  • How to get sensor data: node subscribes to the k4a device's /rgb/raw/image as an image transport subscriber. The callback for the image transport subscriber converts the raw k4a image into an OpenCV mat for the node to use.
  • How to update exposure on Kinect: In the akdk container after running "source ws/devel/setup.sh" run "roslaunch azure_kinect_ros_driver plusone.launch". In a new terminal in the akdk container, re-source from the same file then run "rosservice call /k4a_update_exposure [uint32_t val 488-1000000]". To auto tune exposure for a given target blue value, run "rosservice call /k4a_auto_tune_exposure [uint8_t val 0-255]".
  • Structure of node

  • Approach for actual calibration: The k4a_auto_tune_exposure service takes a target blue value (provided in the command line for now, provided by pilot exposure information in the future) and loops through exposures until the average blue value of the image meets or exceeds the target blue value. It starts at the minimum exposure (488) and increments by a value defined in the node.h file. The loop pulls an updated image from the rgb/raw/image subscription and calculates the average blue value for that image by splitting the image into its color channels and looping through the rows and columns of pixels to total the blue value. It averages the blue value across the pixels then compares this average to the target blue value. If the average is less than the target blue value the loop proceeds to the next exposure. If the average is equal to or greater than the target blue value the loop breaks and the exposure remains at this exposure time.

sstoehr_catkin_test_success

  • Unit testing: unit testing currently has coverage to check if the camera exposure has been updated, check if the requested exposure is within appropriate bounds, check if the target blue value has been met or exceeded, and check if the image to be looped through to calculate the average blue value is populated. To run tests in the akdk container, after sourcing as described above, change into the ws directory and run "sudo catkin test azure_kinect_ros_driver".

Branches

Base branch: main

Review Checklist in order (Required)

  1. Blocked by {Links to other MR's, or conditions need met. List multiple lines if there are multiple depended MRs}
  2. (Optional) Add unit tests for the change added. Add brief document what the test cases do.
  3. Passing CI.
  4. (Optional) Physical/local test.
    1. @{tester's account} Physical/local test on {describe the tests}
    2. Test output and/or result shared on this MR for the review and record sake.
  5. (Optional) Add documentation (e.g. for new feature / config / parameter).
  6. Remove WIP status from the MR title.
  7. Assign the reviewer (person knows the subject domain the best).
  8. Code review items.
    1. {Specific review points. List multiple if any.}
  9. Do not forget to press Approve button when you approve. If you don't see one, leave a comment.

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.

3 participants