Skip to content

fix(launch-dream-ros): capture_frame service calls global (+1 more) - #44

Open
andrewwhitecdw wants to merge 1 commit into
NVlabs:masterfrom
andrewwhitecdw:bugfix/launch-dream-ros-assorted-ae7876b3
Open

fix(launch-dream-ros): capture_frame service calls global (+1 more)#44
andrewwhitecdw wants to merge 1 commit into
NVlabs:masterfrom
andrewwhitecdw:bugfix/launch-dream-ros-assorted-ae7876b3

Conversation

@andrewwhitecdw

@andrewwhitecdw andrewwhitecdw commented Jul 27, 2026

Copy link
Copy Markdown

Small fixes in scripts/launch_dream_ros.py:

fix: capture_frame service calls global dream_ros instead of self

Fix: Replace:

    def on_capture_frame(self, req):
        print("Capturing frame.")
        found_kp_projs_net_input = dream_ros.process_image()
        print(found_kp_projs_net_input)
        (
            kp_projs_raw_good_sample,
            kp_positions_good_sample,
        ) = dream_ros.keypoint_correspondences(found_kp_projs_net_input)
        if self.capture_frame_max_kps and kp_projs_raw_good_sample is not None:
            n_found_keypoints = kp_projs_raw_good_sample.shape[0]
            if n_found_keypoints != self.dream_network.n_keypoints:
                print(
                    "Only found {} keypoints -- not continuing. Try again.".format(
                        n_found_keypoints
                    )
                )
                return []
        if (
            kp_projs_raw_good_sample is not None
            and kp_positions_good_sample is not None
        ):
            dream_ros.solve_pnp_buffer(
                kp_projs_raw_good_sample, kp_positions_good_sample
            )
        return []

with:

    def on_capture_frame(self, req):
        print("Capturing frame.")
        found_kp_projs_net_input = self.process_image()
        if found_kp_projs_net_input is None:
            print("No image available yet -- not continuing.")
            return []
        print(found_kp_projs_net_input)
        (
            kp_projs_raw_good_sample,
            kp_positions_good_sample,
        ) = self.keypoint_correspondences(found_kp_projs_net_input)
        if self.capture_frame_max_kps and kp_projs_raw_good_sample is not None:
            n_found_keypoints = kp_projs_raw_good_sample.shape[0]
            if n_found_keypoints != self.dream_network.n_keypoints:
                print(
                    "Only found {} keypoints -- not continuing. Try again.".format(
                        n_found_keypoints
                    )
                )
                return []
        if (
            kp_projs_raw_good_sample is not None
            and kp_positions_good_sample is not None
        ):
            self.solve_pnp_buffer(
                kp_projs_raw_good_sample, kp_positions_good_sample
            )
        return []

fix: truthiness rejects keypoints at image coordinate zero

Fix: Replace:

            if (
                this_kp_proj_est is not None
                and this_kp_proj_est[0]
                and this_kp_proj_est[1]
                and not (this_kp_proj_est[0] < -999.0 and this_kp_proj_est[1] < 0.999)
            ):

with:

            if (
                this_kp_proj_est is not None
                and not (this_kp_proj_est[0] < -999.0 and this_kp_proj_est[1] < 0.999)
            ):

Files changed

  • scripts/launch_dream_ros.py

@andrewwhitecdw
andrewwhitecdw marked this pull request as ready for review August 3, 2026 22:07
@andrewwhitecdw

Copy link
Copy Markdown
Author

Closing this sweep-generated PR: PR has 2 commits; sweep requires exactly one commit per PR. It does not meet the sweep requirements (single signed-off commit).

Signed-off-by: Andrew White <andrewwhitecdw@users.noreply.github.com>
Signed-off-by: andrewwhitecdw <andrewwhitecdw@users.noreply.github.com>
@andrewwhitecdw
andrewwhitecdw force-pushed the bugfix/launch-dream-ros-assorted-ae7876b3 branch from 5c89a3f to 98b895b Compare August 18, 2026 00:18
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.

1 participant