Servolens

class Servolens(*args, **kwargs)

Bases: pybind11_object

Interface for the Servolens lens attached to the camera fixed on the Afma4 robot.

The code below shows how to manipulate this class to get and modify the position of the focal lens.

#include <iostream>
#include <visp3/vs/vpServolens.h>

int main()
{
  // Open the serial device to communicate with the Servolens lens
  vpServolens servolens("/dev/ttyS0");

  // Get the current zoom position
  unsigned zoom;
  servolens.getPosition(vpServolens::ZOOM, zoom);
  std::cout << "Actual zoom value: " << zoom << std::endl;

  // Set a new zoom value
  servolens.setPosition(vpServolens::ZOOM, zoom+1000);
}

Overloaded function.

  1. __init__(self: visp._visp.robot.Servolens) -> None

Default constructor. Does nothing.

Note

See open()

  1. __init__(self: visp._visp.robot.Servolens, port: str) -> None

Open and initialize the Servolens serial link at 9600 bauds, 7 data bits, even parity, 1 stop bit. The cariage return mode is not active, that means that each character is directly read without waitong for a cariage return.

Note

See open()

Methods

__init__

Overloaded function.

close

Close the Servolens serial link.

enablePrompt

Enable or disable the emission of the Servolens prompt "SERVOLENS>".

getCameraParameters

These parameters are computed from the Dragonfly2 DR2-COL camera sensor pixel size (7.4 um) and from the servolens zoom position.

getPosition

Get the Servolens current servo position.

open

Open and initialize the Servolens serial link at 9600 bauds, 7 data bits, even parity, 1 stop bit.

reset

Reset the Servolens.

setAutoIris

Activates the auto iris mode of the Servolens.

setController

Set the controller type.

setPosition

Set the Servolens servo to the desired position.

Inherited Methods

Operators

__doc__

__init__

Overloaded function.

__module__

Attributes

AUTO

CONTROLLED

FOCUS

FOCUS_MAX

FOCUS_MIN

IRIS

IRIS_MAX

IRIS_MIN

RELEASED

ZOOM

ZOOM_MAX

ZOOM_MIN

__annotations__

class ControllerType(self, value: int)

Bases: pybind11_object

Values:

  • AUTO

  • CONTROLLED

  • RELEASED

__and__(self, other: object) object
__eq__(self, other: object) bool
__ge__(self, other: object) bool
__getstate__(self) int
__gt__(self, other: object) bool
__hash__(self) int
__index__(self) int
__init__(self, value: int)
__int__(self) int
__invert__(self) object
__le__(self, other: object) bool
__lt__(self, other: object) bool
__ne__(self, other: object) bool
__or__(self, other: object) object
__rand__(self, other: object) object
__ror__(self, other: object) object
__rxor__(self, other: object) object
__setstate__(self, state: int) None
__xor__(self, other: object) object
property name : str
class LimitsType(self, value: int)

Bases: pybind11_object

Values:

  • AUTO

  • CONTROLLED

  • RELEASED

__and__(self, other: object) object
__eq__(self, other: object) bool
__ge__(self, other: object) bool
__getstate__(self) int
__gt__(self, other: object) bool
__hash__(self) int
__index__(self) int
__init__(self, value: int)
__int__(self) int
__invert__(self) object
__le__(self, other: object) bool
__lt__(self, other: object) bool
__ne__(self, other: object) bool
__or__(self, other: object) object
__rand__(self, other: object) object
__ror__(self, other: object) object
__rxor__(self, other: object) object
__setstate__(self, state: int) None
__xor__(self, other: object) object
property name : str
class ServoType(self, value: int)

Bases: pybind11_object

Values:

  • AUTO

  • CONTROLLED

  • RELEASED

__and__(self, other: object) object
__eq__(self, other: object) bool
__ge__(self, other: object) bool
__getstate__(self) int
__gt__(self, other: object) bool
__hash__(self) int
__index__(self) int
__init__(self, value: int)
__int__(self) int
__invert__(self) object
__le__(self, other: object) bool
__lt__(self, other: object) bool
__ne__(self, other: object) bool
__or__(self, other: object) object
__rand__(self, other: object) object
__ror__(self, other: object) object
__rxor__(self, other: object) object
__setstate__(self, state: int) None
__xor__(self, other: object) object
property name : str
__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: visp._visp.robot.Servolens) -> None

Default constructor. Does nothing.

Note

See open()

  1. __init__(self: visp._visp.robot.Servolens, port: str) -> None

Open and initialize the Servolens serial link at 9600 bauds, 7 data bits, even parity, 1 stop bit. The cariage return mode is not active, that means that each character is directly read without waitong for a cariage return.

Note

See open()

close(self) None

Close the Servolens serial link.

Note

See open()

enablePrompt(self, active: bool) None

Enable or disable the emission of the Servolens prompt “SERVOLENS>”.

Parameters:
active: bool

true to activate the emission of the prompy. false to disable this functionality.

getCameraParameters(self, I: visp._visp.core.ImageGray) visp._visp.core.CameraParameters

These parameters are computed from the Dragonfly2 DR2-COL camera sensor pixel size (7.4 um) and from the servolens zoom position.

#include <visp3/vs/vpServolens.h>

int main()
{
  // UNIX vpServolens servolens("/dev/ttyS0");
#if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)))

  vpImage<unsigned char> I(240, 320);
  vpCameraParameters cam = servolens.getCameraParameters(I);
  std::cout << "Camera parameters: " << cam << std::endl;
#endif
  }
Parameters:
I: visp._visp.core.ImageGray

An image coming from the Dragonfly2 camera attached to the servolens.

getPosition(self, servo: visp._visp.robot.Servolens.ServoType, position: int) tuple[bool, int]

Get the Servolens current servo position.

Parameters:
servo: visp._visp.robot.Servolens.ServoType

Servolens servo motor to actuate.

position: int

Measured position of the servo.

Returns:

A tuple containing:

  • position: Measured position of the servo.

open(self: visp._visp.robot.Servolens, port: str = /dev/ttyS0) None

Open and initialize the Servolens serial link at 9600 bauds, 7 data bits, even parity, 1 stop bit. The cariage return mode is not active, that means that each character is directly read without waitong for a cariage return.

Note

See close()

Parameters:
port

Serial device like /dev/ttyS0 or /dev/ttya.

reset(self) None

Reset the Servolens.

setAutoIris(self, enable: bool) None

Activates the auto iris mode of the Servolens.

Parameters:
enable: bool

true to activate the auto iris.

setController(self, controller: visp._visp.robot.Servolens.ControllerType) None

Set the controller type.

Parameters:
controller: visp._visp.robot.Servolens.ControllerType

Controller type.

setPosition(self, servo: visp._visp.robot.Servolens.ServoType, position: int) None

Set the Servolens servo to the desired position.

Parameters:
servo: visp._visp.robot.Servolens.ServoType

Servolens servo motor to actuate.

position: int

Desired position of the servo.