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

How to close the auto-focus function of the camera? #8

Open
JingKangSun opened this issue Mar 29, 2022 · 2 comments
Open

How to close the auto-focus function of the camera? #8

JingKangSun opened this issue Mar 29, 2022 · 2 comments

Comments

@JingKangSun
Copy link

Hi,

I want to do a calibration on the camera of the kinova-gen3, however, I found that the camera open the auto-focus function.

How can I close this function?

Thanks.

@felixmaisonneuve
Copy link
Contributor

felixmaisonneuve commented Apr 4, 2022

Hi @JingKangSun,

In our kortex repo, we actually provide an example on how to disable the auto-focus :
https://github.com/Kinovarobotics/kortex/blob/master/api_python/examples/500-Gen3_vision_configuration/03-vision_sensor_focus_action.py#L82-L86

To disable the auto-focus, you could modify the example to something like this

def example_routed_vision_do_autofocus_action(vision_config, vision_device_id):
    print("\n-- Using Vision Config Service to disable the auto-focus --")
    sensor_focus_action.focus_action = VisionConfig_pb2.FOCUSACTION_DISABLE_FOCUS
    vision_config.DoSensorFocusAction(sensor_focus_action, vision_device_id)
    print("-- Place or remove an object from the center of the camera, observe the focus doesn't change --")
    example_wait_for_focus_action()

...

def main():
    # Import the utilities helper module
    sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
    import utilities

    # Parse arguments
    args = utilities.parseConnectionArguments()
    
    # Create connection to the device and get the router
    with utilities.DeviceConnection.createTcpConnection(args) as router:

        device_manager = DeviceManagerClient(router)
        vision_config = VisionConfigClient(router)

        # example core
        vision_device_id = example_vision_get_device_id(device_manager)

        if vision_device_id != 0:
            example_routed_vision_do_autofocus_action(vision_config, vision_device_id)
            # example_routed_vision_set_focus_point(vision_config, vision_device_id)
            # example_routed_vision_set_manual_focus(vision_config, vision_device_id)

I do not know at the moment if this config is persistant after a reboot. If it is not, I suppose you could run it before you want to do a calibration

Looking at the web app, I see a "PAUSE AUTO-FOCUS" button (in Operations->Camera) that might be doing just that. I am unsure however. I have very little experience with the vision module.

Best,
Felix

@SnallQiu
Copy link

@JingKangSun Is there any good way to solve this? Thank you!

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

No branches or pull requests

3 participants